1,131 views
0 votes
0 votes

Consider the following table showing the arrival time burst time before io time and followed by CPU time again

Process AT execution time  
    Cpu io cpu
0 4 3 2
2 1 1 4 1
3 4 3 1 1

Using srtf scheduling policy what is the average completion time??

2 Answers

Best answer
1 votes
1 votes

Here we need to keep two things in mind :

a) As we know in "I/O wait state" , there are more than processes possible at the same time. Whereas in "running" state , we can have only one process . Hence if more than 1 processes are there for performing I/O and hence consume I/O time , they can do so simultaneously which means if more than one process have I/O time to execute , then both can do so simultaneously . Whereas for CPU time , we need CPU scheduling.

b) If two processes have same CPU burst time as well as same arrival time  , then the process having less process-id is given priority.

Thus keeping these points in mind , let us find the average completion time :

selected by
0 votes
0 votes

Here, criteria for scheduling in Gannt chart is total CPU Brust time if Process in ready state, not in I/O queue (I/o brust).

During design, Gantt chart keeps regulary update the remaining CPU burst time of process for criteria.

Process Completion time Turn Around Time(TAT) Waiting time(TAT- CPU brust time)
P1 7 7 1
P2 8 7 5
P3 13 9 5


P1 P2 P1 P1 P1 P1 P2 P3 ---- P3      

0        1           2         4           5       6           7         8         11         12       13

                  Gantt Chart

Average waiting time = (1+5+5)/3 = 11/3

Between 11 to 12 unit time the CPU is in idle state.

Note: If you are able to make a correct Gantt chart, you solve any complex question easily.

Related questions

1 votes
1 votes
1 answer
1
iarnav asked Jan 12, 2022
405 views
Does non preemptive CPU scheduling needs hardware support.kindly explain.
0 votes
0 votes
1 answer
3
0 votes
0 votes
1 answer
4
iarnav asked Jul 17, 2018
841 views
Let's say we have four processes as (P1, P2, P3, P4) and have Arrival time as (0,1,2,3) respectively, but all of them has same CPU Burst time as (10ms) then does SRTF wil...