Operating System - Scheduling


Next >>

What is Scheduling?

Scheduling is organizing OS processes and CPU time. That is, picking one process from pool of processes and getting it executed on the CPU.

Processes are also called as Jobs.

How does scheduling work?

To make scheduling work, it is split into 3 activities.

  • Job scheduling is used to select the job to be executed
  • CPU scheduling is used to allocate CPU time for a process or job
  • Swapping is used to replace one process with another on the CPU
In order to move the jobs between the 3 activities, they are maintained in pools or queues

Scheduling Queues

There are 3 components used: Job Pool, Ready Queue, and Device Queue

  • Job-Pool

    When a process enters into a system, they are added into a job pool. This pool consists of all the processes in the system. Job scheduler also called as Long Term Scheduler, takes the job or process from Job-pool and puts in the ready queue

Fig 1. Process Scheduling Queues

  • Ready-Queue

    This queue consists of processes which are residing in the main memory and are ready and waiting to execute. CPU Scheduler or Short Term Scheduler takes the process from Ready queue and puts in the the CPU for execution. The process to be put in the CPU is decided by a Scheduling Algorithm.

  • Device Queue

    This queue contains the processes which are waiting for the completion of I/O request. Each device has its own device queue.

Moving between Pools and Queues

When the new process enters into the system and ready for execution, it is put into ready queue. The operating system allocates the CPU to that ready process. After getting the CPU, the process executes.


During execution, one of the events may occur that are:

  • Process issues an I/O request and then be placed in an I/O queue.
  • Process creates a new subprocess and must wait till the subprocess terminates.
  • Due to an interruption, the process could be removed forcefully from the CPU and be put back in the ready queue.


Next >>