2078 12

BIT204 ยท 2078 ยท 5 marks

CPU Scheduling Analysis Consider the following set of processes, with the length of CPU burst time given in milliseconds. 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 = 3) a

CPU Scheduling Analysis

Consider the following set of processes, with the length of CPU burst time given in milliseconds. 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 = 3) and Priority Algorithm.

ProcessCPU BurstPriority
A83
B91 (Lowest)
C102
D64 (Highest)

[5]

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

CPU Scheduling: RR (q=3) and Priority

Given

ProcessCPU BurstPriority
A83
B91 (Lowest)
C102
D64 (Highest)

All arrive at time 0, in order A, B, C, D.

Formulas: $TAT = CT - AT$, $WT = TAT - Burst$.


Solution

1. Round Robin (Quantum = 3)

Ready queue starts: A, B, C, D. A process that still has remaining burst rejoins the tail of the queue after its slice.

Tracing execution (remaining bursts A=8, B=9, C=10, D=6):

SlotProcRangeRemaining after
1A0-3A=5
2B3-6B=6
3C6-9C=7
4D9-12D=3
5A12-15A=2
6B15-18B=3
7C18-21C=4
8D21-24D=0 โœ“
9A24-26A=0 โœ“
10B26-29B=0 โœ“
11C29-32C=1
12C32-33C=0 โœ“

Gantt:

| A | B | C | D | A | B | C | D | A | B | C | C |
0   3   6   9  12  15  18  21 24  26  29  32  33
ProcessBurstCTTATWT
A8262618
B9292920
C10333323
D6242418

$$\text{Avg TAT} = \frac{26+29+33+24}{4} = \frac{112}{4} = 28 \text{ ms}$$ $$\text{Avg WT} = \frac{18+20+23+18}{4} = \frac{79}{4} = 19.75 \text{ ms}$$

2. Priority Scheduling (Non-Preemptive)

Higher number = higher priority. Execution order: D (4) โ†’ A (3) โ†’ C (2) โ†’ B (1)

Gantt:

| D | A | C | B |
0   6  14  24  33
ProcessBurstCTTATWT
D6660
A814146
C10242414
B9333324

$$\text{Avg TAT} = \frac{6+14+24+33}{4} = \frac{77}{4} = 19.25 \text{ ms}$$ $$\text{Avg WT} = \frac{0+6+14+24}{4} = \frac{44}{4} = 11 \text{ ms}$$

Summary

AlgorithmAvg TATAvg WT
RR (q=3)28 ms19.75 ms
Priority19.25 ms11 ms

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