Numericals — Scheduling · Allocation · Paging · Page Replacement
Practice set

Numericals — Every Worked Calculation

Only numericals on this page. Every question is reproduced with the marks and paper that were actually printed on it, then solved step by step and independently re-solved by a separate calculator. Where the printed source book disagrees with the re-solved result, the re-solved value is the answer here and the printed figure is quoted inside a Verification note. Theory for these mechanisms lives on Unit I and Memory Management.

How to use this page

SymbolFormula used on every answer here
CTCompletion Time — the instant the process finishes its last unit of CPU burst
TATTAT = CT − AT (Turnaround Time)
WTWT = TAT − BT (Waiting Time)
AveragesAvg TAT = (Σ TAT) ÷ n · Avg WT = (Σ WT) ÷ n for n processes
Hit ratiohits ÷ total references · Fault ratio = faults ÷ total references = 1 − hit ratio
Tie-break convention — stated once, used everywhere below On a tie in burst or remaining time, the process that arrived earlier runs; if still tied, the lower process number runs. Non-preemptive SJF picks the shortest burst among the processes that have already arrived. This is the convention that reproduces the source book's own correct answers (for example the Jan-2024 Round Robin result), so the disagreements flagged below are source errors and not a clash of conventions.

1. CPU Scheduling

Gantt + CT / TAT / WT

Six scheduling numericals, one from each 2023–2025 paper. Every chart below obeys the single tie-break convention stated once at the top of this page — on a tie in burst or remaining time the earlier arrival runs, and if still tied the lower process number runs — and every worked answer shows TAT = CT − AT, WT = TAT − BT and the two averages.

Unit I · CPU Scheduling numerical

Consider the following process: (P1 AT 0 BT 6 Pri 3; P2 AT 1 BT 4 Pri 1; P3 AT 2 BT 5 Pri 2; P4 AT 3 BT 8 Pri 4) Draw Gantt chart and find the average waiting time and average turnaround time: (i) SRTF Scheduling (ii) Round robin (time quantum: 3)

Recent PYQ — must do Mid Term Nov 2023 · Q.4(b) 5 Marks Very high
Show answer

Given data

Processes as printed in the question
ProcessArrival Time (AT)Burst Time (BT)Priority
P1063
P2141
P3252
P4384

Total CPU work = 6 + 4 + 5 + 8 = 23 units, and P1 arrives at 0 so the timeline must start at 0 and end at 23 with no idle gap. Use that as a sanity check on any chart you draw. Formulas used: TAT = CT − AT, WT = TAT − BT.

(i) SRTF — Shortest Remaining Time First (preemptive)

  1. t = 0: only P1 is in the system → P1 runs 0–1 (remaining 5).
  2. t = 1: P2 arrives with BT 4 < P1's remaining 5 → preempt P1, run P2.
  3. t = 2: P3 arrives (5) but P2 has only 3 left → P2 continues.
  4. t = 3: P4 arrives (8) but P2 has 2 left → P2 continues and finishes at t = 5. CT P2 = 5.
  5. t = 5: remaining times are P1 = 5, P3 = 5, P4 = 8. Tie 5 ↔ 5 between P1 and P3 → earlier arrival wins → P1 (AT 0) runs and finishes at t = 10. CT P1 = 10.
  6. t = 10: P3 (5) < P4 (8) → P3 runs 10–15. CT P3 = 15.
  7. t = 15: only P4 left → runs 15–23. CT P4 = 23.
0 1 5 10 15 END
P1 P2 P3 P4
SRTF — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P10610104
P214540
P32515138
P438232012
Average———47 ÷ 4 = 11.7524 ÷ 4 = 6.00

(ii) Round Robin, quantum q = 3 — every slice

Ready-queue rule: a process that arrives during a slice is queued before the process whose slice just expired.

Round Robin slice-by-slice
#SliceTimeBurst left after sliceReady queue after this dispatch
1P10–33P2, P3, P4, P1
2P23–61P3, P4, P1, P2
3P36–92P4, P1, P2, P3
4P49–125P1, P2, P3, P4
5P112–150 → CT P1 = 15P2, P3, P4
6P215–160 → CT P2 = 16P3, P4
7P316–180 → CT P3 = 18P4
8P418–212P4
9P421–230 → CT P4 = 23empty

Check: 3+3+3+3+3+1+2+3+2 = 23 = total burst, and the chart ends at 23 with no idle.

0 3 6 9 12 15 16 18 21 END
P1 P2 P3 P4
Round Robin q = 3 — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P10615159
P214161511
P325181611
P438232012
Average———66 ÷ 4 = 16.5043 ÷ 4 = 10.75
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The question asks for SRTF and Round Robin (q = 3), but the source book prints a Gantt chart for a different algorithm than the one asked — it labels the answer "In SJF (Shortest Job First) Scheduling method … here is the non preemptive SJF" and shows the schedule P2 P4 P1 P3 on the scale 0 1 3 6 9. That printed schedule cannot be any correct answer here: P2 arrives at t = 1 yet is shown owning 0–1, and P4's burst is 8 units yet is shown finishing by t = 3. The printed timeline also stops at 9 although the workload is 23 units. The SRTF figures avg WT 6.00 / avg TAT 11.75 and Round Robin figures avg WT 10.75 / avg TAT 16.50 above are the re-solved answers. For reference, on this data FCFS and non-preemptive SJF coincide: CT 6/10/15/23, avg WT 6.25, avg TAT 12.00.

Verification line: Σ slices = 23 = Σ burst ✓ · CT values reproduce the independent re-solver exactly (SRTF 10/5/15/23, RR 15/16/18/23) · averages 24÷4, 47÷4, 43÷4, 66÷4 ✓.

Unit I · CPU Scheduling numerical

Assume the following workload in a system: (P1 AT 5 BT 5; P2 AT 4 BT 6; P3 AT 3 BT 7; P4 AT 1 BT 9; P5 AT 2 BT 2; P6 AT 6 BT 3) Draw a Gantt chart illustrating the execution of these jobs using Round Robin and Shortest Job first (SJF) scheduling algorithm and also calculate the average waiting time and average turnaround time. Highlight the advantages of each algorithm through the calculate metrics.

Recent PYQ — must do End Term Jan 2024 · Q.3(a) 10 Marks High
Show answer
Note on the quantum: the question does not state a time quantum; the source solution uses q = 3, so q = 3 is used here too. Always write that assumption in the answer.

Given data

Six-process workload as printed
ProcessP1P2P3P4P5P6
Arrival Time543126
Burst Time567923

Total CPU work = 5+6+7+9+2+3 = 32 units; the first arrival is at t = 1, so the chart must contain one idle unit and finish at 1 + 32 = 33. Formulas: TAT = CT − AT, WT = TAT − BT.

Round Robin, q = 3 — every slice

Round Robin slice list (idle 0–1 because nothing has arrived yet)
#12345678910111213
SliceidleP4P5P3P2P4P1P6P3P2P4P1P3
Interval0–11–44–66–99–1212–1515–1818–2121–2424–2727–3030–3232–33

P5's burst is only 2, so its slice is 4–6 (2 units, not 3); P1's last slice is 30–32 and P3's is 32–33 for the same reason. Sum of slices = 1+3+2+3+3+3+3+3+3+3+3+2+1 = 33 ✓.

0 1 4 6 9 12 15 18 21 24 27 30 32 END
Idle P4 P5 P3 P2 P1 P6
Round Robin q = 3 — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P155322722
P246272317
P337333023
P419302920
P522642
P663211512
Average———128 ÷ 6 = 21.3396 ÷ 6 = 16.00

SJF (non-preemptive) — dispatch order

  1. t = 0–1 idle (first arrival is P4 at t = 1).
  2. t = 1: only P4 (9) has arrived → it must run, even though it is the longest burst. CT P4 = 10.
  3. t = 10: all six have arrived; shortest burst among P1 5, P2 6, P3 7, P5 2, P6 3 → P5. CT P5 = 12.
  4. t = 12: shortest of P1 5, P2 6, P3 7, P6 3 → P6. CT P6 = 15.
  5. t = 15: shortest of P1 5, P2 6, P3 7 → P1. CT P1 = 20.
  6. t = 20: P2 (6) then P3 (7). CT P2 = 26, CT P3 = 33.
0 1 10 12 15 20 26 END
Idle P4 P5 P6 P1 P2 P3
SJF non-preemptive — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P155201510
P246262216
P337333023
P4191090
P52212108
P6631596
Average———95 ÷ 6 = 15.8363 ÷ 6 = 10.50

Advantages, shown by the metrics (as the question asks)

MetricRound Robin q = 3SJF non-preemptiveWhich wins, and why it is an advantage
Avg waiting time16.0010.50SJF — it never hands the CPU to a long job while a short one waits.
Avg turnaround time21.3315.83SJF — short jobs leave the system sooner, so the queue drains faster.
Best individual WTP5 = 2P4 = 0RR gives the small job the lowest waiting time; SJF starves it (8).
Worst individual WTP3 = 23P3 = 23Both leave the long job waiting; RR's ceiling is bounded by the quantum, SJF's is not.
Context switches13 dispatches6 dispatchesSJF is cheaper; RR pays in switching overhead for its responsiveness.
Response guaranteeall six have started by t = 18P6 arrives at 6 but first runs only at 12RR's advantage: bounded response time, no starvation.
This one matches the book The Round Robin answer above is an exact match with the printed source — CT 32/27/33/30/6/21, Avg TAT = 128/6 = 21.33, Avg WT = 96/6 = 16. Only the book's stray "Ready Queue P3, P1, P4, P2, …" line is inconsistent with its own chart; the chart and tables are right.
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated — this applies to the SJF half only, because the source prints no usable SJF table for this question (one chart is shown for both algorithms). The re-solved SJF figures are Avg WT 10.50 / Avg TAT 15.83. For completeness, FCFS on the same data gives Avg WT 12.67 / Avg TAT 18.00.

