Explaining inter-process communication
Inter-process communication (IPC) is a way of interacting between processes using a shared mechanism or interface. In this section, we will take a short theoretical approach to exploring various communication mechanisms between processes. For more details on this matter and some of the mechanisms used, head to Chapter 8, Linux Shell Scripting.
Linux processes can typically share data and synchronize their actions via the following interfaces:
- Shared storage (files): In its simplest form, the shared storage of an IPC mechanism can be a simple file that’s been saved to disk. The producer then writes to a file while the consumer reads from the same file. In this simple use case, the obvious challenge is the integrity of the read/write operations due to possible race conditions between the underlying operations. To avoid race conditions, the file must be locked during write operations to prevent overlapping I/O with another read...