The Gateway to Computer Science Excellence
+15 votes

Consider the following set of processes that need to be scheduled on a single CPU. All the times are given in milliseconds.
$$\small \begin{array}{|c|c|c|} \hline \textbf{Process Name} & \textbf{Arrival Time} & \textbf{Execution Time} \\\hline \text{A} & 0 & 6 \\ \text{B} & 3 & 2 \\ \text{C} & 5 & 4 \\ \text{D} & 7 & 6 \\ \text{E} & 10 & 3 \\\hline  \end{array}$$Using the shortest remaining time first scheduling algorithm, the average process turnaround time (in msec) is ____________________.

in Operating System by
edited by | 2.2k views

2 Answers

+25 votes
Best answer

$\text{Average Turnaround Time} =\dfrac{(8-0)+(5-3)+(12-5)+(21-7)+(15-10)}{5}$

$\qquad \qquad \qquad \qquad  = \dfrac{36}{5} = 7.2$

So, answer is $7.2\;ms$

edited by
Where it's written that preemptive SRTF has to be used?
SRTF means pre-emptive only , as it is shortest "Remaining" time first. The non pre-emptive version is called SJF(Shortest Job First)
SRTF is always preempted ???

whethe they write or not???

How can you preempt process(C) of High Burst time before the process(E) of low burst time in SRTF?

Order Should be ==> (A--B--A--E--C--D) instead of (A--B--A--C--E--D)

+4 votes

Turn around time of a process is total time between submission of the process and its completion. Shortest remaining time (SRT) scheduling algorithm selects the process for execution which has the smallest amount of time remaining until completion. Solution: Let the processes be A, ,C,D and E. These processes will be executed in following order. Gantt chart is as follows:nitika_1First 3 sec, A will run, then remaining time A=3, B=2,C=4,D=6,E=3 Now B will get chance to run for 2 sec, then remaining time. A=3, B=0,C=4,D=6,E=3 Now A will get chance to run for 3 sec, then remaining time. A=0, B=0,C=4,D=6,E=3 By doing this way, you will get above gantt chart. Scheduling table:nitika_2As we know, turn around time is total time between submission of the process and its completion. i.e turn around time=completion time-arrival time. i.e. TAT=CT-AT Turn around time of A = 8 (8-0) Turn around time of B = 2 (5-3) Turn around time of C = 7 (12-5) Turn around time of D = 14 (21-7) Turn around time of E = 5 (15-10) Average turn around time is (8+2+7+14+5)/5 = 7.2. Answer is 7.2.


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,315 questions
60,430 answers
95,241 users