Process and Thread Management
Process and thread management is how the operating system creates, schedules, and tears down units of execution — processes with their own address spaces and threads that share one — and switches the processor among them.
Definition
Process and thread management comprises the operating-system mechanisms that represent running programs as processes and threads, maintain their execution state, create and terminate them, and switch the processor among them while preserving and restoring their contexts.
Scope
This topic covers the process abstraction and its lifecycle, the process control block, process creation and termination, threads and multithreading models, context switching, and inter-process communication. It excludes the policy of which ready task runs next (CPU scheduling) and the coordination of shared data (concurrency, treated under operating systems generally), focusing on the structures that represent and manage execution.
Core questions
- What state must the operating system keep for each process and thread?
- How are processes created, and how do threads differ from processes?
- What happens during a context switch, and what does it cost?
- How do processes communicate and coordinate across address spaces?
Key concepts
- process and process control block
- process states and lifecycle
- thread and multithreading
- user-level vs kernel-level threads
- context switch
- fork and exec
- inter-process communication
- process isolation
Key theories
- Process abstraction
- The operating system represents each running program as a process with its own address space and an execution context stored in a process control block, enabling isolation, scheduling, and controlled sharing of the processor.
Mechanisms
Each process is described by a process control block holding its registers, memory mappings, open files, and scheduling state. The system creates processes (for example via fork and exec), transitions them through states (new, ready, running, waiting, terminated), and switches among them by saving one context and restoring another. Threads share their process's address space, making switching cheaper but requiring synchronization; inter-process communication uses pipes, messages, or shared memory.
Clinical relevance
Process and thread management underlies multitasking on every modern system. Process isolation is a cornerstone of security and stability, threads enable responsive and parallel applications, and the cost of context switching and inter-process communication shapes the design of servers, runtimes, and concurrent software.
History
The process concept matured with multiprogramming and time-sharing systems in the 1960s, and UNIX established the fork/exec model and the process abstraction widely used today. Threads were added to exploit multiprocessors and improve responsiveness, with standards such as POSIX threads formalizing user-visible threading.
Debates
- User-level versus kernel-level threads
- User-level threads are cheap to manage but cannot be scheduled across cores independently and block the whole process on a blocking call, whereas kernel-level threads integrate with the scheduler at higher overhead; hybrid models attempt to combine the benefits.
Key figures
- Ken Thompson
- Dennis Ritchie
- Per Brinch Hansen
- Abraham Silberschatz
- Andrew S. Tanenbaum
Related topics
Seminal works
- silberschatz2018
- tanenbaum2014os
Frequently asked questions
- What information does the operating system keep for each process?
- It keeps a process control block recording the process's saved registers and program counter, memory mappings, scheduling state and priority, open files, and accounting and identity information — everything needed to suspend the process and later resume it exactly where it left off.
- Why are threads cheaper to switch between than processes?
- Threads within a process share the same address space and resources, so switching between them does not require changing memory mappings. Switching between processes additionally changes address spaces and may flush translation caches, making it more expensive.