Verification line: Σ slices = 33 = 1 idle + 32 burst ✓ · RR averages equal the printed 21.33 / 16.00 exactly ✓ · SJF row sums 95 ÷ 6 and 63 ÷ 6 re-checked digit by digit ✓.

Unit I · CPU Scheduling numerical

Calculate average waiting and turnaround times by drawing the Gantt chart using FCFS, Preemptive SJF and RR (q = 2 ms). [Data as printed: P1 AT 3 BT 5 · P2 AT 5 BT 8 · P3 AT 1 BT 7 · P4 AT 2 BT 6]

Recent PYQ — must do Mid Term Oct 2024 · Q.4(a) 5 Marks High
Show answer

Given data

Processes as printed (times in ms)
ProcessAT (ms)BT (ms)
P135
P258
P317
P426

Total CPU work = 5+8+7+6 = 26 ms; first dispatch is at t = 1, so every correct chart for this data must end at 27. Formulas: TAT = CT − AT, WT = TAT − BT.

FCFS — arrival order P3 → P4 → P1 → P2

  1. 0–1 idle (nothing has arrived). P3 arrives at 1 → runs 1–8 → CT P3 = 8.
  2. P4 runs 8–14 → CT P4 = 14; P1 runs 14–19 → CT P1 = 19; P2 runs 19–27 → CT P2 = 27.
0 1 8 14 19 END
Idle P3 P4 P1 P2
FCFS — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P135191611
P258272214
P317870
P42614126
Average———57 ÷ 4 = 14.25 ms31 ÷ 4 = 7.75 ms

Preemptive SJF (SRTF)

  1. t = 1: P3 (7) starts. t = 2: P4 arrives with 6 while P3 has 6 left → tie, earlier arrival keeps the CPU → P3 continues.
  2. t = 3: P1 arrives with 5 while P3 has 5 left → again a 5 ↔ 5 tie → P3 (AT 1) continues.
  3. t = 5: P2 arrives with 8 > 4 left → P3 continues and finishes at t = 8 → CT P3 = 8.
  4. t = 8: remaining P1 5, P4 6, P2 8 → P1 runs 8–13 → CT P1 = 13.
  5. t = 13: P4 (6) < P2 (8) → P4 runs 13–19 → CT P4 = 19; P2 runs 19–27 → CT P2 = 27.
0 1 8 13 19 END
Idle P3 P1 P4 P2
Preemptive SJF — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P13513105
P258272214
P317870
P426191711
Average———56 ÷ 4 = 14.00 ms30 ÷ 4 = 7.50 ms

Round Robin, q = 2 ms — every slice

Round Robin q = 2 slice list (arrivals queue before the preempted process)
#SliceTimeLeft after sliceReady queue after dispatch
—idle0–1—P3
1P31–35P4, P1, P3
2P43–54P1, P3, P2, P4
3P15–73P3, P2, P4, P1
4P37–93P2, P4, P1, P3
5P29–116P4, P1, P3, P2
6P411–132P1, P3, P2, P4
7P113–151P3, P2, P4, P1
8P315–171P2, P4, P1, P3
9P217–194P4, P1, P3, P2
10P419–210 → CT P4 = 21P1, P3, P2
11P121–220 → CT P1 = 22P3, P2
12P322–230 → CT P3 = 23P2
13P223–252P2
14P225–270 → CT P2 = 27empty

Check: 2×12 + 1 + 1 + 2 + 2 = 26 ms of CPU work, plus 1 ms idle at the start = timeline ends at 27 ✓.

0 1 3 5 7 9 11 13 15 17 19 21 22 23 25 END
Idle P3 P4 P1 P2
Round Robin q = 2 — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P135221914
P258272214
P317232215
P426211913
Average———82 ÷ 4 = 20.50 ms56 ÷ 4 = 14.00 ms
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated — for the Preemptive SJF part. The book prints Avg WT 8.00 ms / Avg TAT 14.50 ms (its table gives P1 CT 8, P2 CT 28, P3 CT 20, P4 CT 13). It tie-broke the 3 ↔ 5 clash in favour of P1, but under "earlier arrival wins" P3 — which has 5 units remaining at t = 3 and arrived first — keeps the CPU. Since SRTF is provably optimal for average waiting time, the lower figure 7.50 ms / 14.00 ms is the correct one.
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated — for the Round Robin part too. The book prints Avg WT 9.00 ms / Avg TAT 15.50 ms (CT P1 14, P2 23, P3 17, P4 19) and even marks its own answer with **. Its Gantt ends at t = 23, but the total burst is 26 ms with the first dispatch at t = 1, so the chart must end at 27: the printed schedule silently drops 4 ms of CPU work. The correct averages are 14.00 ms / 20.50 ms.

Verification line: FCFS above is confirmed by the book (7.75 / 14.25) ✓ · every chart here ends at 27 ✓ · row sums 57, 31, 56, 30, 82, 56 re-added ✓.

Unit I · CPU Scheduling numerical · headline problem

Consider the following set of processes, with the CPU-burst time given in milliseconds. (A 0 12; B 3 8; C 5 5; D 7 1; E 9 11) Draw the Gantt charts illustrating the execution of these processes and find: (i) Average waiting time for these processes with the SJF, Shortest Remaining Time First, Round Robin (Time quantum = 3 ms) and FCFS scheduling algorithm. (ii) Average turn around time for these processes with the SJF, SRTF, Round Robin and FCFS algo.

Recent PYQ — must do End Term Dec 2024 · Q.3(a) 6.5 Marks Very high
Why this is the headline: it is the only question in the set that asks for four algorithms on one data table, so it is the cheapest way to revise FCFS, SJF, SRTF and RR together.
Show answer

Given data

Processes as printed (AT, BT in milliseconds)
ProcessABCDE
Arrival Time03579
Burst Time1285111

Total CPU work = 12+8+5+1+11 = 37 ms and A arrives at 0, so all four charts must end at 37 with no idle. Formulas: TAT = CT − AT, WT = TAT − BT.

1. FCFS — arrival order A → B → C → D → E

  1. A owns the CPU from 0 (only process present) → 0–12, CT A = 12.
  2. B 12–20 → CT 20 · C 20–25 → CT 25 · D 25–26 → CT 26 · E 26–37 → CT 37.
0 12 20 25 26 END
A B C D E
FCFS — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
A01212120
B3820179
C55252015
D71261918
E911372817
Average———96 ÷ 5 = 19.20 ms59 ÷ 5 = 11.80 ms

2. SJF (non-preemptive)

  1. t = 0: only A has arrived → A must run to completion: 0–12. CT A = 12.
  2. t = 12: ready set B 8, C 5, D 1, E 11 → shortest is D (1) → 12–13.
  3. t = 13: B 8, C 5, E 11 → C (5) → 13–18.
  4. t = 18: B 8 < E 11 → B → 18–26, then E → 26–37.

Dispatch order A → D → C → B → E, exactly the order the book prints.

0 12 13 18 26 END
A D C B E
SJF non-preemptive — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
A01212120
B38262315
C5518138
D711365
E911372817
Average———82 ÷ 5 = 16.40 ms45 ÷ 5 = 9.00 ms

3. SRTF — Shortest Remaining Time First

Every preemption decision
At tRunning / remainingNew arrivalDecision
0A 12—A runs
3A 9 leftB 88 < 9 → preempt A, run B
5B 6 leftC 55 < 6 → preempt B, run C
7C 3 leftD 11 < 3 → preempt C, run D → D finishes at 8 (CT D = 8)
8C 3 left—C resumes, finishes at 11 (CT C = 11)
9E 11 arrives while B runsE 11B 6 < E 11 → B keeps the CPU, finishes at 17 (CT B = 17)
17A 9, E 11—A shorter → A runs 17–26 (CT A = 26)
26E 11—E runs 26–37 (CT E = 37)
0 3 5 7 8 11 17 26 END
A B C D E
SRTF — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
A012262614
B3817146
C551161
D71810
E911372817
Average———75 ÷ 5 = 15.00 ms38 ÷ 5 = 7.60 ms
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints Avg WT 10.60 ms / Avg TAT 18.00 ms (its SRTF table is CT 37/20/13/8/36, TAT 37/17/8/1/27, WT 25/9/3/0/16). Its chart has A finishing at 37 and E at 36 — impossible under the shortest-remaining-time rule: E arrives at t = 9 with 11 units, so it can never overtake A, which already holds 9 remaining units and arrived first. Re-solved values are 7.60 ms / 15.00 ms.

4. Round Robin, q = 3 ms — every slice

Round Robin q = 3 slice list
#SliceTimeLeft after sliceReady queue after dispatch
1A0–39B, A
2B3–65A, C, B
3A6–96C, B, D, E, A
4C9–122B, D, E, A, C
5B12–152D, E, A, C, B
6D15–160 → CT D = 16E, A, C, B
7E16–198A, C, B, E
8A19–223C, B, E, A
9C22–240 → CT C = 24B, E, A
10B24–260 → CT B = 26E, A
11E26–295A, E
12A29–320 → CT A = 32E
13E32–352E
14E35–370 → CT E = 37empty

Check: 3+3+3+3+3+1+3+3+2+2+3+3+3+2 = 37 ms = Σ burst, chart ends at 37 ✓.

0 3 6 9 12 15 16 19 22 24 26 29 32 35 END
A B C D E
Round Robin q = 3 — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
A012323220
B38262315
C55241914
D711698
E911372817
Average———111 ÷ 5 = 22.20 ms74 ÷ 5 = 14.80 ms
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints Avg WT 14.20 ms / Avg TAT 21.60 ms (CT 29/31/23/13/36, TAT 29/28/18/6/27, WT 17/20/13/5/16). Its own timeline is internally broken: it shows E with 5 units left at t = 23 but then gives E only 3 units (31–34) plus 2 units (34–36), and it never accounts for D's arrival ordering. The slice-by-slice re-simulation above (0–3 A, 3–6 B, 6–9 A, 9–12 C, 12–15 B, 15–16 D, 16–19 E, 19–22 A, 22–24 C, 24–26 B, 26–29 E, 29–32 A, 32–35 E, 35–37 E) gives 14.80 ms / 22.20 ms.

