
进程间通信
文章平均质量分 70
啊飞飞飞
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Linuxc 进程间通信之匿名管道1 父子间通信
利用匿名管道实现父子进程间通信,要求1.父进程发送字符串“hello child”给子进程;2.子进程收到父进程发送的数据后,给父进程回复“hello farther”;3.父子进程通信完毕,父进程依次打印子进程的退出状态以及子进程的pid。源代码:#include <unistd.h>#include <stdio.h>#include <stdlib.h>i...原创 2018-05-25 21:00:31 · 2972 阅读 · 0 评论 -
Linuxc 进程间通信之匿名管道2 兄弟间通信
利用匿名管道实现兄弟进程间通信,要求1.兄进程发送字符串“This is elder brother ,pid is (兄进程进程号)”给弟进程;2.弟进程收到兄进程发送的数据后,给兄进程回复“This is younger brother ,pid is(第进程进程号)”;源代码:#include <unistd.h>#include <stdio.h>#include ...原创 2018-05-25 21:03:00 · 1304 阅读 · 0 评论 -
Linuxc 进程间通信之有名管道
利用有名管道文件实现进程间通信,要求1.写进程向有名管道文件写入10次“hello world”;2.读进程读取有名管道文件中的内容,并依次打印。源代码:w.c#include <fcntl.h>#include <sys/types.h>#include <sys/stat.h>#include <stdlib.h>#include <std...原创 2018-05-25 21:11:24 · 1288 阅读 · 0 评论 -
Linuxc之共享内存
1.创建共享内存,写进程每隔2秒向内存写入一次“hello world”; 如果结束写操作,则写进程写入“end”; 2.读进程从共享内存读取数据,并打印。直到读到“end”为止。源代码:write.c#include <stdio.h>#include <stdlib.h>#include <sys/ipc.h>#include <sys/shm.h&g...原创 2018-06-22 19:37:31 · 887 阅读 · 1 评论 -
Linuxc之消息队列
1.进程A向消息队列发送消息“hello,world” 2.进程B从消息队列读取消息,并打印。源代码:write.c#include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <sys/ipc.h>#include <sys/msg.h>#include <...原创 2018-06-22 19:43:50 · 1117 阅读 · 0 评论 -
Linuxc之信号量集合
源代码:receive.c#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <sys/ipc.h>#include <sys/types.h>#include <sys/sem.h>int main(){ int semid,semval1,sem...原创 2018-06-22 19:45:19 · 820 阅读 · 1 评论