Major Activities of an Operating System with Regard to Process Management

Process management is one of the most critical functions of an operating system. A process is an active program under execution, containing program code, program counter, process stack, registers, and other execution context. The OS performs several key activities to manage processes efficiently, including process scheduling and context switching.

Process Scheduling

The operating system uses multiple scheduling queues to organize and manage processes at different stages of execution. When processes enter the system, they are placed in the job queue. Processes ready to execute in main memory are kept in the ready queue, while those waiting for I/O operations are maintained in I/O device queues.

Process Scheduling Queues Job Queue Ready Queue CPU I/O Queue Terminate Admit Dispatch Exit I/O Request I/O Complete

Types of Schedulers

Long-Term Scheduler

The job scheduler or long-term scheduler selects processes from the storage pool and loads them into memory for execution. It must maintain a careful balance between I/O-bound and CPU-bound processes to achieve optimum system throughput. Too many CPU-bound processes leave I/O devices idle, while too many I/O-bound processes leave the processor underutilized.

Short-Term Scheduler

The short-term scheduler (CPU scheduler) selects processes from the ready queue and allocates CPU time to them. It executes much more frequently than the long-term scheduler since processes may execute for only a few milliseconds before requiring I/O or being preempted.

Medium-Term Scheduler

The medium-term scheduler implements swapping by temporarily removing processes from main memory to secondary storage. It can later swap the process back into memory from where it left off. This mechanism helps reduce the degree of multiprogramming and improves the mix of I/O-bound and CPU-bound processes in memory.

Medium-Term Scheduling (Swapping) Ready Queue CPU Swap Out Swapped-Out Queue Swap In Main Memory (Limited Space) Degree of Multiprogramming

Context Switching

Context switching is the mechanism of removing a process from the CPU and scheduling another process. This involves saving the state of the current process and loading the state of the new process. The process context includes register values, program counter, process state, and memory management information, all stored in the Process Control Block (PCB).

The dispatcher is responsible for performing context switches. It saves the context of the outgoing process in its PCB and loads the context of the incoming process selected by the short-term scheduler. While essential for multitasking, context switching introduces overhead as no useful work is performed during the switch.

Scheduler Type Frequency Primary Function Time Scale
Long-Term Low Admit processes to memory Minutes
Short-Term High Allocate CPU to ready processes Milliseconds
Medium-Term Medium Swap processes in/out of memory Seconds

Conclusion

Process management involves sophisticated scheduling mechanisms and context switching to ensure efficient CPU utilization and system responsiveness. The three-level scheduling hierarchy works together to balance system resources, while context switching enables multitasking by allowing processes to share the CPU seamlessly.

Updated on: 2026-03-17T09:01:38+05:30

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements