Process
- In Turkish
- süreç
In short
A process is a running instance of a program, with its own memory space, resources, and at least one thread of execution managed by the operating system.
What is a process in computing?
A process is a program that is currently running. The program itself is just a file on disk; when you launch it, the operating system loads its code into memory and creates a process with a unique process ID (PID), its own private memory space, open file handles, and at least one thread that executes instructions.
The operating system keeps a record for each process, often called a process control block, that stores its state (running, ready, waiting, or terminated), saved CPU register values, and memory mappings. Processes are isolated from each other, so one crashing process normally cannot corrupt another's memory. When processes need to cooperate, they use inter-process communication (IPC) mechanisms such as pipes, sockets, or shared memory.
A useful analogy: a program is a recipe, and a process is a cook actually preparing that recipe in a kitchen. Several cooks can follow the same recipe at once, just as you can open several windows of the same app, each running as its own process. Browsers, web servers, and databases often run many processes to isolate work and use multiple CPU cores.
A process is often confused with a thread. A process is the container that owns memory and resources, while a thread is a path of execution inside a process; threads in the same process share memory, but separate processes do not. Creating a new process is also more expensive than creating a new thread.
At a glance
Key takeaways
- A process is a program in execution, identified by a process ID (PID).
- Each process has its own isolated memory space and resources.
- A process contains one or more threads that run its code.
- Processes communicate through IPC mechanisms such as pipes, sockets, and shared memory.
- The operating system schedules processes onto the available CPU cores.
Example
# Show the PID of the current shell
echo $$
# Start a background process and print its PID
sleep 60 &
echo "Started process $!"
# List running processes and filter for sleep
ps aux | grep sleep
# Ask the background process to terminate
kill $!Readers ask
What is the difference between a program and a process?
A program is a passive file of instructions stored on disk. A process is an active, running instance of that program, with its own memory, state, and process ID.
What is the difference between a process and a thread?
A process is an independent running program with its own memory space, while a thread is a unit of execution inside a process. Threads of the same process share memory, which makes them lighter but requires careful synchronization.
What is a zombie process?
A zombie process has finished running but still has an entry in the process table because its parent has not yet read its exit status. It uses no CPU and disappears once the parent collects that status.
Often compared
See also
- ThreadOperating Systems, p. 33A thread is the smallest unit of execution an operating system can schedule, running inside a process and sharing that process's memory with other threads.
- KernelOperating Systems, p. 17A kernel is the core part of an operating system that manages the CPU, memory, and hardware devices and controls how programs get access to those resources.
- CPU SchedulingOperating Systems, p. 6CPU scheduling is how an operating system decides which ready process or thread runs on each CPU core next, and for how long, so the processor is shared fairly.
- Virtual MemoryOperating Systems, p. 37Virtual memory is an operating system technique that gives each process its own private address space and maps it to physical RAM or disk behind the scenes.
- ConcurrencyProgramming Fundamentals, p. 12Concurrency is a program's ability to make progress on several tasks in overlapping time periods, such as serving many users at once rather than one at a time.
- ContainerDevOps & Cloud, p. 12A container is a lightweight, isolated package that bundles an application with its dependencies and runs it on the host's shared operating system kernel.
Spotted a mistake or something missing on this page?Suggest an edit