The act of determining which process is in the ready state, and should be moved to the running state is known as Process Scheduling.
Process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy.
The prime aim of the process scheduling system is to keep the CPU busy all the time and to deliver minimum response time for all programs. For achieving this, the scheduler must apply appropriate rules for swapping processes IN and OUT of CPU.
Types of Process Scheduling: There are two types of scheduling:-
- Pre-emptive Scheduling:- In Pre-emptive Scheduling, all the processes are executed by using some amount of time of CPU. The time of CPU is divided into the number of minutes and time of CPU divided into the process by using some rules. If the time is divided into equal interval than it is called Quantum Time.
- Non Pre-emptive Scheduling:- In Non Pre-emptive Scheduling, no time scheduling is used and also, CPU will be automatically free after executing the whole process, means that when the execution of the process will completed, then the CPU will be Free. When two or more process are given then this will first Complete the process and after completing the first process, this will automatically start the second process.
Process Scheduling Queue
The OS maintains all PCBs in Process Scheduling Queues. The OS maintains a separate queue for each of the process states and PCBs of all processes in the same execution state are placed in the same queue. When the state of a process is changed, its PCB is unlinked from its current queue and moved to its new state queue.
The Operating System maintains the following important process scheduling queues −
- Job queue − This queue keeps all the processes in the system.
- Ready queue − This queue keeps a set of all processes residing in main memory, is ready and is waiting to execute. A new process is always put in this queue.
- Device queues − The processes which are blocked due to unavailability of an I/O device constitute this queue.