3,140 views
3 votes
3 votes
A and B are the only two processes in the system. Both are in the ready state. A arrives before B but the difference in arrival time is negligible. A is a CPU bound process while B is a I/O bound process. The pseudocode for A and B are as follows:
A:
repeat 2 times:
compute (takes 4 unit time)
write result to disk (takes 1 unit time)
exit (takes negligible time)
 
B:
repeat 2 times:
compute (takes 2 unit time)
write result to disk (takes 4 unit time)
exit (takes negligible time)
 
Assume that
(i) I/O can be done concurrently, i.e., the time taken to write to disk will not be prolonged if both processes write to disk at the same time;
(ii) the running time of A and B can be estimated accurately;
(iii) time quantum for preemptive scheduler is 1 unit time.
 
For each of the following algorithms:
(a) Round Robin;
(b) Shortest Remaining Time First;
 
Compute the turnaround time for A and B.
 

1 Answer

Best answer
2 votes
2 votes
For RR

$_{0}A_{1}B_{2}A_{3}B_{4}A_{6}//_{7}A_{8}B_{9}A_{10}B_{11}A_{13}$

at t=4 B goes for I/O which will be completed at t=8

at t=6 A goes for I/O which will be completed at t=7

at t=11 B goes for I/O which will be complete at t=15

at t=13 A goes form I/O which will be complete at t=14

TAT of A = Completion - Arrival = 14-0=14

TAT of B = Completion - Arrival = 15-0=15

SRTF

$_{0}A_{1}B_{3}A_{6}//_{7}A_{8}B_{10}A_{13}$

at t=10 B goes for I/O complete at 14

at t=13 A goes for I/O complete at 14

TAT A=B=14

or

$_{0}A_{1}B_{3}A_{6}//_{7}B_{9}A_{13}$

at t=9 B goes for I/O complete at 13

at t=13 A goes for I/O complete at 14

TAT A=14 B=13
selected by

Related questions

1.5k
views
1 answers
0 votes
anupamsworld asked Jun 6, 2022
1,498 views
Lets consider one situation where,OS is scheduling processes(P1,P2,P3...Pn) with Round Robin method and current running process is P1 and next scheduled process ... quantum=3unit for the given data below. AT=Arrival Time, BT=Burst Time
1.2k
views
2 answers
0 votes
Priyansh Singh asked Sep 16, 2018
1,197 views
Which of the Algorithm gives long average waiting time?(a) SJF (b) Round Robbin (c) FCFS (d) All of the above
1.2k
views
1 answers
0 votes
Priyansh Singh asked Sep 16, 2018
1,240 views
In Round Robbin if the Time Quantum is very large then it will behave as:(a) FCFS (b) SJF (c) Priority based (d) None