The goal of the multi-programming system is to keep the CPU busy at all times. In a uni-processor system whenever the CPU becomes idle it is allocated to a new process. Which process will be allocated the CPU is decided by the short-term scheduler. CPU scheduling means to select the next process to be allocated to the CPU whenever the CPU becomes idle. Other common names of CPU scheduling are process scheduling or thread scheduling. The question is – When to call the short-term scheduler? In other words when is CPU scheduling in the operating system required? There are four circumstances:
Refer the process state diagram for details on these four transitions.
If you analyse points (1) and (4) closely, in both these situations the process voluntarily releases the CPU. In (1) the process needs an I/O output devices so it releases the CPU. While in (4) the process finishes and hence it releases the CPU. It is called non-preemptive scheduling. For example, Microsoft Windows 3.x used such scheduling policy.
Under (2) and (3) the system forcefully takes back the CPU from the currently running process to allocate it a new process. This is called preemptive scheduling. This may be due to the arrival of a higher priority process or due to time-slice expiry. For example, Microsoft Windows 95 and above follow this scheduling
A Dispatcher is that module of the operating system which gives control of the CPU to the process. Short term scheduler only decides which process to allocate to CPU. Whereas the dispatcher actually allocates the CPU to that process.
It involves three steps:
This is a common question that comes to our mind. An Operating System uses different algorithms for CPU scheduling. Every algorithm can perform better depending upon the situation. There are five points to decide which algorithm performs better than others.
An algorithm is effective if it has high CPU utilization and throughput, whereas low turnaround, waiting and response time.
Some of the most commonly use CPU scheduling algorithms are:
Note: Clicking on the “next” slide button will not display any animation. Click within the slide area for animations.
Previous Next Operations on Process CPU Scheduling Algorithms