CPU scheduling is the foundation or starting concept of multi-programmed operating systems (OSs). By toggling the CPU with different processes, the operating system can make the computer and its processing power more productive. In this tutorial, you will learn about the introductory basic of CPU-scheduling concepts.

What is CPU / Process Scheduling

The CPU scheduling is the action done by the process manager to handle the elimination of the running process within the CPU and the inclusion of another process by certain specific strategies.

Reason Behind the Use of CPU Scheduling

In a single-processor system, only one job can be processed at a time; rest of the job must wait until the CPU gets free and can be rescheduled. The aim of multiprogramming is to have some process to run at all times, for maximizing CPU utilization. The idea is simple. In this case, the process gets executed until it must wait, normally for the completion of some I/O request.

In a simple operating system, the CPU then just stands idle. All this waiting time is wasted; no fruitful work can be performed. With multiprogramming, you can use this time to process other jobs productively.

CPU-I/O Burst Cycle

The success of CPU scheduling varies on an experiential property of processes: Process execution holds a cycle of CPU execution and Input / Output wait. Processes get to swap between these two states. Process execution begins with a burst of CPU. That is followed by an Input / Output burst and goes after by one more CPU burst, then one more Input / Output burst, and it continues. Eventually, the final or last CPU burst finish with a system request for terminating execution.

CPU Schedulers

Whenever the CPU gets idle, the operating system (OS) has to select one of the processes in the ready queue for execution. The selection process is performed by the short-term scheduler (also known as CPU scheduler). The scheduler picks up a process from the processes in memory which are ready to be executed and allocate the CPU with that process.

Preemptive Scheduling

CPU scheduling choices may take place under the following four conditions:

  • When a process toggles from the running state to its waiting state
  • When a process toggles from the running state to its ready state (an example can be when an interrupt occurs)
  • When a process toggles from the waiting state to its ready state (for example, at the completion of Input / Output)
  • When a process terminates (example when execution ends)

Found This Useful? Share This Page!