Cooperative Processes

My latest project in ECE 3574 is about cooperative process. The purpose of our assignment to communicate between 2 different files which includes 5 processes altogether. Cooperative process is the idea of of passing/retrieving information within the processes. There are two ways that this can be done:

1) Shared Memory

In shared memory, all communicating processes must establish a region of shared memory. Each processes then reads/writes to this shared memory location. It is important to make sure that two processes may read and write at the same time. A classic example of shared memory problem could be encountered during a producer consumer problem. The producer produces while the consumer consumes the information. The best place to put the data would be in the shared memory location which could be accessed by both the producer and consumer.

2)Message Passing

There is no memory allocated in message passing. A small mail box with a corresponding mail box number is attached to the processes. The processes send and receive data through this mailbox. A communication link must be established for two processes to communicate. My current project focus of Message Passing which utilizes Posix Message Queues.

2 thoughts on “Cooperative Processes

  1. Sounds a bit related to the “Heard it on the Pipeline” homework for ECE2524. How are the two IPC (inter-process communication) methods you mentioned related to what we have done with the “pipe” system call? Look up the manual pages for `mmap` and `shmget`, how do they relate?

  2. Pipes connect the output of a certain thing to an input of another thing. There is no place where a memory is allocated to store the data. Instead the data is directly transferred from output to input. For the assignment in class, we directly transferred the stdout of producer to stdin of consumer. The memory is not stored anywhere. On the contrary, the message passing creates a mail box on each process whereas shared memory creates a memory in the CPU.

Leave a Reply

Your email address will not be published. Required fields are marked *