Skip to content

Process

Category: Units of execution · Status: stub · Lessons: chapter 08, Processes (planned)

One line: A running program with its own address space, open files and at least one thread; two processes share nothing unless they arrange to.

Also called: OS process.

How it connects

flowchart LR
  n_subprocess["Child process"]
  n_ipc["Inter-process communication"]
  n_mpi["MPI"]
  n_multiprocessing["Multiprocessing"]
  n_process["Process"]
  n_thread["Thread"]
  n_ipc -->|uses| n_process
  n_mpi -->|uses| n_process
  n_multiprocessing -->|uses| n_process
  n_process ---|vs| n_thread
  n_subprocess -->|is a| n_process
  classDef center stroke-width:3px
  class n_process center
  classDef outside stroke-dasharray: 4 3
  class n_subprocess,n_ipc,n_mpi,n_multiprocessing,n_thread outside

In each language

Rust std::process::Command spawns a child process and returns a Child
Go os/exec runs an external command
C fork copies the calling process but only the thread that called it; posix_spawn starts a new program
Java ProcessBuilder starts a Process; ProcessHandle (Java 9) inspects any process
Python subprocess runs programs; multiprocessing runs Python functions in child processes
C# Process.Start
Erlang and Elixir An external program is reached through a port ↗, and runs in another OS process
The operating system fork(2) and execve(2); on Linux clone(2) creates processes and threads alike

Where to read more