OS Exam Kit

Score-focused layer: solved formats, marking pattern guidance, algorithm workflows, and diagram expectations.

CPU scheduling solved numericals

Exam-style working format with formulas and table output.

⚠️ Added for clarity (not directly from source): this layer is optimized for exam scoring patterns.

FCFS worked example

PATBTCTTATWT
P105550
P213874
P3221086

Gantt: P1 (0-5) -> P2 (5-8) -> P3 (8-10)

  • - WT = Start Time - Arrival Time
  • - TAT = Completion Time - Arrival Time

Round Robin (q=2)

Gantt pattern: P1 -> P2 -> P3 -> P1 -> P2 -> P1

Always show queue rotation and remaining burst after every quantum.

SJF / SRTN / Priority

  • - SJF: choose shortest burst among arrived processes.
  • - SRTN: at each arrival/time unit choose shortest remaining burst.
  • - Priority: lower number often means higher priority (state convention).

Algorithm-specific exam workflows

Banker algorithm

  1. 1. Need = Max - Allocation
  2. 2. Pick process with Need <= Available
  3. 3. Release allocation and continue for safe sequence
  4. 4. For request: check Request<=Need, Request<=Available, and safety

Page replacement

  • - FIFO: remove oldest page
  • - LRU: remove least recently used
  • - Optimal: remove farthest future use
  • - Clock: circular pointer + reference bit

Always include frame table and page-fault count.

Disk scheduling

  • - FCFS: arrival order
  • - SSTF: nearest track first
  • - SCAN/C-SCAN: sweep model
  • - LOOK/C-LOOK: sweep only till last request

Always draw head movement path and compute total distance.

Diagram discipline

  • - Use clean boxes and arrows
  • - Label every component clearly
  • - Mention state names and transitions exactly
  • - Keep diagram readable and aligned

⚠️ Added for clarity (not directly from source): this section is optimized for exam scoring, not for complete theoretical depth.

Banker algorithm matrices

Write each answer in Allocation, Max, Available format and derive Need matrix first.

Solved example with expected safe sequence

Allocation

PABC
P0010
P1200
P2302
P3211
P4002

Max

PABC
P0753
P1322
P2902
P3222
P4433

Available: (3, 3, 2)

Expected safe sequence: P1 to P3 to P4 to P0 to P2

Practice matrix A (safe)

Available: (2, 2, 1)

Task: compute Need matrix, check safety, then test one request vector.

Practice matrix B (safe)

Available: (1, 1, 1)

Task: compute Need matrix, check safety, then test one request vector.

Practice matrix C (unsafe candidate)

Available: (0, 0, 0)

Unsafe candidate: verify no safe sequence case.

Task: compute Need matrix, check safety, then test one request vector.

Practice matrix D (safe)

Available: (1, 1, 1)

Task: compute Need matrix, check safety, then test one request vector.

Practice matrix E (4 resources)

Available: (1, 1, 1, 1)

Task: compute Need matrix, check safety, then test one request vector.

Page replacement reference sets

Show frame table and page-fault count for FIFO, LRU, and Optimal in every answer.

Frames = 3

Reference: 7, 0, 1, 2, 0, 3, 0, 4

FIFO: 7
LRU: 6
OPT: 6

Frames = 3

Reference: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

FIFO: 9
LRU: 10
OPT: 7

Frames = 3

Reference: 2, 3, 2, 1, 5, 2, 4, 5, 3, 2, 5, 2

FIFO: 8
LRU: 7
OPT: 6

Frames = 3

Reference: 0, 2, 1, 6, 4, 0, 1, 0, 3, 1, 2

FIFO: 9
LRU: 8
OPT: 7

Frames = 4

Reference: 1, 3, 0, 3, 5, 6, 3, 1, 0, 3, 2, 1, 2

FIFO: 8
LRU: 7
OPT: 6

Frames = 3

Reference: 4, 7, 6, 1, 7, 6, 1, 2, 7, 2, 6, 1, 2

FIFO: 7
LRU: 6
OPT: 6

Frames = 3

Reference: 2, 1, 2, 3, 7, 6, 3, 2, 1, 2, 3, 6

FIFO: 10
LRU: 9
OPT: 7

Frames = 3

Reference: 5, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3

FIFO: 9
LRU: 8
OPT: 7

Frames = 4

Reference: 3, 2, 1, 0, 3, 2, 4, 3, 2, 1, 0, 4

FIFO: 7
LRU: 6
OPT: 5

Frames = 3

Reference: 1, 2, 1, 3, 1, 4, 1, 5, 1, 2, 1, 3