Final comparison — the four algorithms side by side

Same workload, four policies (re-solved values)
AlgorithmAvg Waiting TimeAvg Turnaround TimeDispatchesBook's printed WT / TAT
FCFS11.8019.20511.80 / 19.20 — agrees
SJF (non-preemptive)9.0016.4059.00 / 16.40 — agrees
SRTF7.60 (best)15.00 (best)810.60 / 18.00 — wrong
Round Robin q = 314.80 (worst)22.20 (worst)1414.20 / 21.60 — wrong
What the comparison is worth writing in the answer SRTF wins both averages because it always runs the shortest remaining work (it is optimal for average waiting time on a single CPU). Round Robin loses both because it trades time-for-fairness: 14 dispatches instead of 5, so the convoy effect is replaced by a bounded response time — D, which waits 18 ms under FCFS, waits only 8 ms here. That fairness-for-average trade-off is the point of the question.

Verification line: every chart ends at 37 = Σ burst ✓ · FCFS and SJF reproduce the printed book figures exactly ✓ · row sums 96/59, 82/45, 75/38, 111/74 re-added ✓.

Unit I · CPU Scheduling numerical

Consider four processes with the following CPU bursts (in ms): P1-12, P2-7, P3-8, P4-6, P5-10, and the arrival time is 0 for all processes. (i) Using SJF and Round Robin scheduling (time quantum = 3), draw the Gantt chart. (ii) Compute waiting time and turnaround time for each process for both scheduling algorithms. (iii) Compare the results and reason about which is more efficient in this case.

Recent PYQ — must do Mid Term Oct 2025 · Q.2(b) 6 Marks High
Source wording bug, reproduced as printed: the question says "four processes" and then lists five (P1–P5). Answer with five processes and note the slip.
Show answer

Given data

All arrival times are 0
ProcessP1P2P3P4P5
Arrival Time00000
Burst Time (ms)1278610

Total CPU work = 12+7+8+6+10 = 43 ms, every process is present at t = 0, so both charts run from 0 to 43 with no idle. Since all AT = 0, TAT = CT and WT = CT − BT here.

SJF (all arrived, so tie-break by lower process number is never needed)

  1. Shortest burst first: P4 (6) → P2 (7) → P3 (8) → P5 (10) → P1 (12).
  2. Gantt boundaries: 0 – 6 – 13 – 21 – 31 – 43.
0 6 13 21 31 END
P4 P2 P3 P5 P1
SJF — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P1012434331
P20713136
P308212113
P406660
P5010313121
Average———114 ÷ 5 = 22.80 ms71 ÷ 5 = 14.20 ms

Round Robin, q = 3 — every slice

Initial ready queue (all arrive together, so they join in number order): P1, P2, P3, P4, P5.

Round Robin q = 3 slice list
#SliceTimeLeftReady queue after dispatch
1P10–39P2, P3, P4, P5, P1
2P23–64P3, P4, P5, P1, P2
3P36–95P4, P5, P1, P2, P3
4P49–123P5, P1, P2, P3, P4
5P512–157P1, P2, P3, P4, P5
6P115–186P2, P3, P4, P5, P1
7P218–211P3, P4, P5, P1, P2
8P321–242P4, P5, P1, P2, P3
9P424–270 → CT P4 = 27P5, P1, P2, P3
10P527–304P1, P2, P3, P5
11P130–333P2, P3, P5, P1
12P233–340 → CT P2 = 34P3, P5, P1
13P334–360 → CT P3 = 36P5, P1
14P536–391P1, P5
15P139–420 → CT P1 = 42P5
16P542–430 → CT P5 = 43empty

Check: 3×13 + 1 + 2 + 1 = 39 + 4 = 43 ms ✓ (13 full quanta, plus the short closing slices).

0 3 6 9 12 15 18 21 24 27 30 33 34 36 39 42 END
P1 P2 P3 P4 P5
Round Robin q = 3 — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P1012424230
P207343427
P308363628
P406272721
P5010434333
Average———182 ÷ 5 = 36.40 ms139 ÷ 5 = 27.80 ms
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints Avg WT 28.20 ms / Avg TAT 36.80 ms (CT P4 27, P2 33, P3 39, P5 42, P1 43; WT 31/26/31/21/32). It mis-orders the last three slices: with the queue written above, P3 finishes at 36 and P1 at 42, not P3 at 39 and P1 at 43. Re-solved: 27.80 ms / 36.40 ms.

(iii) Comparison — which is more efficient here

BasisSJFRound Robin q = 3More efficient
Avg waiting time14.20 ms27.80 msSJF (about half)
Avg turnaround time22.80 ms36.40 msSJF
Dispatches / context switches516SJF — RR pays 11 extra switches
Throughput (jobs per 43 ms)same 5, but the queue drains sooner5SJF
Response time / fairnessP1 waits 31 ms before its only runevery process runs within the first 15 msRR

Conclusion worth writing: SJF is more efficient on both averages because all processes are available at t = 0, so SJF can order them by burst exactly once and never look back; RR costs an extra 13.6 ms of average waiting purely for the fairness of a bounded response time. The comparison stands either way — even on the book's own (mis-ordered) figures SJF wins both averages.

Verification line: charts end at 43 = Σ burst ✓ · SJF numbers match the book exactly (14.20 / 22.80) ✓ · RR row sums 139 ÷ 5 and 182 ÷ 5 ✓.

Unit I · CPU Scheduling numerical · four algorithms

Consider the following set of processes in the order P1, P2, P3, P4, P5 with Arrival time 0, 1, 2, 3, 4 and in the same order the CPU Burst time in milliseconds are given as 10, 9, 6, 7, 4. Their Priorities are 3, 5, 2, 1 and 4 respectively with 5 considered higher priority. Calculate the Average waiting time and Turnaround time using the following scheduling algorithms: (i) Shortest Remaining Time First (ii) Round Robin (q = 2) (iii) Shortest Job First (iv) Priority Scheduling (Preemptive type)

Recent PYQ — must do End Term Dec 2025 · Q.2(b) 7 Marks Very high
Show answer

Given data

Higher priority number = higher priority (stated in the question)
ProcessATBT (ms)Priority
P10103
P2195 (highest)
P3262
P4371 (lowest)
P5444

Total CPU work = 10+9+6+7+4 = 36 ms, P1 arrives at 0, so all four charts run 0 → 36 with no idle. Formulas: TAT = CT − AT, WT = TAT − BT.

(i) SRTF — Shortest Remaining Time First

  1. t = 0: P1 runs. t = 1: P2 arrives with 9 and P1 has 9 left → tie; P1 arrived earlier, so P1 keeps the CPU (this single tie-break is where the book goes wrong).
  2. t = 2: P3 arrives with 6 < P1's 8 → preempt P1. t = 3: P4 arrives (7) > P3's 5 → P3 continues.
  3. t = 4: P5 arrives with 4 and P3 has 4 left → tie; P3 arrived earlier, so P3 continues and finishes at t = 8 → CT P3 = 8.
  4. t = 8: remaining P1 8, P2 9, P4 7, P5 4 → P5 shortest → 8–12 → CT P5 = 12.
  5. t = 12: P4 (7) < P1 (8) < P2 (9) → P4 12–19 → CT P4 = 19.
  6. t = 19: P1 (8) < P2 (9) → P1 19–27 → CT P1 = 27; then P2 27–36 → CT P2 = 36.
0 2 8 12 19 27 END
P1 P3 P5 P4 P2
SRTF — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P1010272717
P219363526
P326860
P43719169
P5441284
Average———92 ÷ 5 = 18.40 ms56 ÷ 5 = 11.20 ms
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints Avg WT 11.80 ms / Avg TAT 19.00 ms (its Gantt is 0–1 P1 | 1–4 P2 | 4–8 P5 | 8–14 P3 | 14–20 P2 | 20–27 P4 | 27–36 P1, CT P5 8, P3 14, P2 20, P4 27, P1 36). It let P2 preempt P1 on a 9-vs-9 tie and P5 preempt P3 on a 4-vs-4 tie. Under the stated convention — on a tie the earlier arrival runs — both preemptions are wrong, and because SRTF is optimal for average waiting time the lower figure 11.20 / 18.40 is the correct one.

(ii) Round Robin, q = 2 — every slice

Round Robin q = 2 slice list (arrivals queue before the preempted process)
#SliceTimeLeftReady queue after dispatch
1P10–28P2, P3, P1
2P22–47P3, P1, P4, P5, P2
3P34–64P1, P4, P5, P2, P3
4P16–86P4, P5, P2, P3, P1
5P48–105P5, P2, P3, P1, P4
6P510–122P2, P3, P1, P4, P5
7P212–145P3, P1, P4, P5, P2
8P314–162P1, P4, P5, P2, P3
9P116–184P4, P5, P2, P3, P1
10P418–203P5, P2, P3, P1, P4
11P520–220 → CT P5 = 22P2, P3, P1, P4
12P222–243P3, P1, P4, P2
13P324–260 → CT P3 = 26P1, P4, P2
14P126–282P4, P2, P1
15P428–301P2, P1, P4
16P230–321P1, P4, P2
17P132–340 → CT P1 = 34P4, P2
18P434–350 → CT P4 = 35P2
19P235–360 → CT P2 = 36empty

Check: 17 slices × 2 + 2 slices × 1 = 34 + 2 = 36 ms = Σ burst ✓.

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 35 END
P1 P2 P3 P4 P5
Round Robin q = 2 — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P1010343424
P219363526
P326262418
P437353225
P544221814
Average———143 ÷ 5 = 28.60 ms107 ÷ 5 = 21.40 ms
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints Avg WT 22.80 ms / Avg TAT 30.00 ms (CT P5 28, P3 30, P4 32, P1 34, P2 36; WT 24/26/22/22/20). Its 18-cell Gantt string accounts for only part of the workload and its CT column for P5, P3 and P4 is 6 ms later than a correct simulation. The slice list above is complete (19 dispatches, 36 units), so the re-solved averages are 21.40 ms / 28.60 ms.

