Question-1 Explain Shortest Remaining Time Next (SRTN) scheduling algorithms with illustration.
The process, whose remaining run time is shortest, is served first. This is a preemptive version of SJF scheduling.
Preemptive: When a new process arrives, its total time is compared to the current process remaining run time. If the new job needs less time to finish than the current process, the current process is suspended and the new job is started.
This strategy can also be implemented by using sorted FIFO queue. All processes in a queue are sorted in ascending order on their remaining run time. When CPU becomes free, a process from the first position in a queue is selected to run.
Consider the following set of four processes. Their arrival time and time required to complete the execution are given in following table. Consider all time values in milliseconds.
|Process||Arrival Time (T0)||Time required for completion (∆T)(CPU Burst Time)|
Initially only process P0 is present and it is allowed to run. But, when P1 comes, it has shortest remaining run time. So, P0 is preempted and P1 is allowed to run. Whenever new process comes or current process blocks, such type of decision is taken. This procedure is repeated till all processes complete their execution
|Process||Arrival Time(T0)||CPU Burst Time(∆T)||Finish Time(T1)||Turnaround Time(TAT=T1-T0)||Waiting Time (WT=TAT-∆T)|
Average Turnaround Time: (22+8+2+8) / 4 = 40/4 = 10 ms.
Average Waiting Time: (12+2+0+4)/4 = 18 / 4 = 4.5 ms.
- Less waiting time.
- Quite good response for short processes.
- Again it is difficult to estimate remaining time necessary to complete execution.
- Starvation is possible for long process. Long process may wait forever.
- Context switch overhead is there.
You may be interested in:
Operating System Short Descriptive Questions and Answers