Skip to content

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

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