(iii) SJF (non-preemptive)

  1. t = 0: only P1 present → P1 runs 0–10 → CT P1 = 10.
  2. t = 10: bursts available are P2 9, P3 6, P4 7, P5 4 → P5 first (4) → CT P5 = 14.
  3. t = 14: P3 (6) < P4 (7) < P2 (9) → P3 → CT P3 = 20; then P4 → CT P4 = 27; then P2 → CT P2 = 36.
0 10 14 20 27 END
P1 P5 P3 P4 P2
SJF non-preemptive — CT / TAT / WT
ProcessATBTCTTAT = CT − ATWT = TAT − BT
P101010100
P219363526
P326201812
P437272417
P54414106
Average———97 ÷ 5 = 19.40 ms61 ÷ 5 = 12.20 ms

(iv) Priority Scheduling — preemptive (higher number = higher priority)

  1. t = 0: P1 (pri 3) runs alone for 1 unit.
  2. t = 1: P2 arrives with pri 5 > 3 → preempt P1; P2 owns the CPU until it finishes at t = 10 → CT P2 = 10.
  3. t = 4: P5 arrives with pri 4 — higher than P1 (3), but P2 (5) is still running, so P5 waits.
  4. t = 10: P2 gone → highest priority present is P5 (4) → P5 runs 10–14 → CT P5 = 14.
  5. t = 14: P1 (3) > P3 (2) > P4 (1) → P1 runs 14–23 → CT P1 = 23; then P3 23–29 → CT P3 = 29; then P4 29–36 → CT P4 = 36.
0 1 10 14 23 29 END
P1 P2 P5 P3 P4
Preemptive Priority — CT / TAT / WT
ProcessATBTPriCTTAT = CT − ATWT = TAT − BT
P10103232313
P21951090
P3262292721
P4371363326
P544414106
Average————102 ÷ 5 = 20.40 ms66 ÷ 5 = 13.20 ms
This half agrees with the book The SJF and preemptive-Priority answers match the printed source (SJF 12.20 / 19.40 and Priority 13.20 / 20.40). The book's priority Gantt — 0–1 P1, 1–10 P2, 10–14 P5, 14–23 P1, 23–29 P3, 29–36 P4 — reproduces exactly.

Four-algorithm comparison

AlgorithmAvg WTAvg TATNote
SRTF11.20 (best)18.40 (best)Optimal for average WT; 6 dispatches.
SJF (non-preemptive)12.2019.40Close second; only 5 dispatches, cheapest.
Priority (preemptive)13.2020.40Good for P2 (WT 0), unfair to P4 (WT 26) — starvation risk.
Round Robin q = 221.40 (worst)28.60 (worst)Fairest: every process has run by t = 12; 19 dispatches.
Priority (non-preemptive), same data14.2021.40Reference only — not asked in this question.

Verification line: all four charts end at 36 = Σ burst ✓ · SJF and Priority row sums 97/61 and 102/66 re-added ✓ · RR slice count 19 with 17×2 + 2×1 = 36 ✓.

2. Memory Allocation

First / best / worst fit
Unit II · Contiguous allocation numerical

Given Memory Partitions of 100K, 500K. 200K. 300K and 600K (in order), how would each of the first fit, best fit, and worst fit algorithms place processes of 212K, 417K, 112K and 426K (in order)? Which algorithms make the most efficient use of memory?

Recent PYQ — must do End Term Jul 2023 · Q.2(b) 6.5 Marks Very high
Asked in: End Term [JULY 2023] Q.2(b) (6.5 marks) · 2016 paper Q.4 (marks not printed on the question) · End Term [MAY–JUNE 2017] Q.2(b) (4 marks) · Dec-2025 Q.5(a) area — identical data every time.
Show answer

Given data

Memory partitions in printed order, processes in printed order
PartitionP-1P-2P-3P-4P-5Total
Size100K500K200K300K600K1700K
Process1234Total
Size212K417K112K426K1167K

Rules to state before you start: first-fit = the first partition (scanning in address order) that is big enough; best-fit = the smallest partition that is big enough; worst-fit = the largest partition available. A process that fits nowhere must wait. Total memory 1700K vs total demand 1167K, so the failures below are about fragmentation, not capacity.

First-fit

ProcessSizeAllocated BlockRemaining Space
1212K500K block (2nd)288K
2417K600K block (5th)183K
3112K288K hole in the 500K block176K
4426K— must waitfree list 100K, 176K, 200K, 300K, 183K

Why 426K waits: the 100K, 176K, 200K, 300K and 183K holes are all smaller than 426K. 959K of the 1167K requested is placed; 426K is left out even though 959K of free space exists in total — external fragmentation.

Best-fit

ProcessSizeAllocated BlockRemaining Space
1212K300K block (4th)88K
2417K500K block (2nd)83K
3112K200K block (3rd)88K
4426K600K block (5th)174K

Free list after all four placements: 100K, 83K, 88K, 88K, 174K.

Worst-fit

ProcessSizeAllocated BlockRemaining Space
1212K600K block (5th)388K
2417K500K block (2nd)83K
3112K388K hole in the 600K block276K
4426K— must waitfree list 100K, 83K, 200K, 300K, 276K

Worst-fit deliberately keeps the largest leftover, but it burns the only two blocks that a 426K request could ever have fitted into whole.

Answer to "which makes the most efficient use of memory"

PolicyProcesses placedTotal allocatedLeftover fragment listVerdict
First-fit3 of 4741K100K, 176K, 200K, 300K, 183K426K waits
Best-fit4 of 41167K100K, 83K, 88K, 88K, 174Konly policy that places all four
Worst-fit3 of 4741K100K, 83K, 200K, 300K, 276K426K waits

Best-fit is the only policy that places all four processes, so it makes the most efficient use of memory on this data set — exactly the conclusion printed in the 2016 paper: "Best-fit algorithm makes the most efficient use of memory. It is the only [one] capable of meeting all memory requests in this case."

Fig NUM-1 · How best-fit lands the four processes
Memory partitions (in order) 100K 500K 200K 300K 600K After best-fit allocation free 417K 112K 212K 426K 83K hole 88K 88K 174K hole 212K → 300K block (smallest block that fits it) · 417K → 500K · 112K → 200K · 426K → 600K First-fit and worst-fit both leave 426K with nowhere to go
How to draw this in exam
  1. Draw one long rectangle split into five blocks labelled 100K, 500K, 200K, 300K, 600K in that order.
  2. Under it, draw the same five blocks and shade the part each process occupies; write the leftover size inside the block.
  3. Do one policy at a time and re-draw the free list after every placement — that is where marks are lost.
  4. Finish with the one-line verdict: best-fit places all four.
Warning — do not copy the May–June 2017 printed answer The same data was asked twice, and the two printed answers contradict each other. The May–June 2017 solution states 212K → 500K (288 left) under best-fit, then claims 112K and 426K both find "No Space", and concludes "The best fit and First Fit algorithms uses memory most efficiently." That cannot be right: 212K's best fit among 100K/500K/200K/300K/600K is the 300K block (88K left), not the 500K block, and once 212K is put in 300K the 600K block stays whole for 426K. The 2016 printed answer agrees with the independently re-solved table above.

Verification line: every policy trace re-ran from the free list 100K, 500K, 200K, 300K, 600K; best-fit consumes 1167K with fragments 100+83+88+88+174 = 533K, and 1167 + 533 = 1700K = total memory ✓. First-fit and worst-fit each place 212+417+112 = 741K and leave 426K waiting ✓.

Theory behind this — contiguous allocation, internal vs external fragmentation and compaction → Memory Management.

3. Paging / Address Translation

Address arithmetic

The four rules every paging arithmetic question uses

QuantityRuleWorked once (page size 16 B, logical space 4096 B, memory 512 B)
Offset / displacement bitsoffset bits = log2(page size)log2 16 = 4 bits
Number of pagesprocess (logical) size ÷ page size4096 ÷ 16 = 256 pages
Page-number bitspage-number bits = logical bits − offset bits12 − 4 = 8 bits (log2 256 = 8 ✓)
Number of framesframes = physical memory ÷ frame size (frame size = page size)512 ÷ 16 = 32 frames
Physical address bitslog2(frames) + offset bits5 + 4 = 9 bits
Internal fragmentationpage size − (size − last complete page)4096 is an exact multiple of 16 → 0 bytes
Fig NUM-2 · Splitting a logical address into page number + offset
Logical address (p + d bits) page number p bits offset d log2(page size) page table page → frame frame number log2(frames) offset d copied, unchanged Physical address Logical bits = p + d · Physical bits = log2(frames) + d · offset bits never change during translation
How to draw this in exam
  1. Two stacked strips: logical address on top, physical below; each split into two boxes.
  2. Label the left boxes "page number" and "frame number", the right boxes both "offset d".
  3. Arrow from the page-number box into a small "page table" box, then arrow out to the frame number.
  4. Write the two formulas in the margin: offset bits = log2(page size); physical bits = log2(frames) + offset bits.
Unit II · Paging address arithmetic

Consider a logical address space of eight pages of 1024 words each, mapped onto a physical memory of 32 frames. (i) How many bits are there in the logical address? (ii) How many bits are there in physical address?

Recent PYQ — must do End Term Dec 2024 · Q.5(b) 3 Marks Very high
Show answer

Given data

ItemValue as printed
Number of pages8
Page size1024 words
Physical memory32 frames (frame size = page size = 1024 words)

Solution

  1. Logical address space = 8 pages × 1024 words = 8192 words.
  2. Bits in the logical address = log2(8192) = 13 bits. Split check: page bits log2 8 = 3, offset bits log2 1024 = 10, and 3 + 10 = 13 ✓.
  3. Physical memory = 32 frames × 1024 words = 32768 words.
  4. Bits in the physical address = log2(32768) = 15 bits. Split check: frame bits log2 32 = 5, offset bits 10, and 5 + 10 = 15 ✓.
