Imagine two workers in separate rooms who need to coordinate. Processes face a similar problem: the operating system keeps them isolated so one cannot accidentally interfere with another, but that isolation makes exchanging information harder. Interprocess communication (IPC) is the set of operating-system mechanisms that lets processes and threads exchange data and synchronize their work. section 4.2 section 5.1
The two broad approaches are shared memory and message passing. Shared memory can efficiently exchange large amounts of data, but access must be synchronized. With message passing, tasks send and receive data through a channel managed by the operating system. That interface avoids conflicts over the channel, though copying data into and out of it adds cost. section 5.1 section 5.3 section 5.6
Choose a mechanism to fit the exchange:
- A pipe carries data in one direction, making it useful for synchronous producer–consumer communication; two pipes are needed for traffic in both directions. section 5.3 section 5.6
- A message queue supports asynchronous exchange between processes or threads. section 5.6
- A socket provides a two-way channel that can use networking capabilities. section 5.6
Passing a rubber duck
In a Python pipe example, a writer sends the string “Rubber duck” with `conn.send(...)`, and a reader obtains it with `conn.recv()`. The printed result makes the handoff visible: the reader receives the same message the writer sent. section 5.3
IPC is not automatically a performance win. Process isolation is valuable, but communication has a cost; shared memory trades easier data exchange for the need to coordinate access. Pick the mechanism according to how much data must move and how the tasks need to coordinate. section 4.2 section 5.6

