# GATE - 2016 | OS | Consider an arbitrary set of CPU-bound processes with unequal CPU burst ## Question:

Consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system. Which one of the following process scheduling algorithms would minimize the average waiting time in the ready queue?

 A Shortest remaining time ﬁrst B Round-robin with time quantum less than the shortest CPU burst C Uniform random D Highest priority ﬁrst with priority proportional to CPU burst length

## Solution:

### Option (A) is Correct

From the above question, we can get the following information.
We can consider an arbitrary set of CPU-bound processes with unequal CPU burst lengths submitted at the same time to a computer system.
We have to choose the appropriate process scheduling algorithms, which would minimize the average waiting time in the ready queue.
Waiting time is the time for which the process is ready to run but not executed by the CPU scheduler.
In all CPU Scheduling algorithms, the shortest job first is optimal.
It gives minimum turnaround time, minimum average waiting time, and high throughput, and the most important thing is that the shortest remaining time first is the preemptive version of the shortest job first.
This scheduling algorithm may lead to starvation because of the short processes are added to the CPU scheduler continuously then the currently running process will never be able to execute as they will get pre-empted but here all the processes arrived at the same time so there will be no issue such as starvation.
SRTF would be the same as SJF.
So, A is the answer. Shortest remaining time first.

--------------------------------------------------------

Turnaround time is the total time taken by the process between starting and the completion and waiting time is the time for which process is ready to run but not executed by the CPU scheduler. As we know, in all CPU Scheduling algorithms, the shortest job first is optimal i.ie. it gives minimum turn round time, minimum average waiting time and high throughput and the most important thing is that the shortest remaining time first is the pre-emptive version of the shortest job first. shortest remaining time first scheduling algorithm may lead to starvation because If the short processes are added to the CPU scheduler continuously then the currently running process will never be able to execute as they will get pre-empted but here all the processes arrive at the same time so there will be no issue such as starvation.

------------------------------------------------------------

As all the processes are arriving at the using shortest remaining time first algorithm, we can decrease the number of processes in the queue as soon as possible thus total waiting time will decrease and so will average.

--------------------------------------------------------------

SRTF is the preemptive SJF that generates less average waiting time in which jobs are scheduled according to the shortest remaining time.

Thank You