0
0
Operating Systemsknowledge~6 mins

What is a process in Operating Systems - Concept Explained

Choose your learning style9 modes available
Introduction
Imagine you want to run a program on your computer, like a game or a calculator. The computer needs a way to manage and keep track of this running program so it can work properly and not get mixed up with other programs.
Explanation
Program vs Process
A program is a set of instructions saved on your computer, like a recipe. A process is what happens when the computer actually runs that program. It includes the program's instructions and the current activity, like the ingredients being used and the steps being followed.
A process is a running instance of a program with its own activity and state.
Process Components
A process has several parts: the program code, the current position in the code (called the program counter), memory for data, and resources like files or devices it uses. The operating system keeps track of all these parts to manage the process.
A process includes code, data, program counter, and resources managed by the operating system.
Process States
A process can be in different states such as running (actively using the CPU), waiting (paused until something happens), or terminated (finished). The operating system switches processes between these states to share the CPU fairly.
Processes change states to share the CPU and manage tasks efficiently.
Process Control Block (PCB)
The operating system uses a special record called the Process Control Block to store all information about a process. This includes its state, program counter, memory info, and more. The PCB helps the OS pause and resume processes smoothly.
The PCB stores all essential information about a process for the operating system.
Real World Analogy

Think of a process like a chef cooking a recipe in a kitchen. The recipe is the program, but the chef actively following the steps and using ingredients is the process. The kitchen tools and ingredients are the resources the chef uses.

Program vs Process → Recipe (program) vs Chef cooking the recipe (process)
Process Components → Chef's tools, ingredients, and current step in the recipe
Process States → Chef actively cooking (running), waiting for ingredients (waiting), finished cooking (terminated)
Process Control Block (PCB) → Chef's notebook tracking what step they are on and what ingredients are used
Diagram
Diagram
┌───────────────┐
│   Process     │
│───────────────│
│ Program Code  │
│ Program Counter │
│ Data Memory   │
│ Resources     │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Process State │
│ (Running,     │
│  Waiting,     │
│  Terminated)  │
└──────┬────────┘
       │
       ▼
┌───────────────┐
│ Process Ctrl  │
│ Block (PCB)   │
│ Stores Info   │
└───────────────┘
This diagram shows the parts of a process and how the operating system tracks its state and information using the Process Control Block.
Key Facts
ProcessA process is a running instance of a program with its own memory and resources.
Program CounterA pointer that keeps track of the next instruction a process will execute.
Process StatesThe different conditions a process can be in, such as running, waiting, or terminated.
Process Control Block (PCB)A data structure used by the operating system to store all information about a process.
Common Confusions
Thinking a program and a process are the same thing.
Thinking a program and a process are the same thing. A program is just the code stored on disk, while a process is the program in action with its own memory and state.
Believing a process runs continuously without interruption.
Believing a process runs continuously without interruption. Processes often switch between running and waiting states as the operating system manages CPU time among many processes.
Summary
A process is what happens when a program runs, including its code, data, and current activity.
The operating system manages processes by tracking their state and resources using the Process Control Block.
Processes switch between states like running and waiting to share the computer's CPU fairly.