FIFO: 8
LRU: 6
OPT: 6

Frames = 4

Reference: 6, 5, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1

FIFO: 12
LRU: 12
OPT: 8

Frames = 3

Reference: 0, 1, 2, 3, 0, 1, 4, 0, 1, 2, 3, 4

FIFO: 9
LRU: 10
OPT: 7

Disk scheduling solved and practice cases

Always mention initial head, direction, service order, head-movement path, and final total.

Head: 53Direction: left

Queue: 98, 183, 37, 122, 14, 124, 65, 67

FCFS: 640
SSTF: 236
SCAN: 208
C-SCAN: 322
LOOK: 208
C-LOOK: 322
Head: 50Direction: left

Queue: 176, 79, 34, 60, 92, 11, 41, 114

FCFS: 510
SSTF: 204
SCAN: 226
C-SCAN: 340
LOOK: 204
C-LOOK: 314
Head: 100Direction: left

Queue: 55, 58, 39, 18, 90, 160, 150, 38, 184

FCFS: 498
SSTF: 248
SCAN: 250
C-SCAN: 388
LOOK: 248
C-LOOK: 358
Head: 35Direction: right

Queue: 40, 10, 50, 90, 20, 70, 30

FCFS: 235
SSTF: 115
SCAN: 154
C-SCAN: 198
LOOK: 115
C-LOOK: 165
Head: 50Direction: right

Queue: 82, 170, 43, 140, 24, 16, 190

FCFS: 642
SSTF: 208
SCAN: 334
C-SCAN: 390
LOOK: 314
C-LOOK: 366
Head: 50Direction: left

Queue: 95, 180, 34, 119, 11, 123, 62, 64

FCFS: 644
SSTF: 230
SCAN: 204
C-SCAN: 318
LOOK: 204
C-LOOK: 314
Head: 85Direction: right

Queue: 38, 130, 10, 150, 90, 170, 50

FCFS: 525
SSTF: 225
SCAN: 303
C-SCAN: 371
LOOK: 245
C-LOOK: 335
Head: 60Direction: left

Queue: 15, 85, 45, 5, 125, 95, 155, 65

FCFS: 540
SSTF: 200
SCAN: 215
C-SCAN: 309
LOOK: 205
C-LOOK: 287
Head: 90Direction: right

Queue: 100, 40, 180, 20, 160, 80, 60

FCFS: 510
SSTF: 220
SCAN: 269
C-SCAN: 359
LOOK: 230
C-LOOK: 340
Head: 40Direction: right

Queue: 49, 68, 90, 24, 150, 16, 170

FCFS: 463
SSTF: 194
SCAN: 253
C-SCAN: 329
LOOK: 184
C-LOOK: 274

Typical marking pattern

2 marks

Expectation: Definition accuracy

Structure: One-line definition + 2-3 bullets

4 marks

Expectation: Concept clarity

Structure: Definition + short explanation + tiny example or mini diagram

7 marks

Expectation: Complete explanation

Structure: Definition + labeled diagram + working/algorithm + merits/demerits

14 marks

Expectation: Full long answer

Structure: Detailed concept + diagram + worked example + comparison + conclusion

Typical marking scheme breakdown

Numerical (4-7 marks)

  • - Formula / concept: 1
  • - Table / setup: 1-2
  • - Calculation steps: 2-3
  • - Final answer: 1

Theory (7-14 marks)

  • - Definition: 1-2
  • - Diagram: 2-3
  • - Explanation: 3-5
  • - Conclusion / comparison: 1-2

Exam-oriented guidance

Diagram expectations

  • - Process State Diagram
  • - PCB Structure
  • - Paging and Page Table
  • - System Call Flow
  • - Monolithic vs Layered OS

Faculty answer tricks

  • - Use exact keywords: Starvation, Throughput, Turnaround Time, Response Time
  • - Write with underlined headings and bullet points
  • - For numericals, show all intermediate steps even if final number is known

Common repeated patterns

  • - CPU scheduling tables with 3 to 5 processes appear repeatedly
  • - Page replacement reference strings (for example: 7, 0, 1, 2, 0, 3, 0, 4) recur often
  • - Banker matrix format always uses Allocation, Max, Available

Quick strategy

  • - Always draw Gantt chart in scheduling questions
  • - Always write formulas before substitutions
  • - Always label diagrams with arrows and field names
  • - Partial steps still fetch marks

⚠️ Added for clarity (not directly from source): Exam-oriented shortcuts help scoring, but combine them with concept understanding to avoid brittle answers.