In a single-processor system, only one process can run at a time; any others must wait until the CPU is free and can be rescheduled. A process is executed until completion of some I/O request. Till then CPU then just sits idle. All this time is wasted and no work is done during the waiting time. This problem is solved with multiprogramming where in several processes are kept in memory at one time. When one process has to wait, the operating system takes the CPU away from that process and gives the CPU to another process. This is called Scheduling.
Whenever CPU is idle, the operating system must select one process from ready queue. The ready queue contains processes waiting for a chance to run on the CPU. This selection process is carried out by CPU scheduler. Let’s understand the concept of CPU scheduler.
Under non-preemptive scheduling, once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state. In any other case, scheduling is preemptive.
There are various scheduling algorithms which defines how ready queue should be implemented. Let’s discuss some of them:
Download as PDF
Read next: Process Synchronization ››
« Back to Course page
Punjab Civil Services 2021