edited by
3,519 views
3 votes
3 votes

Consider the following table of arrival time and burst time for three processes P1P2 and P3.

Suppose that a fourth process P4 enters the system at time 7.6 sec and needs 6 sec of CPU time. Also
assume that P2, P3 are interactive and P1P4 are batch.
A multilevel queue is in effect. The first queue is for interactive processes only whose processes get 1 sec
each time they are in CPU. The second queue is for batch processes, which get upto 4 units each time
they are in CPU. Processes are dispatched as follows : two processes (if available) are dispatched from
the interactive queue followed by one process (if available) from the batch queue etc. What will be the
average turnaround time ?

edited by

3 Answers

Best answer
8 votes
8 votes
P1 - P1 - P1 - P1 - P2 - P3 - P1 - P1 - P1 - P1 - P2 - P2 - P4 - P4 - P4 - P4 - P2 - P4 - P4

So, totally 19 time units.

At T0, only one process is there- so scheduler picks it. Since its a batch process 4 time units given.

At T4, P2 and P3 are available. So, P2 scheduled first as it arrived earlier followed by P3 at T5.

At T6, P1 is again scheduled for 4 time units.

At T10, P2 is scheduled and it is again scheduled at T11 as no other interactive process is there.

At T12, P4 is scheduled for 4 time units. Then P2 is again scheduled for its remianing 1 time unit.

At T17, P4 is scheduled for its remaining 2 time units.

So, Turnaround times are

P1: 10 - 0 = 10
P2: 17 - 0.4 = 16.6
P3: 6 - 1 = 5
P4: 19 - 7.6 = 11.4

So, average Turn around time $=\frac{10+16.6+5+11.4}{4} = \frac{43}{4} = 10.75$
selected by
1 votes
1 votes

                                  Average TAT = 11 seconds.

0 votes
0 votes

Here multilevel queue is in effect. and in second queue each of them comes gets CPU for 1 sec

Now, P1 and P4 are Batch scheduling.

So, they will use FCFS scheduling. But as in first queue each process takes queue for 4 sec. , so here too round robin takes place

Here P1 comes to queue first., as it enters in queue at 0 sec.

So, P1 will executed for 1st 4 sec.

then P2 and P3 comes and go with RR scheduling

then P1 executes next 4 sec, at last P4 going to execute.

as it is given " two processes (if available) are dispatched from the interactive queue followed by one process (if available) from the batch queue ".

So, after execution of P2 and P3 fully , then P1 going to execute again.

Gnatt chart will be like

0..........P1..........4.....P2....5.....P3.....6.....P2.....9...........P4.............13........P1........17......P4.......19

Now, TAT for P1=17sec.

TAT for P2=8.6sec.

TAT for P3=5 sec

TAT for P4=11.4 sec.

So, Avg. TAT will be (17+8.6+5+11.4)/4=10.5sec.

edited by

Related questions