Inter-process Communication : Inter-process Communication Inter process comm. : Inter process comm. IPC provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space.
Its particularly useful in a distributed environment where the communicating processes may reside on different computers connected with a network. MESSAGE PASSING SYSTEM : MESSAGE PASSING SYSTEM To allow processes to communicate with one another without the need to resort to shared data. P Q Communication link Logical implementations : Logical implementations Direct communication
receive(A, message)? Synchronization : Synchronization Communication b/w processes takes place by calls to send and receive primitives
Nonblocking receive Buffering : Buffering Messages reside in a temporary queue
Unbounded capacity Example-Linux : Example-Linux Processes communicate with each other and with the kernel to coordinate their activities. Linux supports a number of Inter-Process Communication (IPC) mechanisms.
Used to signal asynchronous events to one or more processes. There are a set of defined signals that the kernel can generate or that can be generated by other processes in the system Slide 8: 2. Pipes
Pipes are unidirectional byte streams which connect the standard output from one process into the standard input of another process. Neither process is aware of this redirection and behaves just as it would normally. It is the shell which sets up these temporary pipes between the processes.
ls | pr | lpr Slide 9: 3. System V iPC Mechanisms
message queues :Linux maintains a list of message queues, the msgque vector; each element of which points to a msqid_ds data structure that fully describes the message queue. When message queues are created a new msqid_ds data structure is allocated from system memory and inserted into the vector.
Semaphores :Semaphores can be used to implement critical regions, areas of critical code that only one process at a time should be executing.
Shared Memory :allows one or more processes to communicate via memory that appears in all of their virtual address spaces. The pages of the virtual memory is referenced by page table entries in each of the sharing processes' page tables.