Nepedia
Back to Discover
Advanced Reader
💻

Process (computing)

technology Maturity 9-11 Next article →

In the world of computing, a process is the active instance of a computer program being executed. While a program is a passive collection of instructions stored on a disk, a process is the living execution of those instructions once they are loaded into memory. A single program can result in multiple processes; for example, opening several instances of the same application creates distinct processes. Processes are the fundamental units of work in an operating system (OS). They require specific system resources, permissions, and data structures to initiate and coordinate their activities.

Concepts- Program vs. Process vs. Thread
Concepts- Program vs. Process vs. Thread

To function, a process must own several specific resources managed by the operating system. It holds an image of its executable machine code within a region of virtual memory. This memory includes process-specific input and output data, a call stack to track active subroutines, and a heap for intermediate computation data. The process also utilizes operating system descriptors, such as file descriptors in Unix or handles in Windows, to manage data sources and sinks. Furthermore, the process maintains a processor state, or context, which includes the contents of registers and physical memory addressing. The OS tracks this vital information using data structures called process control blocks.

Process states
Process states

Modern operating systems manage multiple processes through a method called multitasking. A single CPU core can only execute one process at a time. However, multitasking allows the processor to switch between tasks without waiting for each one to finish. This capability is known as preemption. Preemption is vital for interactive tasks, such as moving a mouse or pressing a key, which are given higher priority than CPU-bound tasks. Applications like music or video playback also receive real-time priority to ensure smooth performance. Through rapid context switches, the system creates concurrency, making it appear as though many processes are running simultaneously.

Htop 3.0.1 screenshot
Htop 3.0.1 screenshot

An operating system scheduler decides exactly when these switches occur. A switch might happen when a task waits for input/output operations or when a task voluntarily yields the CPU. It can also occur due to hardware interrupts or when a scheduler, such as the Linux kernel's Completely Fair Scheduler, decides a process has used its fair share of time. In time-sharing systems, this interleaving of processes and threads allows for efficient resource use. This system ensures that the CPU remains busy rather than sitting idle while a program waits for a slow device, like a printer.

KSysGuard 5.22.0 process table screenshot
KSysGuard 5.22.0 process table screenshot

Every process moves through a specific lifecycle of states. First, a process is "created" when it is loaded from secondary storage, like a hard disk, into main memory. The scheduler then assigns it a "waiting" state while it awaits a context switch. When the scheduler loads the process into the processor, its state changes to "running." If the process must wait for a resource, such as a file to open, it enters a "blocked" state. Once the resource is available, it returns to the waiting state. Finally, once execution is complete or the OS terminates it, the process enters a "terminated" state before being removed from memory.

Because processes often need to work together, operating systems provide mechanisms for inter-process communication (IPC). Processes can communicate by sharing parts of their address spaces or using specific protocols. For instance, in a shell pipeline, the output of one process passes directly to the next. In more complex distributed computing, processes on different machines might use the Message Passing Interface (MPI) to synchronize. This communication is strictly mediated and controlled by the OS to ensure security and reliability. This prevents independent processes from interfering with one another, which helps avoid system failures like deadlock or thrashing.

The history of process management reflects the evolution of computer speed and efficiency. In the early 1960s, software evolved from simple monitor control to executive control. As computers became faster, multiprogramming became necessary to utilize hardware that was neither cheap nor fully utilized. Initially, multiprogramming involved serial concurrency on uniprocessor architectures. As systems moved toward multiple processors, programs could run in true parallel. The transition from simple multiprogramming to modern multitasking, multiprocessing, and multithreading was driven by the invention of re-entrant code, time-sharing, and computer networks.

692 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (4)
File:Concepts- Program vs. Process vs. Thread.jpg
Concepts- Program vs. Process vs. Thread.jpg
File:Htop_3.0.1_screenshot.png
Htop_3.0.1_screenshot.png
File:KSysGuard 5.22.0 process table screenshot.png
KSysGuard 5.22.0 process table screenshot.png
File:Process states.svg
Process states.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.