Address structure
AddressPage / frame fieldOffset fieldTotal bits
Logical3 bits (8 pages)10 bits (1024 words)13
Physical5 bits (32 frames)10 bits (1024 words)15
Verification note Verification note: the printed source result agrees with the re-solved values — logical 13 bits (8192 words) and physical 15 bits (32768 words). No correction needed on this question.

Verification line: 2¹³ = 8192 ✓ · 2¹⁵ = 32768 ✓ · offset bits identical on both sides of the translation ✓.

Unit II · Paging / page-table arithmetic

A process contains a logical address space of 4096 bytes. Main memory size is 512 bytes. If the process is divided into fixed size partition of 16 byte each then (a) what will be size of offset/displacement bits? (b) How many pages are there in the process? (c) How much internal fragmentation will occur? (d) Find out the number of entries in general page table (e) How many entries will be there if the page table is an inverted one then?

Older PYQ — syllabus gap First Term Feb 2019 · Q.4 10 Marks High
Show answer

Given data

ItemValuePower of 2
Logical address space4096 bytes2¹²
Main (physical) memory512 bytes2⁹
Page / partition size16 bytes2⁴

Solution, part by part

PartWorkingAnswer
Logical address bitslog2 409612 bits
(a) Offset bitslog2(page size) = log2 164 bits
(b) Number of pages4096 ÷ 16 = 2¹² ÷ 2⁴ = 2⁸256 pages
(c) Internal fragmentation4096 = 256 × 16 exactly, so the last page is full: 16 − 16 = 00 bytes
(d) General page table entriesone entry per page of the process = 256256 entries
Physical address bitslog2 5129 bits
Number of framesphysical memory ÷ frame size = 512 ÷ 16 = 2⁹ ÷ 2⁴ = 2⁵32 frames
(e) Inverted page table entriesan inverted page table has one entry per frame, not per page32 entries
Page-number bits checklogical bits − offset bits = 12 − 48 bits = log2 256 ✓
Verification note Verification note: the printed source result appears inconsistent and the solution above was independently recalculated — but only because the book prints no number at all for part (c) (it writes the heading "No. Internal fragmentation" and then moves on). The re-solved value is 0 bytes, because 4096 is an exact multiple of 16 and no page is left partly empty. Every other part of the printed answer (offset 4, pages 256, entries 256, frames 2⁵ = 32, inverted entries 2⁵) agrees with the values above.

Verification line: 12 = 8 page bits + 4 offset bits ✓ · 9 = 5 frame bits + 4 offset bits ✓ · 256 pages × 16 B = 4096 B ✓ · 32 frames × 16 B = 512 B ✓.

Unit II · Paging / page-table arithmetic · source answer broken

A process contains a logical address space of 4050 bytes. Main memory size is 1024 bytes. If the process is divided into fixed size partitions of 16 byte each then. (a) What will be size of offset/displacement bits? (b) How many pages are there in the process? (c) How much internal fragmentation will occur? (d) Find out number of entries in general page table. (e) If the page table in inverted one then how many entries will be there?

Older PYQ — important variant First Term Feb 2018 · Q.4 10 Marks High
Same template as Feb-2019 Q.4 above, with a process size that is not an exact multiple of the page size — which is exactly why the fragmentation part matters.
Show answer

Given data

ItemValue
Logical address space4050 bytes
Main memory size1024 bytes
Page / partition size16 bytes = 2⁴

Solution

PartWorkingAnswer
Logical address bits4050 needs ⌈log2 4050⌉ bits (2¹¹ = 2048 < 4050 ≤ 4096 = 2¹²)12 bits
(a) Offset bitslog2(page size) = log2 164 bits
(b) Pages in the process⌈4050 ÷ 16⌉ = ⌈253.125⌉ = 253 full pages + 1 partly filled page254 pages
(c) Internal fragmentationlast page holds 4050 − 253×16 = 2 of 16 bytes → 16 − 214 bytes
Physical address bitslog2 102410 bits
Number of framesphysical memory ÷ frame size = 1024 ÷ 1664 frames
(d) General page table entriesone entry per page254 entries
(e) Inverted page table entriesone entry per frame64 entries
Page-number bits check12 − 4 = 8 bits, and 2⁸ = 256 ≥ 254 pages ✓8 bits
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints 4050/16 = 253.125 = 2^8 for the page count (253.125 is not a power of 2, and a process cannot own a fraction of a page) and prints 16 − 2 = 8 byte for internal fragmentation (the subtraction itself gives 14, not 8). The re-solved figures are 254 pages and 14 bytes of internal fragmentation, with 64 frames / 64 inverted-page-table entries.

Verification line: 253 × 16 + 2 = 4050 ✓ · 254 pages × 16 B = 4064 B = 4050 + 14 wasted ✓ · 64 frames × 16 B = 1024 B ✓.

Unit II · Segmentation with paging address bits

In a system using paging and segmentation, the virtual address space consists of up to 8 segments where each segment can be upto 2²⁹ bytes long. The hardware pages each segment into 256 byte pages. How many bits in the virtual address specify the following: (i) Segment number (ii) Page number (iii) Offset within page (iv) Entire Virtual address

Older PYQ — syllabus gap End Term Jun 2019 · Q.2(b) 4 Marks Medium
Show answer

Given data

ItemValuePower of 2
Segments in the address space82³
Maximum segment length2²⁹ bytes2²⁹
Page size inside a segment256 bytes2⁸

Solution

FieldWorkingBits
(i) Segment numberlog2(number of segments) = log2 83 bits
(iii) Offset within pagelog2(page size) = log2 2568 bits
Pages per segmentsegment size ÷ page size = 2²⁹ ÷ 2⁸ = 2²¹ pages—
(ii) Page numberlog2(pages per segment) = log2 2²¹  (check: segment bits 29 − offset bits 8 = 21)21 bits
(iv) Entire virtual addresssegment + page + offset = 3 + 21 + 832 bits
Verification note Verification note: the printed source result agrees with the re-solved values here — segment 3, page 21, offset 8, total 32 bits. (One line of the printed working reads "for 28 byte page" only because the superscript on 2⁸ is lost in the scan; the arithmetic actually used is 2⁸ = 256, as above.)

Verification line: 3 + 21 + 8 = 32 ✓ · 2²¹ pages × 2⁸ bytes = 2²⁹ bytes = the stated maximum segment length ✓ · offset bits = log2(page size) = 8 ✓.

Unit II · TLB effective access time

For a paged system, TLB hit ratio is 0.8. Let the RAM access time 't' be 100ns and the TLB access time 'T' be 50 ns. Calculate effective memory access time (with TLB).

Older PYQ — syllabus gap First Term Feb 2019 · Q.3(a) 5 Marks High
Show answer

Given data

ItemSymbolValue
TLB hit ratioh0.8
Main memory (RAM) access timet100 ns
TLB (associative register) access timeT50 ns

Solution

  1. TLB hit path: search the TLB, then use the frame from the TLB to fetch the word from memory → T + t = 50 + 100 = 150 ns. Probability 0.8.
  2. TLB miss path: search the TLB (50), read the page table from memory (100), reload the TLB, then read the required word from memory (100) → T + 2t = 50 + 200 = 250 ns. Probability 1 − 0.8 = 0.2.
  3. EAT = h(T + t) + (1 − h)(T + 2t) = 0.8 × 150 + 0.2 × 250 = 120 + 50 = 170 ns.
EAT = 0.8 × (50 + 100) + (1 - 0.8) × (50 + 2 × 100)
    = 0.8 × 150 + 0.2 × 250
    = 120.0 + 50.0
    = 170.0 ns
Where the 170 ns comes from
CaseProbabilityTimeContribution
TLB hit0.8150 ns120 ns
TLB miss0.2250 ns50 ns
EAT1.0—170 ns
Verification note Verification note: the printed source result agrees — the book's chain 0.8 × 150 + 0.2 × 250 = 120.0 + 50.0 = 170.0 ns is reproduced by the independent re-solver exactly. Note the model assumption to state in the exam: a miss costs two memory accesses (page table + the word itself).

Verification line: 0.8 × 150 = 120 ✓ · 0.2 × 250 = 50 ✓ · 120 + 50 = 170 ns ✓ · EAT must lie between the hit path (150) and the miss path (250) ✓.

TLB structure and the hit/miss hardware path → Memory Management · Paging and TLB.

Unit II · Demand paging EAT · broken source answer

If the average page fault service time of 25 ms and a memory access time of 100ns. Calculate the effective access time.

Older PYQ — important variant End Term Jun 2019 · Q.1(h) 2.5 Marks Medium
Show answer

Given data

ItemValueIn nanoseconds
Average page-fault service time25 ms25 × 10⁶ = 25,000,000 ns
Memory access time100 ns100 ns

Solution

  1. Convert to one unit first — that is the whole trick in this question. 1 ms = 10⁶ ns, so 25 ms = 25,000,000 ns.
  2. Access that takes the page-fault path costs service time + the memory access that follows it: 25,000,000 + 100 = 25,000,100 ns ≈ 25 ms.
  3. An access with no page fault costs just 100 ns.
  4. With a page-fault rate p the general expression is EAT = (1 − p) × 100 ns + p × 25,000,100 ns. The question does not give p, so the only figure that can be produced from the printed data is the single faulting-access total, 25,000,100 ns.
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book adds the two numbers with no unit conversion at all: "Effective access time = Page fault service time + memory access time. = 25 + 100 = 125 ns." That is dimensionally wrong — 25 is milliseconds and 100 is nanoseconds. Expressed in one unit the sum is 25,000,100 ns (≈ 25 ms), not 125 ns.

Verification line: 25 ms = 25 × 10⁶ ns ✓ · 25,000,000 + 100 = 25,000,100 ns ✓ · a page fault is about 250,000 × more expensive than a clean memory access — which is the point the question is really testing.

Unit II · TLB hit ratio from a target EAT · broken source answer

On a simple paged system, associative registers hold the most active page entries & full page table is stored in the main memory. If the references satisfied by the associative registers take 100ns & reference through the main memory page table take 180ns. What must be the hit ratio to be achieved on effective access time of 125ns?

