Multilevel Feedback Queue Scheduler Example |
|
|
|
|
|
|
Parameters: |
• quantum = 1 |
• Processes in q0 get 2 times
at the CPU |
• Processes in q1 get 4 times
at the CPU |
• Processes in q2 get as many
times as they need at the CPU |
• J(U,T): job J with U units
remaining on process and T time units remaining in queue |
|
time |
run |
q0 |
q1 |
q2 |
0 |
|
A(10,2) |
|
|
1 |
A(9, 1) |
B(29,2) |
|
|
2 |
B(28,1) |
C(3,2) A(9,1) |
|
|
3 |
C(2,1) |
A(9,1) D(7,2) B(28,1) |
|
|
4 |
A(8,0) |
D(7,2) B(28,1) E(12,2) C(2,1) |
|
|
5 |
D(6,1) |
B(28,1) E(12,2) C(2,1) |
A(8,4) |
|
6 |
B(27,0) |
E(12,2) C(2,1) D(6,1) |
A(8,4) |
|
7 |
E(11,1) |
C(2,1) D(6,1) |
A(8, 4) B(27,4) |
|
8 |
C(1,0) |
D(6,1) E(11,1) |
A(8, 4) B(27,4) |
|
9 |
D(5,0) |
E(11,1) |
A(8, 4) B(27,4) C(1,4) |
|
10 |
E(10,0) |
|
A(8, 4) B(27,4) C(1,4) D(5,4) |
|
11 |
A(7,3) |
|
B(27,4) C(1,4) D(5,4) E(10,4) |
|
12 |
B(26,3) |
|
C(1,4) D(5,4) E(10,4) A(7,3) |
|
13 |
C(0, 3) |
|
D(5,4) E(10,4) A(7,3) B(26,3) |
|
|
|
|
*** C completes; T = 13-2 = 11; W = 11-3 = 8; R = 11/3 = 3.7 |
|
|
14 |
D(4,3) |
|
E(10,4) A(7,3) B(26,3) |
|
15 |
E(9,3) |
|
A(7,3) B(26,3) D(4,3) |
|
16 |
A(6,2) |
|
B(26,3) D(4,3) E(9,3) |
|
17 |
B(25,2) |
|
D(4,3) E(9,3) A(6,2) |
|
18 |
D(3,2) |
|
E(9,3) A(6,2) B(25,2) |
|
19 |
E(8,2) |
|
A(6,2) B(25,2) D(3,2) |
|
20 |
A(5,1) |
|
B(25,2) D(3,2) E(8,2) |
|
21 |
B(24,1) |
|
D(3,2) E(8,2) A(5,1) |
|
22 |
D(2,1) |
|
E(8,2) A(5,1) B(24,1) |
|
23 |
E(7,1) |
|
A(5,1) B(24,1) D(2,1) |
|
24 |
A(4,0) |
|
B(24,1) D(2,1), E(7,1) |
|
25 |
B(23,0) |
|
D(2,1) E(7,1) |
A(4) |
26 |
D(1,0) |
|
E(7,1) |
A(4 B(23) |
27 |
E(6,0) |
|
|
A(4) B(23) D(1) |
28 |
A(3) |
|
|
B(23) D(1) E(6) |
29 |
B(22) |
|
|
D(1) E(6) A(3) |
30 |
D(0) |
|
|
E(6) A(3) B(22) |
|
|
|
*** D completes: T = 30-3
= 27; W = 27-7 = 20; R = 27/7 = 3.9 |
31 |
E(5) |
|
|
A(3) B(22) |
32 |
A(2) |
|
|
B(22) E(5) |
33 |
B(21) |
|
|
E(5), A(2) |
34 |
E(4) |
|
|
A(2) B(21) |
35 |
A(1) |
|
|
B(21) E(4) |
36 |
B(20) |
|
|
E(4) A(1) |
37 |
E(3) |
|
|
A(1) B(20) |
38 |
A(0) |
|
|
B(20) E(3) |
|
|
|
*** A completes: T = 38-0
= 38; W = 38-10 = 28; R = 38/10 = 3.8 |
39 |
B(19) |
|
|
E(3) |
40 |
E(2) |
|
|
B(19) |
41 |
B(18) |
|
|
E(2) |
42 |
E(1) |
|
|
B(18) |
43 |
B(17) |
|
|
E(1) |
44 |
E(0) |
|
|
B(17) |
|
|
|
***
E completes: T = 44-4 = 40; W = 40-12 = 28; R = 40/12 = 3.3 |
45 |
B(16) |
|
|
|
46 |
B(15) |
|
|
|
47 |
B(14) |
|
|
|
48 |
B(13) |
|
|
|
49 |
B(12) |
|
|
|
50 |
B(11) |
|
|
|
51 |
B(10) |
|
|
|
52 |
B(9) |
|
|
|
53 |
B(8) |
|
|
|
54 |
B(7) |
|
|
|
55 |
B(6) |
|
|
|
56 |
B(5) |
|
|
|
57 |
B(4) |
|
|
|
58 |
B(3) |
|
|
|
59 |
B(2) |
|
|
|
60 |
B(1) |
|
|
|
61 |
B(0) |
|
|
|
|
|
|
|
*** B completes: T = 61-1
= 60; W = 60-29 = 31; R = 60/29 = 2.1 |
|
|
|
|
|
|
|
|