代写代考 COMP 2432 Operating Systems Tutorial 7 Solution

1. CPU Scheduling.
COMP 2432 Operating Systems Tutorial 7 Solution
11111 11112 22223 34445 55555
^ ^ ^ ^ 4 decisions Pid Burst Arr Prior Wait TR 190409

Copyright By PowCoder代写 加微信 powcoder

2 5 1 7 8 13
3 2 2 2 12 14
4 3 3 7 13 16
5 6 4 4 15 21
Avg. 9.6 14.6
11111 11113 34442 22225 55555
^ ^ ^ ^ 4 decisions Pid Burst Arr Prior Wait TR 190409
2 5 1 7 13 18 322279
4 3 3 7 8 11
5 6 4 4 15 21
Avg. 8.6 13.6
12334 44222 25555 55111 11111
^^^^ ^ ^ ^ 7 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 16 25
2 5 1 7 5 10 322202 433714
5 6 4 4 7 13
Avg. 5.8 10.8
Prior (Unix/Linux)
11111 11113 35555 55222 22444
^ ^ ^ ^ 4 decisions Pid Burst Arr Prior Wait TR 190409
2 5 1 7 16 21 322279
4 3 3 7 19 22
5 6 4 4 7 13
Avg. 9.8 14.8
Prior (Windows)
11111 11112 22224 44555 55533
^ ^ ^ ^ 4 decisions Pid Burst Arr Prior Wait TR 190409
2 5 1 7 8 13
3 2 2 2 21 23
4 3 3 7 11 14
5 6 4 4 13 19
Avg. 10.6 15.6
Prior Preempt (Unix/Linux)
11331 11111 15555 55222 22444
^^^^ ^ ^ ^ 7 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 2 11
2 5 1 7 16 21 322202
4 3 3 7 19 22
5 6 4 4 7 13
Avg. 8.8 13.8
Prior Preempt (Windows)
12222 24441 11111 11555 55533
^^^^ ^ ^ ^ ^ 8 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 8 17 251705
3 2 2 2 21 23 433736
5 6 4 4 13 19
Avg. 9.0 14.0
RR, with quantum 5
11111 22222 33444 55555 11115
^ ^ ^ ^ ^ ^ 6 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 15 24
3 2 2 2 8 10
4 3 3 7 9 12
5 6 4 4 15 21 Avg. 10.2 15.2
RR, with quantum 4
11112 22233 44411 11555 52155
^ ^ ^ ^ ^ ^^^ 8 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 14 23
2 5 1 7 16 21 322268
4 3 3 7 7 10
5 6 4 4 15 21
Avg. 11.6 16.6
RR, with quantum 3
11122 23311 14445 55221 11555
^ ^ ^ ^ ^ ^ ^ ^ 8 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 13 22
2 5 1 7 13 18 322246
4 3 3 7 8 11
5 6 4 4 15 21
Avg. 10.6 15.6
RR, with quantum 2
11221 13344 22551 14255 11551
^ ^ ^ ^ ^ ^ ^ ^^^ ^ ^ ^ 13 decisions Pid Burst Arr Prior Wait TR
1 9 0 4 16 25
2 5 1 7 12 17 322246
4 3 3 7 11 14
5 6 4 4 14 20
Avg. 11.4 16.4

2. More CPU Scheduling.
FCFS 1111111111111111122222222223333344445555555555555
4 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 0 17 8.5
7 16 26 21.0
2 25 30 27.5
7 29 33 31.0
4 32 45 38.5
20.4 30.2 25.3
SJF 1111111111111111144443333322222222225555555555555
4 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 0 17 8.5
7 25 35 30.0
2 19 24 21.5
7 14 18 16.0
4 32 45 38.5
18.0 27.8 22.9
SRT 1233333444422222222255555555555551111111111111111
^^^^^^ ^ ^
8 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 32 49 40.5
P2 10 1 7 9 19 14.0
P3 5 2 2 0 5 2.5
P4 4 3 7 4 8 6.0
P5 13 4 4 16 29 22.5
Avg. 12.2 22.0 17.1
Prior (Unix/Linux) 1111111111111111133333555555555555522222222224444
4 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 0 17 8.5
7 34 44 39.0
2 15 20 17.5
7 42 46 44.0
4 18 31 24.5
21.8 31.6 26.7
Prior (Windows) 1111111111111111122222222224444555555555555533333
4 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 0 17 8.5
7 16 26 21.0
2 42 47 44.5
7 24 28 26.0
4 27 40 33.5
21.8 31.6 26.7
Prior Preempt (Unix/Linux) 1133333111111111111111555555555555522222222224444
^^^^^ ^ ^ ^
8 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 5 22 13.5
P2 10 1 7 34 44 39.0
P3 5 2 2 0 5 2.5
P5 13 Avg.
7 42 46 44.0
4 18 31 24.5
19.8 29.6 24.7
Prior Preempt (Windows) 1222222222244441111111111111111555555555555533333
^^^^^^ ^ ^
8 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 14 31 22.5
P2 10 1 7 0 10 5.0
P3 5 2 2 42 47 44.5
P4 4 3 7 8 12 10.0
P5 13 4 4 27 40 33.5
Avg. 18.2 28.0 23.1
RR, with quantum 5 1111122222333334444555551111122222555551111155511
^^^^^^^^^^ 10 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 32 49 27.5
P2 10 1 7 23 33 9.0
P3 5 2 2 8 13 10.5
P5 13 Avg.
7 12 16 14.0
4 30 43 31.5
21.0 30.8 18.5
RR, with quantum 4 1111222233334444111155552222311115555221111555515
^ ^ ^ ^ ^ ^ ^^ ^ ^^ ^ ^^ 14 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 31 48 29.5
P2 10 1 7 28 38 24.0
P3 5 2 2 22 27 8.5
P4 4 3 7 9 13 11.0
P5 13 4 4 32 45 31.5
Avg. 24.4 34.2 20.9
RR, with quantum 3 1112223331114445552223311145552221115552111555115
^ ^ ^ ^ ^ ^ ^ ^ ^^ ^ ^ ^ ^^ ^ ^ ^ 18 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0 4 31 48 25.5
P2 10 1 7 29 39 19.0
P3 5 2 2 16 21 6.5
P5 13 Avg.
7 20 24 11.0
4 32 45 32.5
25.6 35.4 18.9
RR, with quantum 2 1122113344225511334422551132255112255115511551151
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^^ 25 decisions
Pid Burst Arr Prior Wait TR Resp
P1 17 0
P2 10 1
P3 5 2
P4 4 3 7 13 17 7.0
P5 13 4 4 31 44 31.5
4 32 49 31.5
7 24 34 20.0
2 20 25 14.5
Avg. 24.0 33.8 20.9

It can be observed that the number of context switching decisions is higher in preemptive scheduling when compared with non-preeptive scheduling. This should have been quite expected as each process may take more rounds to execute. The number of context switching decisions is higher in round-robin scheduling since processes are taking turn to use the CPU. Under robin-robin scheduling, the number of context switching decisions also goes up rapidly when the time quantum is reduced, especially when the burst time of processes becomes higher. This is again a natural expectation that it takes more CPU rounds for the processes to finish execution.
Optimal turnaround time is observed for SRT and SJF, as expected. The turnaround time would in general increase with smaller time quantum in round-robin as we probably would expect, but the trend actually would reverse when larger time quantum is used in this particular question. However, more cases should be studied before a conclusion could be drawn, e.g. by means of simulation of many varying cases. The waiting time is highly related to turnaround time and will show similar trend and behavior as turnaround time.
With respect to the response time, it can be seen that for most cases, the response time is about the average of waiting time and turnaround time, since it occurs right at the middle of the process execution. However, for round-robin, the response time is in general lower. This is also the rationale behind adopting round-robin in order to enhance response by giving the CPU to each process in turn.

3. Multi-level Scheduling. Fixed Priority Scheduling.
Summarizing
Q1: 11221 13344 22553 34455
Time Slicing Scheduling.
11122 23334 44555 22233 3445
Multi-level Feedback Queue: fixed priority
11221 13344 22553 34455
Queue 1 becomes empty at time 20
Processes on queue 2 can now begin
11122 23334 44555 22233 3445
Queue 2 becomes empty at time 44
Processes on queue 3 can now begin
Queue 2 becomes empty at time 49
Pid Burst Arr Prior Wait TR 1 7 0 – 16 23 212 1 – 33 45 313 2 – 34 47 4 9 3 – 31 40 5 8 4 – 32 40
Avg. 29.2 39.0
Multi-level Feedback Queue: time slicing
Pay attention to when each queue uses up its time slice
11221 13344 22
Queue 1 uses up its time slice at time 12
Processes on queue 2 can now begin, P1, P2 are there in that order
Queue 2 uses up its time slice at time 18
Queue 3 is empty at time 18
Queue 1 continues to use its next time slice
55 33445 5
Queue 1 becomes empty at time 26
Processes on queue 2 can now begin, P2, P3, P4, P5 are there in that order
Queue 2 uses up its time slice at time 32
Processes on queue 3 can now begin, P2 is there
Queue 3 becomes empty at time 34
Queue 2 continues to use its next time slice
Queue 2 uses up its time slice at time 40, but queue 1 and 3 are empty
Queue 2 continues to use its next time slice
Queue 3 continues to use its next time slice
Queue 3 becomes empty at time 49
Processes on queue 3 can now begin, P3 is there
Queue 2 becomes empty at time 46
Queue 3 uses up its time slice at time 48, but queue 1 and 2 are empty
Summarizing
Q1: 11221 13344 22
55 33445 5
2223 33 4 44555 33344 5
22 333
Pid Burst Arr Prior Wait TR 1 7 0 – 8 15 212 1 – 21 33 313 2 – 34 47 4 9 3 – 33 42 5 8 4 – 34 42
Avg. 26.0 35.8

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com