Older PYQ — important variant End Term Jul 2016 · Q.2(b) Marks: not clearly visible Medium
Show answer

Given data

ItemValue
Time for a reference satisfied by the associative registers (TLB hit)100 ns
Time for a reference made through the main-memory page table180 ns
Target effective access time125 ns
Unknownhit ratio x

Solution

  1. A hit costs the associative-register time only: 100 ns.
  2. A miss costs the page-table search in memory and then the required access: 100 + 180 = 280 ns.
  3. Set up the weighted average and solve: 125 = 100x + 280(1 − x) = 280 − 180x → 180x = 155 → x = 155 ÷ 180 = 0.861.
  4. So the associative registers must catch about 86.1 % of the references.
EAT = x(hit) + (1 - x)(miss)
125 = 100x + 280(1 - x)
125 = 280 - 180x
180x = 155
x  = 155/180 = 0.861   (hit ratio, valid because 0 < x < 1)
Sanity check on the answer
CheckRequirementResult
Is the answer a legal probability?0 ≤ x ≤ 10.861 ✓
Is EAT between hit and miss cost?100 ≤ 125 ≤ 280✓
Back-substitute0.861 × 100 + 0.139 × 280≈ 125 ns ✓
Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book writes EAT = [x*(m₁+m₂)] + [(1-x)*(c+m₁+m₂)] and then substitutes 125 = (280x) + (460-460x), giving 180x = 335 and x = 1.86 (Hit Ratio). A hit ratio of 1.86 is impossible — it is larger than 1 — because the book double-counted the associative-register time on both branches (hit 280, miss 460), which also makes the target 125 ns unreachable. With the correct costs of 100 ns (hit) and 280 ns (miss) the required hit ratio is x ≈ 0.861.

Verification line: hit 100 < EAT 125 < miss 280 ✓ · x = 155/180 = 0.861 ✓ · 0.861 × 100 + 0.139 × 280 = 86.1 + 38.9 = 125 ns ✓.

4. Page Replacement

Frame traces

All ten reference strings on this page at a glance

Fault counts are the independently re-solved values. Bold = the minimum for that string. ✅ = printed source agrees · ❌ = printed source disagrees · ⚠ = printed source answer not usable.

#Paper · questionFramesFIFOLRUOptimalBest
P1Oct-2024 Mid Q.2(b) · 18 refs313 ❌12 ✅9 ✅Optimal
P2Jan-2024 End Q.5(b) · 20 refs41088LRU = Optimal
P3Dec-2024 End Q.5(a) ≡ Nov-2023 Mid Q.2(a) · 20 refs316 ✅15 ✅11 ✅Optimal
P4Oct-2025 Mid Q.4(b) · 12 refs39 ✅10 ✅7 ✅Optimal
P5Dec-2025 End Q.4(b) · 18 refs (letters)413 ✅10 ✅8 ✅Optimal
P6Feb-2019 Q.3(b) · 15 refs, Optimal only3——8 ✅Optimal (only one asked)
P7Jun-2019 Q.3(b) · 20 refs3—18 ✅13 ✅Optimal (MFU 15 ❌)
P8Feb-2018 Q.3(b) · 10 refs, LRU only3—6 ✅—LRU (only one asked)
P9May-2016 Q.3(a) · 20 refs314 ✅11 ✅—LRU (of the two asked)
P10Jul-2023 End Q.3(c) · 20 refs41088LRU = Optimal · the Belady string
RuleWhat to write
FaultThe referenced page is not resident → load it (a frame may have to be evicted). The first k distinct pages of any string are always faults when the k frames start empty.
HitThe page is already resident → no load, no replacement.
Hits + faults= number of references. Use it as the arithmetic check on every trace.
Hit ratiohits ÷ references · Fault ratio = faults ÷ references = 1 − hit ratio
Replacement victimFIFO = the page loaded longest ago · LRU = the page unused for longest · Optimal = the page not needed for longest in the future (not implementable; it is the yardstick).
Unit II · Page replacement numerical · headline

Consider the page reference string: 1, 0, 7, 1, 0, 2, 1, 2, 3, 0, 3, 2, 4, 0, 3, 6, 2, 1 for a memory with three frames. Determine the number of page faults using the FIFO, Optimal, and LRU replacement algorithms. Which algorithm is most efficient?

Recent PYQ — must do Mid Term Oct 2024 · Q.2(b) 5 Marks Very high
Show answer

Given data

ItemValue
Reference string (18 references)1, 0, 7, 1, 0, 2, 1, 2, 3, 0, 3, 2, 4, 0, 3, 6, 2, 1
Frames3, all initially empty
AlgorithmsFIFO, Optimal, LRU

FIFO — frame-by-frame trace

Victim = the page that has been resident longest. Faults land on references 1, 2, 3, 6, 7, 9, 10, 12, 13, 15, 16, 17, 18.

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Page
1
0
7
1
0
2
1
2
3
0
3
2
4
0
3
6
2
1
F1
1
1
1
1
1
2
2
2
2
0
0
0
0
0
3
3
3
1
F2
–
0
0
0
0
0
1
1
1
1
1
2
2
2
2
6
6
6
F3
–
–
7
7
7
7
7
7
3
3
3
3
4
4
4
4
2
2
Result
F
F
F
H
H
F
F
H
F
F
H
F
F
H
F
F
F
F

LRU — frame-by-frame trace

Victim = the resident page whose most recent use is furthest back.

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Page
1
0
7
1
0
2
1
2
3
0
3
2
4
0
3
6
2
1
F1
1
1
1
1
1
1
1
1
1
0
0
0
4
4
4
6
6
6
F2
–
0
0
0
0
0
0
0
3
3
3
3
3
0
0
0
2
2
F3
–
–
7
7
7
2
2
2
2
2
2
2
2
2
3
3
3
1
Result
F
F
F
H
H
F
H
H
F
F
H
H
F
F
F
F
F
F

Optimal — frame-by-frame trace

Victim = the resident page whose next use is furthest in the future (or never again). Look ahead in the string before every replacement.

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Page
1
0
7
1
0
2
1
2
3
0
3
2
4
0
3
6
2
1
F1
1
1
1
1
1
1
1
1
3
3
3
3
3
3
3
6
2
1
F2
–
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
F3
–
–
7
7
7
2
2
2
2
2
2
2
4
4
4
4
4
4
Result
F
F
F
H
H
F
H
H
F
H
H
H
F
H
H
F
F
F

Results

18 references, 3 frames
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
FIFO1355 ÷ 18 = 0.27813 ÷ 18 = 0.72212 ❌
LRU1266 ÷ 18 = 0.33312 ÷ 18 = 0.66712 ✅
Optimal999 ÷ 18 = 0.5009 ÷ 18 = 0.5009 ✅

Most efficient: Optimal with 9 faults (fault ratio 0.500), then LRU with 12, then FIFO with 13. Optimal is a benchmark only — it needs the future, so it cannot be implemented; among the implementable policies on this string the better one is LRU.

Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. For FIFO the book's own step table lists 13 rows marked "Yes" (a fault) and then writes "Total Page Faults (FIFO) = 12". The re-solved trace above faults 13 times and the printed table itself contains those 13 fault rows, so 13 is the answer to publish, not 12. LRU = 12 and Optimal = 9 are printed correctly and are confirmed.

Verification line: FIFO 13 faults + 5 hits = 18 references ✓ · LRU 12 + 6 = 18 ✓ · Optimal 9 + 9 = 18 ✓ · Optimal ≤ LRU ≤ FIFO on this string, as the ratios show.

Unit II · Page replacement numerical · headline

Consider there are 3 frames allocated to a process and the page reference string is: 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6. How many page faults would occur for the FIFO, LRU and OPTIMAL page replacement algorithms?

Recent PYQ — must do End Term Dec 2024 · Q.5(a) 6.5 Marks Very high
Asked in: Dec-2024 End Q.5(a) (6.5 marks) and Nov-2023 Mid Q.2(a) — the Nov-2023 copy prints the same string but is cut off at the page gutter and points here ("Refer Q5(a) End Term Exam Dec. 2024"). The identical string also appears as Feb-2017 Q.2(b) and May–June 2017 Q.3(a) (5 marks), where the printed answers are FIFO 16, LRU 15, Optimal 11.
Show answer

Given data

ItemValue
Reference string (20 references)1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6
Frames3, all initially empty
Distinct pages1, 2, 3, 4, 5, 6, 7 → 7 different pages must pass through 3 frames

FIFO — frame-by-frame trace

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Page
1
2
3
4
2
1
5
6
2
1
2
3
7
6
3
2
1
2
3
6
F1
1
1
1
4
4
4
4
6
6
6
6
3
3
3
3
2
2
2
2
6
F2
–
2
2
2
2
1
1
1
2
2
2
2
7
7
7
7
1
1
1
1
F3
–
–
3
3
3
3
5
5
5
1
1
1
1
6
6
6
6
6
3
3
Result
F
F
F
F
H
F
F
F
F
F
H
F
F
F
H
F
F
H
F
F

LRU — frame-by-frame trace

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Page
1
2
3
4
2
1
5
6
2
1
2
3
7
6
3
2
1
2
3
6
F1
1
1
1
4
4
4
5
5
5
1
1
1
7
7
7
2
2
2
2
2
F2
–
2
2
2
2
2
2
6
6
6
6
3
3
3
3
3
3
3
3
3
F3
–
–
3
3
3
1
1
1
2
2
2
2
2
6
6
6
1
1
1
6
Result
F
F
F
F
H
F
F
F
F
F
H
F
F
F
H
F
F
H
H
F

Optimal — frame-by-frame trace

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Page
1
2
3
4
2
1
5
6
2
1
2
3
7
6
3
2
1
2
3
6
F1
1
1
1
1
1
1
1
1
1
1
1
3
3
3
3
3
3
3
3
6
F2
–
2
2
2
2
2
2
2
2
2
2
2
7
7
7
2
2
2
2
2
F3
–
–
3
4
4
4
5
6
6
6
6
6
6
6
6
6
1
1
1
1
Result
F
F
F
F
H
H
F
F
H
H
H
F
F
H
H
F
F
H
H
F

