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

What is CPU / Process Scheduling

CPU scheduling is the action done by the process manager to manage the transition of processes in and out of the CPU 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; the rest must wait until the CPU gets free and can be rescheduled. Multiprogramming aims to have a process running at all times to maximize CPU utilization. The concept is straightforward: a process runs until it needs to wait, typically for an I/O request to complete.

In a simple operating system, the CPU then 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. An Input / Output burst follows that and continues after one more CPU burst, then one more Input / Output burst. Eventually, the final or last CPU burst finishes 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 short-term scheduler (CPU scheduler) performs the selection process. The scheduler picks up a process from the processes in memory that are ready to be executed and allocates 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 instance, after Input / Output).
  • When a process terminates (for example, when execution ends).

Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram