0 8

BIT204 ยท 0 ยท 5 marks

CPU Scheduling Analysis Consider the following set of processes, with the length of CPU burst time given in milliseconds. | Processes | CPU Burst | Priority | |-----------|-----------|----------| | A | 8 | 3 | | B | 13 | 1 (Lowest) | | C | 19 | 2 | | D | 3 | 4 (Highest) | The processes are assumed t

CPU Scheduling Analysis

Consider the following set of processes, with the length of CPU burst time given in milliseconds.

ProcessesCPU BurstPriority
A83
B131 (Lowest)
C192
D34 (Highest)

The processes are assumed to have arrived in the order A, B, C and D all at time 0. What is the turnaround time and waiting time for the scheduling algorithms, RR (quantum = 5) and Priority Algorithm?

[5]

Operating SystemsChapter 4: CPU SchedulingRound Robin schedulingNumerical: CPU scheduling algorithms

CPU Scheduling: RR (quantum = 5) and Priority

Given

ProcessCPU Burst (ms)Priority
A83
B131 (Lowest)
C192
D34 (Highest)

Arrival: all at time 0, order A, B, C, D. Total burst = $8+13+19+3 = 43$ ms.


Solution

Part 1: Round Robin (q = 5)

Ready queue starts A, B, C, D. Track remaining bursts.

SlotProcStartEndRemaining after
1A053
2B5108
3C101514
4D15180 (needs 3)
5A18210 (needs 3)
6B21263
7C26319
8B31340 (needs 3)
9C34394
10C39430

Gantt:

| A | B | C | D | A | B | C | B | C | C |
0   5  10  15  18  21  26  31  34  39  43

Completion times: A = 21, B = 34, C = 43, D = 18

Turnaround (TAT = Completion โˆ’ 0):

ProcTATWT = TAT โˆ’ Burst
A2121 โˆ’ 8 = 13
B3434 โˆ’ 13 = 21
C4343 โˆ’ 19 = 24
D1818 โˆ’ 3 = 15

$$\text{Avg TAT} = \frac{21+34+43+18}{4} = \frac{116}{4} = 29 \text{ ms}$$

$$\text{Avg WT} = \frac{13+21+24+15}{4} = \frac{73}{4} = 18.25 \text{ ms}$$


Part 2: Priority Scheduling (Non-preemptive)

Highest priority number runs first: D(4) โ†’ A(3) โ†’ C(2) โ†’ B(1)

Gantt:

| D | A | C | B |
0   3   11  30  43
ProcCompletionTATWT = TAT โˆ’ Burst
D330
A11113
C303011
B434330

$$\text{Avg TAT} = \frac{3+11+30+43}{4} = \frac{87}{4} = 21.75 \text{ ms}$$

$$\text{Avg WT} = \frac{0+3+11+30}{4} = \frac{44}{4} = 11 \text{ ms}$$


Summary

AlgorithmAvg TATAvg WT
RR (q = 5)29 ms18.25 ms
Priority21.75 ms11 ms

All values confirmed correct.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.