文件名称:LinuxProcessCommunication
- 所属分类:
- Linux/Unix编程
- 资源属性:
- 上传时间:
- 2012-11-26
- 文件大小:
- 34kb
- 下载次数:
- 6次
- 提 供 者:
- ZH***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
创建两个生产者进程和两个消费者进程,生产者进程a需要生成10000个整数,每次都将自己的进程号(用getpid()函数获得)和生成的整数放入共享内存中(共享内存大小为64Byte)。生产者b每次从26个英文字母中选一个,并将自己的进程号和选中的字母放入共享内存中,直到26个字母全部都选中。消费者进程c负责从共享内存中读取数据生产者进程a的数据并且将这些数据写入文件a.out。消费者进程d从共享内存读取进程b的数据后写入b.out中。-The process of the creation of two producers and two consumers process, producers process a need to generate 10,000 integers, each of its own process (using getpid () function to obtain) and generated integer Add shared memory ( shared memory size of 64Byte). Producer b each 26 letters of the alphabet from a selected and the process of their own and select Add shared memory of the letters until all 26 letters selected. C is responsible for the consumer process to read from shared memory data producers and the process of a data write to file these data a.out. Consumer process d from the process of shared memory to read the data b in b.out write.
相关搜索: 共享内存
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Linux进程通信的系统调用--实现生产者和消费者问题
...............................................\a.out
...............................................\b.out
...............................................\main
...............................................\Makefile~
...............................................\operation.o
...............................................\producer_a
...............................................\producer_b
...............................................\semaphore.o
...............................................\sharemem.o
...............................................\a.out
...............................................\b.out
...............................................\main
...............................................\Makefile~
...............................................\operation.o
...............................................\producer_a
...............................................\producer_b
...............................................\semaphore.o
...............................................\sharemem.o