edited by
2,219 views
1 votes
1 votes

Consider four process all are arriving at time zero, with total execution time of 20, 10, 10 and 20 unit
respectively. Each process spends the first 20% of execution time doing CPU, the next 60% of doing I/O
computation and the last 20% of time doing CPU computation again. The operating system uses longest
time first scheduling algorithm and schedules a new process either when running process get blocked I/O
or when the running process finishes its CPU burst.
Assume that I/O operations can be overlapped as much as possible. The average TAT of the system
given by ______ unit.
[Note: When same burst occurs for multiple process high priority given to lowest process id] (upto one
decimal place)

edited by

1 Answer

0 votes
0 votes

if a process is excuting cpu bound no other process execute the cpu bound.

if a process is excuting cpu bound other process executing i/o bound .

if one process completes cpu ,i/o and cpu bound then only it completes its total excution

  AT CPU I/O CPU CT TAT=(CT-AT)
P1 0 4 12 4 20 20
P2 0 2 6 2 22 22
P3 0 2 6 2 24 24
P4 0 4 12 4 26 26

calculate for remaining processes also.

Each process spends 20% during cpu bound.so cpu execution time=totalexecutiontime*20%

                                                                                             =20*20%=4

Each process spends 60% during cpu bound.so cpu execution time=totalexecutiontime*60%

                                                                                                    =20*60%=12

Each process spends 20% during cpu bound.so cpu execution time=totalexecutiontime*20%

                                                                                             =20*20%=4

so we get table using that table apply LJSF algorithm.GANTT CHART

p1 p4 p2 p3 //// p1 p2 p3 p4

o           4             8          10          12            16           20          22         24         26

SO AVERAGE TAT=20+22+24+26/4=23.

% OF CPU IDLE IS 4/26=15.38%.   //  "///" CPU IS IDLE.ONLY I/O OPERATIONS ARE EXECUTING

Related questions