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