Definition
Inter-Process Communication (IPC)
Inter-process communication provides mechanisms for processes to communicate and synchronise their actions. It is essential for coordinating cooperating processes in a multitasking environment.
Models
Shared Memory
A memory region is mapped into multiple processes’ address spaces. Processes exchange data by reading and writing this shared region.
Benefit: Maximum speed (memory access).
Challenge: Requires explicit mutual exclusion to prevent race conditions.
Message Passing
Processes exchange data via
send/receiveprimitives, with kernel mediation.Benefit: Easier to implement in distributed systems.
Challenge: Higher overhead due to kernel intervention per message.
Comparison
| Feature | Shared Memory | Message Passing |
|---|---|---|
| Communication | Memory read/write | send/receive |
| Speed | High (memory speed) | Lower (system call overhead) |
| Synchronisation | Manual (semaphores, etc.) | Implicit in primitives |
| Suitability | Local communication | Distributed systems |