operating-systems concurrency

Definition

Inter-Process Communication (IPC)

Inter-process communication (IPC) refers to the mechanisms provided by an operating system that allow processes to communicate with each other and synchronise their actions.

IPC is essential for coordinating tasks in a multitasking environment, especially when processes must work together to solve a larger problem (cooperating processes).

Primary Models

There are two fundamental models of inter-process communication:

Shared Memory

In the shared memory model, a region of memory is established that is mapped into the address space of multiple processes. Processes can then exchange information by reading and writing data to this shared region.

  • Advantage: Maximum speed and convenience of memory access.
  • Challenge: Requires explicit mutual exclusion (e.g., via semaphores) to prevent race conditions.

Message Passing

In the message passing model, communication occurs by means of messages exchanged between the cooperating processes.

  • Advantage: Useful for smaller amounts of data and easier to implement in distributed systems.
  • Challenge: Higher overhead due to kernel intervention for each message.

Comparison

FeatureShared MemoryMessage Passing
CommunicationVia memory read/writeVia send/receive primitives
SpeedHigh (memory speed)Lower (system call overhead)
SynchronisationManual (Semaphores, etc.)Implicit in the primitives
SuitabilityLocal communicationDistributed systems