Inter-process communication¶
Category: Communication · Status: stub · Lessons: chapter 08, Processes (planned)
One line: The ways separate processes exchange data: pipes, sockets, shared-memory segments, signals and message queues.
Also called: IPC, pipes, signals.
How it connects¶
flowchart LR
n_ipc["Inter-process communication"]
n_multiprocessing["Multiprocessing"]
n_process["Process"]
n_signals["Signals"]
n_ipc -->|uses| n_process
n_multiprocessing -->|uses| n_ipc
n_signals -->|is a| n_ipc
classDef center stroke-width:3px
class n_ipc center
classDef outside stroke-dasharray: 4 3
class n_multiprocessing,n_process,n_signals outside
- Kinds: Signals
- Is built on: Process
- Is used by: Multiprocessing
- See also: Child process, Message passing, Process
In each language¶
| Rust | Stdio::piped ↗ connects a child process by a pipe; UnixStream ↗ on Unix |
| Go | Cmd.StdoutPipe ↗ for a child's output, os.Pipe ↗ for a raw pipe |
| C | POSIX pipe ↗, mkfifo ↗, socketpair ↗, shm_open ↗ and mq_open ↗ |
| Java | ProcessBuilder ↗ for child processes; UnixDomainSocketAddress ↗ (Java 16) for local sockets |
| Python | subprocess ↗ for child processes; multiprocessing ↗ pipes and queues between Python processes |
| C# | System.IO.Pipes ↗, anonymous and named pipes |
| JavaScript | Node's child_process ↗ sets up pipes for the child's stdin, stdout and stderr by default |
| Erlang and Elixir | ports ↗, the basic mechanism for communicating with the external world; Elixir's Port ↗ |
| The operating system | pipes ↗, UNIX domain sockets ↗, POSIX shared memory ↗, message queues ↗ and signals ↗ |
Where to read more¶
- In a sibling library: Linux: head closes the pipe early ↗
- In the books: Grokking Concurrency, Kirill Bobrov — ch. 5, 'Interprocess communication'
- In the books: Parallel Programming with Python, Jan Palach — ch. 6, 'Utilizing Parallel Python' → 'Understanding interprocess communication'
- In the books: Distributed Graph Algorithms for Computer Networks, K. Erciyes — ch. 18, 'ASSIST: A Simulator to Develop Distributed Algorithms' → 'Interprocess Communication'
- In the books: Advanced Programming in the UNIX Environment, W. Richard Stevens, Stephen A. Rago — ch. 15, 'Interprocess Communication'
- In the books: Operating System Concepts, Abraham Silberschatz, Peter Baer Galvin, Greg Gagne — ch. 3, 'Processes' → 'Interprocess Communication'
- In the books: High Performance Python, Micha Gorelick, Ian Ozsvald — ch. 9, 'The multiprocessing Module' → 'Verifying Primes Using Interprocess Communication'
- Reference: Wikipedia: Inter-process communication ↗