OPERATING SYSTEM NOTES
Completion requirements
2. PROCESS MANAGEMENT
2.2. Process States Life Cycle
Process States
When a process executes, it goes through various states. While names and number of states might slightly vary in different operating systems, here are the five common states:
No. | State | What It Means |
---|---|---|
1️⃣ | Start | Process is created for the first time. |
2️⃣ | Ready | Process is waiting for CPU to be assigned by the OS scheduler. |
3️⃣ | Running | Process is currently using the CPU and being executed. |
4️⃣ | Waiting | Process is waiting for some resource (e.g., user input, file, device). |
5️⃣ | Terminated | Process has finished execution or is killed; it will be removed from memory. |
State Transitions (Example):
-
Start → Ready → Running → Waiting/Ready → Running → Terminated
Process Control Block (PCB)
A PCB is like a file or record that the Operating System keeps to track every process. It stores everything the OS needs to manage and switch between processes.
No. | Field | What It Stores |
---|---|---|
1️⃣ | Process State | Current state: Ready, Running, Waiting, etc. |
2️⃣ | Process Privileges | What the process is allowed to access (e.g., memory, devices). |
3️⃣ | Process ID (PID) | A unique number to identify each process. |
4️⃣ | Pointer | Link to the parent or related processes. |
5️⃣ | Program Counter (PC) | The address of the next instruction to be executed. |
6️⃣ | CPU Registers | Data stored in CPU registers (saved during context switching). |
7️⃣ | CPU Scheduling Info | Priority, queue pointers, scheduling info. |
8️⃣ | Memory Info | Details like page table, memory limits, segment table. |
9️⃣ | Accounting Info | CPU time used, process start time, user ID, etc. |
🔟 | I/O Status Info | List of I/O devices used, files opened, etc. |
Note:
-
The structure of the PCB depends on the operating system.
-
It’s essential for multitasking because it helps the OS switch between processes.
Process State Diagram
