An operating system uses Shortest Remaining Time first (SRT) process s...
Shortest remaining time, also known as shortest remaining time first (SRTF), is a scheduling method that is a pre-emptive version of shortest job next scheduling. In this scheduling algorithm, the process with the smallest amount of time remaining until completion is selected to execute. Since the currently executing process is the one with the shortest amount of time remaining by definition, and since that time should only reduce as execution progresses, processes will always run until they complete or a new process is added that requires a smaller amount of time. The Gantt chart of execution of processes:
At time 0, P1 is the only process, P1 runs for 15 time units. At time 15, P2 arrives, but P1 has the shortest remaining time. So P1 continues for 5 more time units. At time 20, P2 is the only process. So it runs for 10 time units. at time 30, P3 is the shortest remaining time process. So it runs for 10 time units. at time 40, P2 runs as it is the only process. P2 runs for 5 time units. At time 45, P3 arrives, but P2 has the shortest remaining time. So P2 continues for 10 more time units. P2 completes its execution at time 55.
As we know, turn around time is total time between submission of the process and its completion. Waiting time is the time The amount of time that is taken by a process in ready queue and waiting time is the difference between Turn around time and burst time. Total turnaround time for P2 = Completion time - Arrival time = 55 - 15 = 40 Total Waiting Time for P2= turn around time - Burst time = 40 – 25 = 15
View all questions of this test
An operating system uses Shortest Remaining Time first (SRT) process s...
Solution:
Shortest Remaining Time first (SRT) process scheduling algorithm selects the process with the smallest amount of time remaining to execute. In case of a tie, it selects the process with the smallest arrival time.
Given arrival time and execution time for the processes:
Process Execution time Arrival time
P1 20 0
P2 25 15
P3 10 30
P4 15 45
To calculate the waiting time for process P2, we need to first calculate the completion time and turnaround time for all processes.
Completion Time:
Process Execution time Arrival time Completion time
P1 20 0 20
P2 25 15 40
P3 10 30 40
P4 15 45 60
Turnaround Time:
Process Execution time Arrival time Completion time Turnaround time
P1 20 0 20 20 - 0 = 20
P2 25 15 40 40 - 15 = 25
P3 10 30 40 40 - 30 = 10
P4 15 45 60 60 - 45 = 15
Waiting Time:
Process Execution time Arrival time Completion time Turnaround time Waiting time
P1 20 0 20 20 - 0 = 20 20 - 20 = 0
P2 25 15 40 40 - 15 = 25 25 - 25 = 0
P3 10 30 40 40 - 30 = 10 10 - 10 = 0
P4 15 45 60 60 - 45 = 15 15 - 15 = 0
The waiting time for process P2 is 0 as it is the first process to arrive and the shortest remaining time at that point in time.
Therefore, the total waiting time for process P2 is 0. Hence, option (B) is the correct answer.
An operating system uses Shortest Remaining Time first (SRT) process s...
Man it's given straight the arrival time interval is 15 minutes for every process. Look at the left most side.