2,533 views
0 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 1 vote

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 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.

Position:
Show:

Related questions

1 1 vote
0 0 answers
756
756 views
iarnav asked Jan 12, 2022
756 views
Does non preemptive CPU scheduling needs hardware support.kindly explain.
1 1 vote
1 1 answer
297
297 views
GO Classes asked Feb 5
297 views
Consider three processes $P_1, P_2$, and $P_3$ arriving at time $t=0$ with burst times $10,20 ,$ and $30$ units, respectively. The system uses a Round Robin scheduling al...
1 1 vote
1 1 answer
271
271 views
GO Classes asked Jan 30
271 views
Consider a system with two priority queues for CPU scheduling: Queue $\mathbf{1}$ (High Priority) uses Round Robin (RR) with a time quantum of $\mathbf{2 ~ms}$, and Queue...
2 2 votes
2 2 answers
305
305 views
GO Classes asked Jan 28
305 views
Consider a system with three processes $P_1, P_2$, and $P_3$ that arrive at time $t=0$ in that order. The total CPU burst time for each process is $10$ units. However, ea...