Results

20 references, 3 frames
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
FIFO1644 ÷ 20 = 0.20016 ÷ 20 = 0.80016 ✅
LRU1555 ÷ 20 = 0.25015 ÷ 20 = 0.75015 ✅
Optimal1199 ÷ 20 = 0.45011 ÷ 20 = 0.55011 ✅

Best: Optimal (11 faults). Between the two implementable policies, LRU (15) beats FIFO (16) on this string — the locality of 2, 1, 2 in the middle of the string is exactly what LRU exploits and FIFO ignores.

Verification note Verification note: the printed source result agrees with all three re-solved counts (FIFO 16, LRU 15, Optimal 11), and the printed frame grids reproduce cell for cell. This is the one headline page-replacement question in the set with no arithmetic error in it.

Verification line: 16 + 4 = 20 ✓ · 15 + 5 = 20 ✓ · 11 + 9 = 20 ✓ · hits are the references that repeat a resident page: FIFO hits at references 5, 11, 15, 18.

Unit II · Page replacement numerical · headline

Consider the Reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5, with 3 available page frames. Calculate the number of page faults using the following page replacement techniques: (i) LRU (ii) Optimal (iii) FIFO

Recent PYQ — must do Mid Term Oct 2025 · Q.4(b) 5 Marks Very high
Show answer

Given data

ItemValue
Reference string (12 references)1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
Frames3, initially empty

FIFO — frame-by-frame trace

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
Page
1
2
3
4
1
2
5
1
2
3
4
5
F1
1
1
1
4
4
4
5
5
5
5
5
5
F2
–
2
2
2
1
1
1
1
1
3
3
3
F3
–
–
3
3
3
2
2
2
2
2
4
4
Result
F
F
F
F
F
F
F
H
H
F
F
H

LRU — frame-by-frame trace

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
Page
1
2
3
4
1
2
5
1
2
3
4
5
F1
1
1
1
4
4
4
5
5
5
3
3
3
F2
–
2
2
2
1
1
1
1
1
1
4
4
F3
–
–
3
3
3
2
2
2
2
2
2
5
Result
F
F
F
F
F
F
F
H
H
F
F
F

Optimal — frame-by-frame trace

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
Page
1
2
3
4
1
2
5
1
2
3
4
5
F1
1
1
1
1
1
1
1
1
1
3
4
4
F2
–
2
2
2
2
2
2
2
2
2
2
2
F3
–
–
3
4
4
4
5
5
5
5
5
5
Result
F
F
F
F
H
H
F
H
H
F
F
H

Results

12 references, 3 frames
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
FIFO933 ÷ 12 = 0.2509 ÷ 12 = 0.7509 ✅
LRU1022 ÷ 12 = 0.16710 ÷ 12 = 0.83310 ✅
Optimal755 ÷ 12 = 0.4177 ÷ 12 = 0.5837 ✅

Best: Optimal (7 faults). Note the teaching point of this string: LRU is worse than FIFO here (10 vs 9). LRU is not guaranteed to beat FIFO on every string — it is a stack algorithm that rewards recent use, and the loop 1, 2, … 1, 2 keeps refreshing exactly the pages FIFO was about to throw away.

Verification note Verification note: the printed source result agrees — FIFO 9, LRU 10, Optimal 7 are the printed figures and all three are reproduced by the independent re-simulation.

Verification line: 9 + 3 = 12 ✓ · 10 + 2 = 12 ✓ · 7 + 5 = 12 ✓ · Optimal's hits are at references 5, 6, 8, 9 and 12.

Unit II · Page replacement numerical

Consider the following reference string 5, 6, 1, 2, 6, 3, 6, 4, 2, 3, 6, 3, 2, 1, 2, 6, 1, 5, 6, 1. Find the number of Page Faults with FIFO, Optimal Page replacement and LRU with four free frames which are empty initially. Which algorithm gives the minimum number of page faults?

Recent PYQ — must do End Term Jan 2024 · Q.5(b) 8 Marks Very high
Show answer

Given data

ItemValue
Reference string (20 references)5, 6, 1, 2, 6, 3, 6, 4, 2, 3, 6, 3, 2, 1, 2, 6, 1, 5, 6, 1
Frames4, all initially empty
Distinct pages1, 2, 3, 4, 5, 6 → 6

Results (frame-by-frame trace: fill the four frames with 5, 6, 1, 2 over the first four references, then replace by FIFO order / least-recently-used / farthest-future-use respectively)

20 references, 4 frames
AlgorithmPage faultsHitsHit ratioFault ratio
FIFO101010 ÷ 20 = 0.50010 ÷ 20 = 0.500
LRU81212 ÷ 20 = 0.6008 ÷ 20 = 0.400
Optimal81212 ÷ 20 = 0.6008 ÷ 20 = 0.400

Answer to "which gives the minimum": LRU and Optimal tie at 8 faults — do not write "Optimal alone". On this string the implementable policy (LRU) already reaches the optimal bound, and FIFO is two faults worse.

Verification note Verification note: the printed source result appears inconsistent, and the solution above was independently recalculated. The book prints a single frame trace although three algorithms are asked, its column headings ("Page | Frame | String | Page Fault") do not match the columns it actually prints, and it concludes "Page faults 16." No re-solved algorithm on 4 frames reaches 16 on this string: the correct totals are FIFO 10, LRU 8, Optimal 8.

Verification line: 10 + 10 = 20 ✓ · 8 + 12 = 20 ✓ · 8 + 12 = 20 ✓ · minimum possible faults ≥ number of distinct pages = 6, and both LRU and Optimal land just above it.

Unit II · Page replacement numerical

Consider the following page Reference string A, B, C, D, B, A, E, F, B, A, B, C, E, G, C, B, A, B. How many page faults would occur for the following page replacement algorithms assuming four available frames? All frames are initially empty: (i) LRU (ii) FIFO (iii) Optimal page replacement.

Recent PYQ End Term Dec 2025 · Q.4(b) Marks: not clearly visible High
Asked in: End Term Dec 2025 · Q.4(b) (6 marks). Printed answers in the book: FIFO 13, LRU 10, Optimal 8 — all three reproduce exactly under independent simulation.
Show answer

Given data

ItemValue
Reference string (18 references)A, B, C, D, B, A, E, F, B, A, B, C, E, G, C, B, A, B
Frames4, initially empty
Distinct pagesA, B, C, D, E, F, G → 7

Results

18 references, 4 frames
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
FIFO1355 ÷ 18 = 0.27813 ÷ 18 = 0.72213 ✅
LRU1088 ÷ 18 = 0.44410 ÷ 18 = 0.55610 ✅
Optimal81010 ÷ 18 = 0.5568 ÷ 18 = 0.4448 ✅

Best: Optimal (8 faults, hit ratio 0.556). LRU is the best implementable choice here with 10; FIFO pays for ignoring the fact that A and B dominate the string.

Verification note Verification note: the printed source result agrees — FIFO 13, LRU 10, Optimal 8 are exactly the printed figures and all three are reproduced by the independent simulation.

Verification line: 13 + 5 = 18 ✓ · 10 + 8 = 18 ✓ · 8 + 10 = 18 ✓ · D, F and G appear once or twice, so they are the pages every algorithm keeps evicting.

Unit II · Page replacement numerical · includes MFU

Consider the following page reference string: 7, 2, 3, 1, 2, 5, 3, 4, 6, 7, 7, 1, 0, 5, 4, 6, 2, 3, 0, 1. Assuming demand paging with three frames, how many page faults wcould occur for the following replacement algorithms? (i) LRU replacement (ii) MFU replacement (iii) Optimal replacement

Older PYQ — important variant End Term Jun 2019 · Q.3(b) 5 Marks Medium
wcould is the book's own typo, reproduced as printed. MFU = Most Frequently Used: evict the resident page with the highest reference count so far.
Show answer

Given data

ItemValue
Reference string (20 references)7, 2, 3, 1, 2, 5, 3, 4, 6, 7, 7, 1, 0, 5, 4, 6, 2, 3, 0, 1
Frames3, initially empty
AlgorithmsLRU, MFU, Optimal

Results

20 references, 3 frames
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
LRU1822 ÷ 20 = 0.10018 ÷ 20 = 0.90018 ✅
MFU1555 ÷ 20 = 0.25015 ÷ 20 = 0.75014 ❌
Optimal1377 ÷ 20 = 0.35013 ÷ 20 = 0.65013 ✅

Best: Optimal (13). Of the implementable ones MFU (15) beats LRU (18) on this string, which is a good illustration of why MFU exists as a counter-example: a page referenced very often in the past may never be needed again, and MFU throws it out precisely for that reason.

Verification note Verification note: the printed source result appears inconsistent for the MFU part, and the trace was independently re-simulated. The book states 14 page faults for MFU (its printed working reads 11 + III = 14 Page fault); re-running the count-based victim choice frame by frame gives 15 faults and 5 hits (15 + 5 = 20 references). LRU = 18 and Optimal = 13 are printed correctly and confirmed.

Verification line: 18 + 2 = 20 ✓ · 15 + 5 = 20 ✓ · 13 + 7 = 20 ✓ · the string has 8 distinct pages (0–7) passing through 3 frames, so a fault count this high is expected.

Unit II · Page replacement numerical · Optimal only

Calculate total number of page fault that will occur while processing the page reference string given below: 4, 6, 7, 1, 6, 7, 1, 2, 6, 2, 0, 3, 1, 4, 2 using Optimal page replacement policy, when page frames are Three.

Older PYQ — syllabus gap First Term Feb 2019 · Q.3(b) 5 Marks Medium
Show answer

Given data

ItemValue
Reference string (15 references)4, 6, 7, 1, 6, 7, 1, 2, 6, 2, 0, 3, 1, 4, 2
Frames3, initially empty
PolicyOptimal only

