Exploring interprocess communication
Interprocess communication (IPC) is a way of interacting between processes using a shared mechanism or interface. In this section, we will take a practical approach to exploring various communication mechanisms between processes. Linux processes can typically share data and synchronize their actions via the following interfaces:
- Shared storage (files)
- Shared memory
- Named and unnamed pipes
- Message queues
- Sockets
- Signals
To illustrate most of these communication mechanisms, we will build our examples using a model of producer and consumer processes. The producer and consumer share a common interface, where the producer writes some data that's read by the consumer. IPC mechanisms are usually implemented in distributed systems, built around more or less complex applications. Our examples will use simple bash scripts (producer.sh
and consumer.sh
), thus mimicking the producer and consumer processes. We hope that...