What is a Process in Operating Systems?
Free AI-generated illustrated lesson. Hand-drawn and narrated, step by step.
What is a Process in Operating Systems?
Have you ever wondered what actually happens when you double-click an icon on your computer? To understand this, we need to look at the fundamental difference between a program and a process. Think of a program as a recipe in a cookbook. It is just a passive set of instructions sitting quietly on your hard drive, doing absolutely nothing on its own.
But when you run that program, the operating system springs into action. It reads those instructions, loads them into memory, and starts executing them. This active state is the process. It is the actual act of cooking the meal: you have a chef executing instructions, ingredients being mixed in bowls, and heat on the stove.
To map this directly to your computer, the recipe book is your executable file on disk, like a dot-exe file. The active cooking is the process living in your computer's RAM, actively using CPU cycles, holding values in memory, and interacting with the system.
When the operating system loads a program into memory, it carves out a structured space for it. At the very bottom lies the Text segment, which holds the raw machine code instructions. Directly above it sits the Data segment, storing your global variables and static data that persist for the lifetime of the program.
But programs are dynamic. To handle this, we have the Heap and the Stack. The Heap grows upward to manage memory you manually allocate during runtime, like objects or arrays. Meanwhile, the Stack grows downward from the very top of memory, automatically keeping track of active function calls and their local variables.
A process is dynamic, constantly changing states as it executes. Let's sketch the core loop where the real work happens. A process waiting for CPU time sits in the Ready state. When the operating system's scheduler chooses it, it is dispatched to the Running state, where the CPU actually executes its instructions. If its allocated time slice runs out, it gets interrupted and goes right back to the Ready queue.
But what if the process needs to perform a slow operation, like reading a file from disk or waiting for user input? The CPU cannot sit idle. Instead, the process transitions to the Waiting state. While here, it releases the CPU so other processes can run. Once that external event or I/O operation finally completes, the process is moved back to the Ready state, waiting to be scheduled once again.
To complete the picture, we look at the start and end of a process. A process is born in the New state when the program is first loaded. Once it is admitted into memory, it enters the Ready state. Finally, when the process finishes all its instructions or encounters a fatal error, it transitions to the Terminated state, where the operating system reclaims all its memory and resources.
To manage all these active processes running, pausing, and waiting, the operating system needs a dedicated bookkeeping record for each one. This is the Process Control Block, or PCB. Think of it as the OS's personal folder for a process, containing every single detail it needs to track.
Inside this block, the OS stores crucial metadata. First, a unique Process ID, or PID, alongside the current execution state. Next, it tracks the Program Counter, which points to the next instruction to execute, and the saved CPU registers. Finally, it records memory limits and open resources like files.
This metadata is critical during a context switch. When the CPU stops running Process A, it saves its current state directly into PCB A. It then loads the saved state from PCB B into the CPU registers, allowing Process B to resume seamlessly exactly where it left off.
In summary, a process is far more than just your static code. It is a living, breathing entity with its own memory anatomy, moving through states on a lifecycle, and completely managed by the OS through the Process Control Block. This coordination is what makes modern, multitasking computers possible.
Watch this free lesson — play it in My Magic Pencil.