Optimal working (how to choose the victim at each fault)

  1. Load 4, 6, 7 on references 1–3 → 3 faults, frames {4, 6, 7}.
  2. Reference 4 (page 1): 6 and 7 are needed again at references 5 and 6, page 4 not until 14 → evict 4, load 1 → fault 4.
  3. References 5–7 (6, 7, 1) are all hits — the pages Optimal chose to keep.
  4. Reference 8 (page 2): frames hold 6, 7, 1. 6 is needed at 9, 1 at 13, 7 never again → evict 7 → fault 5.
  5. Reference 9 (6) hit · reference 10 (2) hit · reference 11 (0): frames 6, 1, 2 — 6 never used again → evict 6 → fault 6.
  6. Reference 12 (3): frames 0, 1, 2 — 2 next at 15, 1 at 13, 0 never again → evict 0 → fault 7.
  7. References 13 (1) and 14 (4): frames 3, 1, 2 — 3 never used again → evict 3, load 4 → fault 8; page 1 is a hit.
  8. Reference 15 (2) hit. Total = 8 page faults.
15 references, 3 frames, Optimal
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
Optimal877 ÷ 15 = 0.4678 ÷ 15 = 0.5338 ✅

Best (and only policy asked): Optimal, 8 faults. Since Optimal is a lower bound for any replacement policy on this string, no FIFO or LRU run can do better than 8 here.

Verification note Verification note: the printed source result agrees — the book states "total no. of page faults = 8" and the re-simulated trace gives 8 faults / 7 hits. (The book's small trace boxes have some unreadable column digits Scan unclear — verify from the original PDF, but the string, the frame count and the total are legible.)

Verification line: 8 + 7 = 15 references ✓ · faults at references 1, 2, 3, 4, 8, 11, 12, 14 and hits at 5, 6, 7, 9, 10, 13, 15.

Unit II · Page replacement numerical · LRU only

Calculate total number of page fault that will occur while processing the page reference string given below : 4,7,6,1,7,6,1,2,7,2, using LRU page replacement policy, when page frames are three.

Older PYQ — syllabus gap First Term Feb 2018 · Q.3(b) 5 Marks Medium
Show answer

Given data

ItemValue
Reference string (10 references)4, 7, 6, 1, 7, 6, 1, 2, 7, 2
Frames3, initially empty
PolicyLRU only

LRU working

RefPageFrames afterResultVictim chosen
144, –, –Ffilling
274, 7, –Ffilling
364, 7, 6Ffilling
414, 7, 6 → 1 replaces 4F4 (least recently used)
571, 7, 6H—
661, 7, 6H—
711, 7, 6H—
822 replaces 7  (7 used longest ago of 7, 6, 1)F7
977 replaces 6F6
1021, 7, 2H—
10 references, 3 frames, LRU
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
LRU644 ÷ 10 = 0.4006 ÷ 10 = 0.6006 ✅

Best of what is asked: LRU with 6 faults (hits at references 5, 6, 7, 10).

Verification note Verification note: the printed source result agrees — "total no. of page faults = 6" is reproduced exactly. The book's own 3-row grid on that page is partly illegible Scan unclear — verify from the original PDF, so the table above was rebuilt from the LRU rule rather than copied.

Verification line: 6 + 4 = 10 references ✓ · faults at references 1, 2, 3, 4, 8, 9.

Unit II · Page replacement numerical (printed as an illustration)

Explain any two page replacements algorithms. Give an illustration. [Illustration printed with the answer: "e.g. consider frame size = 3", reference string 1, 2, 3, 2, 1, 5, 2, 1, 6, 2, 5, 6, 3, 1, 3, 6, 1, 2, 4, 3]

Older PYQ — syllabus gap End Term May 2016 · Q.3(a) 5 Marks Medium
Note: the string is not given in the question stem — it is the worked illustration printed inside the answer, with the totals "FIFO — Total 14 page faults" and "LRU — Total 11 page faults".
Show answer

Given data

ItemValue
Reference string (20 references)1, 2, 3, 2, 1, 5, 2, 1, 6, 2, 5, 6, 3, 1, 3, 6, 1, 2, 4, 3
Frames3, initially empty

Results

20 references, 3 frames
AlgorithmPage faultsHitsHit ratioFault ratioPrinted in the book
FIFO1466 ÷ 20 = 0.30014 ÷ 20 = 0.70014 ✅
LRU1199 ÷ 20 = 0.45011 ÷ 20 = 0.55011 ✅

Best of the two: LRU (11 faults). FIFO faults at references 1, 2, 3, 6, 8, 9, 10, 11, 13, 14, 16, 18, 19 and 20 — fourteen of them. LRU keeps 1, 2 and 3 resident through the busy middle of the string, which is where its three extra hits come from.

Verification note Verification note: the printed source result agrees. The independent simulation reproduces the printed FIFO frame rows cell for cell (14 faults) and the LRU total of 11, which is also what corroborates the transcription of the string from the scan.

Verification line: 14 + 6 = 20 ✓ · 11 + 9 = 20 ✓ · distinct pages 1, 2, 3, 4, 5, 6 = 6, so at least 6 faults are unavoidable.

Unit II · Page replacement numerical

Consider there are 4 frames allocated to a process and the page reference string is: 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 Calculate the number of page faults for the FIFO and LRU page replacement algorithms.

Older PYQ — important variant End Term Jul 2023 · Q.3(c) 6.5 Marks High
Show answer

Given data

ItemValue
Reference string (20 references)7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1
Frames4, initially empty
AskedFIFO and LRU

Results

20 references, 4 frames
AlgorithmPage faultsHitsHit ratioFault ratioBest
FIFO101010 ÷ 20 = 0.50010 ÷ 20 = 0.500—
LRU81212 ÷ 20 = 0.6008 ÷ 20 = 0.400tie
Optimal (extra, not asked)8120.6000.400tie
MFU (extra, not asked)1377 ÷ 20 = 0.35013 ÷ 20 = 0.650worst

Best of the two asked: LRU (8 faults). Optimal also reaches 8, so LRU is at the theoretical lower bound on this string.

Verification note Verification note: the notes record no printed total for this question's FIFO and LRU columns (only the question, the string and the frame count are legible), so there is nothing to compare against. The figures above are the independently re-simulated values. This is the classic textbook string used to demonstrate Belady's anomaly — see the card below.

Verification line: 10 + 10 = 20 ✓ · 8 + 12 = 20 ✓ · distinct pages 0, 1, 2, 3, 4, 7 = 6 ≤ 20 references, so 8 faults is close to the floor of 6.

Unit II · Belady's anomaly · older-paper only demonstration

What is Belady's Anomaly? Explain with the help of suitable examples.

Older PYQ — important variant End Term Jul 2016 · Q.2(c) Marks: not clearly visible Safety
Older-only: this demonstration is taken from the Jul-2016 paper's own example (also the Feb-2017 Q.1(d) "What is Belady's Anomaly", 2.5 marks). No 2023–2025 paper asks it as a numerical, so treat it as insurance, not as a must-do.
Show answer

Belady's anomaly is the counter-intuitive behaviour of the FIFO page-replacement algorithm in which increasing the number of allocated page frames can increase the number of page faults. LRU does not suffer from it because it is a stack algorithm: the pages held with k frames are always a subset of those held with k+1 frames. Named after L. A. Belady, who reported it in 1969.

Given data

ItemValue
Reference string (12 references)3, 2, 1, 0, 3, 2, 4, 3, 2, 1, 0, 4
Case 1 frames3, initially empty
Case 2 frames4, initially empty
AlgorithmFIFO in both cases — only the frame count changes

Case 1 — FIFO with 3 frames → 9 page faults

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
Page
3
2
1
0
3
2
4
3
2
1
0
4
F1
3
3
3
0
0
0
4
4
4
4
4
4
F2
–
2
2
2
3
3
3
3
3
1
1
1
F3
–
–
1
1
1
2
2
2
2
2
0
0
Result
F
F
F
F
F
F
F
H
H
F
F
H

Case 2 — FIFO with 4 frames → 10 page faults

Ref #
1
2
3
4
5
6
7
8
9
10
11
12
Page
3
2
1
0
3
2
4
3
2
1
0
4
F1
3
3
3
3
3
3
4
4
4
4
0
0
F2
–
2
2
2
2
2
2
3
3
3
3
4
F3
–
–
1
1
1
1
1
1
2
2
2
2
F4
–
–
–
0
0
0
0
0
0
1
1
1
Result
F
F
F
F
H
H
F
F
F
F
F
F

The anomaly, side by side

FramesFIFO faultsHitsHit ratioFault ratio
3933 ÷ 12 = 0.2509 ÷ 12 = 0.750
4 (more memory)1022 ÷ 12 = 0.16710 ÷ 12 = 0.833

One extra frame costs one extra fault. Reading the two traces: with 3 frames the reference to page 3 at step 8 is a hit, because 3 is still resident; with 4 frames the loading pattern has shifted and 3 was replaced at step 7, so the same reference faults. Mark the difference in columns 7–8 of the two grids and the point makes itself.

Which is best overall on this string? Neither FIFO case makes the point — the anomaly is exactly the argument for the stack property: LRU and Optimal can never fault more often when frames are added, because the set of pages resident with k frames is always contained in the set resident with k+1 frames. FIFO has no such guarantee, which is why its fault count went up from 9 to 10 above.

Verification note Verification note: the printed source figure for this example is reproduced and confirmed ("In the first example (with fewer pages), there are 9 page faults" and 10 for the second), although the sentence as printed is garbled — it reads "…there are 9 page faults, there are 10 page faults" in one line, and the interior rows of the book's two frame stacks are misaligned in the scan Scan unclear — verify from the original PDF. Both grids above were rebuilt from the FIFO rule and independently re-simulated: 9 faults at 3 frames, 10 at 4 frames.

Verification line: Case 1 → 9 + 3 = 12 ✓ · Case 2 → 10 + 2 = 12 ✓ · the only requirement for demonstrating the anomaly is the same string, same algorithm, more frames, more faults.

Numericals Practice Checklist

Track

Ticks are saved in this browser and survive a refresh. Progress also feeds the dashboard.