Process in Operating Systems
Introduction
A process is an instance of a program in execution. It includes the program code,
its current activity, and its associated resources. Processes are fundamental to the
operation of an operating system, as they allow the system to manage and
execute multiple tasks efficiently.
Process States
A process goes through various states during its lifecycle. The common states are:
1. New:
o The process is being created.
2. Ready:
o The process is loaded into memory and waiting to be assigned to the
CPU.
3. Running:
o The process is currently being executed by the CPU.
4. Waiting:
o The process is waiting for an event or resource (e.g., I/O operation).
5. Terminated:
o The process has completed its execution and is removed from
memory.
Process Control Block (PCB)
The operating system uses the Process Control Block (PCB) to store information
about each process. Key components of a PCB include:
1. Process ID (PID): Unique identifier for the process.
2. Process State: Current state of the process (e.g., Ready, Running).
3. Program Counter: Address of the next instruction to be executed.
, 4. CPU Registers: Store the process's intermediate computation data.
5. Memory Management Information: Includes base and limit registers, page
tables, etc.
6. I/O Status Information: Tracks I/O devices allocated to the process.
7. Accounting Information: Records CPU usage, execution time, etc.
Process Lifecycle
1. Creation:
o A new process is created using system calls like fork() (in Unix/Linux).
2. Execution:
o The process is executed by the CPU, transitioning between Ready and
Running states.
3. Termination:
o The process finishes execution or is terminated by the OS due to an
error or user action.
Process Scheduling
The operating system schedules processes to optimize CPU usage and system
performance. There are three levels of scheduling:
1. Long-Term Scheduling:
o Determines which processes are admitted into the system for
processing.
2. Medium-Term Scheduling:
o Temporarily removes processes from memory to manage limited
resources.
3. Short-Term Scheduling:
o Decides which process gets CPU time next.
Introduction
A process is an instance of a program in execution. It includes the program code,
its current activity, and its associated resources. Processes are fundamental to the
operation of an operating system, as they allow the system to manage and
execute multiple tasks efficiently.
Process States
A process goes through various states during its lifecycle. The common states are:
1. New:
o The process is being created.
2. Ready:
o The process is loaded into memory and waiting to be assigned to the
CPU.
3. Running:
o The process is currently being executed by the CPU.
4. Waiting:
o The process is waiting for an event or resource (e.g., I/O operation).
5. Terminated:
o The process has completed its execution and is removed from
memory.
Process Control Block (PCB)
The operating system uses the Process Control Block (PCB) to store information
about each process. Key components of a PCB include:
1. Process ID (PID): Unique identifier for the process.
2. Process State: Current state of the process (e.g., Ready, Running).
3. Program Counter: Address of the next instruction to be executed.
, 4. CPU Registers: Store the process's intermediate computation data.
5. Memory Management Information: Includes base and limit registers, page
tables, etc.
6. I/O Status Information: Tracks I/O devices allocated to the process.
7. Accounting Information: Records CPU usage, execution time, etc.
Process Lifecycle
1. Creation:
o A new process is created using system calls like fork() (in Unix/Linux).
2. Execution:
o The process is executed by the CPU, transitioning between Ready and
Running states.
3. Termination:
o The process finishes execution or is terminated by the OS due to an
error or user action.
Process Scheduling
The operating system schedules processes to optimize CPU usage and system
performance. There are three levels of scheduling:
1. Long-Term Scheduling:
o Determines which processes are admitted into the system for
processing.
2. Medium-Term Scheduling:
o Temporarily removes processes from memory to manage limited
resources.
3. Short-Term Scheduling:
o Decides which process gets CPU time next.