OPERATING SYSTEM BASICS
This book covers the core topics in operating system including process management ,memory and file systems.
2. PROCESS MANAGEMENT
2.1. PROCESS LIFECYCLE
2.1.1 What is a Process?
A process is a program in execution. It is an active entity, unlike a program, which is a passive set of instructions stored on disk. A process requires resources such as CPU time, memory, files, and I/O devices to perform its task.
2.1.2 States of a Process
A process goes through several states during its execution. The major process states are:
-
New:
The process is being created. -
Ready:
The process is waiting in the queue to be assigned to the CPU. -
Running:
The process is currently being executed by the CPU. -
Waiting (Blocked):
The process is waiting for some event (like input from a device) to occur. -
Terminated:
The process has finished execution and is being removed from memory.
2.1.3 Process Control Block (PCB)
Each process has a Process Control Block (PCB) which stores important information such as:
-
Process ID
-
Process state
-
Program counter
-
CPU registers
-
Memory management information
-
I/O status
-
Accounting information
The OS uses the PCB to manage and track processes.