Process Scheduling and Process Schedular

In previous chapter, we have discussed about process control block and process states. Now, we will proceed for process scheduler. In this topic, we will discuss about what is process scheduler, why we use it in operating system and different types of scheduler. Before going directly to scheduler, we will take little time for process scheduling because it will help us to understand process scheduler.

Process scheduling

The task of determining to schedule the processes of different states like ready, running, waiting etc. . In other words, we can say that assigning a process to CPU at a given time is called process scheduling.
Process scheduling performs important role in multiprogramming and multitasking operating system, where multiple processes execute simultaneously. So, to maintain all the processes, there are process scheduling queues.

Process scheduling queues

Job Queue: Job queue contains the set of all processes in the system
Ready Queue: Ready queue contains all the processes which are already placed in the main memory and ready for CPU allocation.
Device Queue: Device queue contains all the processes which are waiting for input/output.

Process scheduler

We know that operating system maintains queues for scheduling purpose. In such cases, OS has to select these processes from the queues so the selection procedure is carried out by scheduler.
Operating system maintains 3 types of scheduler.
1. Long Term scheduler
2. Short-term scheduler
3. Mid-term scheduler

(1) Long Term scheduler (Job scheduler): – This scheduler selects process from secondary memory pool and load them into MM (Main Memory).
This invoke very infrequently because when process execute it generally resides in main memory.
It controls the degree of multiprogramming. It selects process from batch queue. So more number of processes will be selected. According to that, more CPU degree will be achieved.

(2) Short-term scheduler (CPU Scheduler): – The job of this scheduler is to select process from ready queue and allocate CPU to them. This scheduler invokes very frequently. short-term scheduler increases the system performance.
Short-term scheduler also called dispatcher (make the decision of which process should be executed next).

(3) Mid-term scheduler: – This scheduler is a part of swapping. So, we can call process swapping scheduler. It does swapping from main memory to disk or vice versa. It works for suspending and resuming the process.
We will understand with a diagram. It will be helpful to clear the concept about queues and scheduler.

Tutorialwing Process Scheduling and Process Schedular

Process Schedular

Initially process is maintained in the Batch queue. Then, job of the Long-term scheduler is to fetch the process from batch queue to ready queue(Main Memory). Then, short-term scheduler selects process from the ready queue and assign them to CPU. When process completes their task, then, process will end or terminate. During that period, some processes may ask for I/O device so kept in I/O waiting queue. After that I/O compeletion, they are moved back to ready queue.
Now, consider process is executing and due to time slice process is suspended so it will be swap out from CPU and it will be kept in suspended & swapped out queue. Once swap out is done, it will be swap in ready queue. Thus scheduling is done by mid-term scheduler and this completes job done in time-sharing system.

That’s end of tutorial on Process schedular. Here, we have seen process scheduling, different types of process schedular – short term schedular, mid term schedular and long term schedular.

Leave a Reply