homework-3 Version 0 |
|
👤 Author: by 781863542qqcom 2019-09-25 10:33:21 |
Method1:FCFS(first-come, first-served)
process duration
p1 18
p2 4
p3 20
p1 waits 0s. p2 waits 18s. p3 waits 22s.
the average waiting time is (0 + 18 + 22) / 3 = 13.333333...
Method2:SJF(shortest-job-first)
process duration
p1 18
p2 4
p3 20
process execution sequence: p2, p1, p3
p2 waits 0s. p1 waits 4s. p3 waits 22s
the average waiting time is (0 + 4 + 22) / 3 = 8.6666...
Method3: priority scheduling algorithm
process duration priority
p1 18 3
p2 4 2
p3 20 1
process execution sequence: p3, p2, p1
p3 waits 0s, p2 waits 20s, p1 waits 24s.
the average waiting time is(0 + 20 + 24) / 3 = 14.6666666
Method4: RR(round-robin)
process duration
p1 16
p2 4
p3 20
assume that the time slice is 4s
process execution sequence: p1, p2(end), p3, p1, p3, p1, p3, p1(end), p3, p3(end)
p2 waits 4s. p1 waits 60s, p3 waits 80s.
the average waiting time is(4 + 60 + 80) / 3 = 48(Isn't it too long?)