Important Questions

BIT204 · Exam intelligence

Operating Systems important questions

From 5 past TU papers: which questions keep coming back, how much they carry, and what is most likely to show up next. Every question links to a model answer.

Most likely in the next examStatistical

Ranked by how often a topic is asked, its marks weight, and whether it is due after skipping the 2082 paper. No guarantees; study the whole syllabus.

1asked 3xavg 8 marks · due (skipped 2082) · Disk scheduling algorithms
Answer

Suppose that a disk drive has the cylinder numbered, 0 to 199 is currently serving a request at cylinder 143. The request queue is kept in the FIFO order 25, 17, 119, 197, 194, 15, 182, 115, and 183. What is the total head movement needed to satisfy these request for the following disk scheduling algorithm.

a) FCFS

b) SSTF [5]

Disk Scheduling: FCFS and SSTF

Given Data

  • Cylinder range: 0 to 199
  • Current head position: 143
  • Request queue (FIFO): 25, 17, 119, 197, 194, 15, 182, 115, 183

a) FCFS (First Come First Served)

Service order: 143 → 25 → 17 → 119 → 197 → 194 → 15 → 182 → 115 → 183

FromToDistance
14325118
25178
17119102
11919778
1971943
19415179
15182167
18211567
11518368

$$\text{Total} = 118+8+102+78+3+179+167+67+68 = 790$$

FCFS total head movement = 790 cylinders


b) SSTF (Shortest Seek Time First)

Always move to the nearest pending request.

At every step the head jumps to whichever pending cylinder is closest, so the distances to all remaining requests are compared before each move.

CurrentNearest pending optionsChosenDistance
143119 (24), 115 (28), 182 (39)11924
119115 (4), 182 (63), 183 (64)1154
115182 (67), 183 (68), 25 (90)18267
182183 (1), 194 (12), 197 (15)1831
183194 (11), 197 (14)19411
194197 (3), 25 (169)1973
19725 (172), 17 (180)25172
2517 (8), 15 (10)178
1715 (2)152

Service order: 143 → 119 → 115 → 182 → 183 → 194 → 197 → 25 → 17 → 15

$$\text{Total} = 24+4+67+1+11+3+172+8+2 = 292$$

SSTF total head movement = 292 cylinders

Note that 119 has to be taken before 115, since $|143-119| = 24$ is smaller than $|143-115| = 28$. Servicing 115 first would violate the shortest-seek rule even though the two requests sit close together.


Summary

AlgorithmTotal Head Movement
FCFS790 cylinders
SSTF292 cylinders

SSTF greatly reduces head movement versus FCFS, at the risk of starvation for distant requests.

2asked 2xavg 8 marks · due (skipped 2082) · Translation Lookaside Buffer
Answer

Why virtual memory technique is used in the computer system? What is logical address? Explain the process of conversion of logical address to physical address using TLB.[10]

--- Virtual memory is a memory management technique that allows a computer to execute programs that are larger than the available physical memory (RAM). It creates an illusion of a very large memory space for each process by using a port...

3asked 2xavg 8 marks · due (skipped 2082) · Optimal page replacement algorithm
Answer

Why Optimal Page Replacement is best but not practically feasible page replacement algorithm? Calculate the number of page faults for Optimal, LRU and FIFO replacement algorithm for the reference string: 1, 3, 4, 2, 3, 5, 4, 3, 1, 2, 4, 6, 3, 2, 1, 4, 2 using 3 page frames.[10]

Best: The Optimal (OPT / Belady's) algorithm replaces the page that will not be used for the longest time in the future. This produces the minimum possible number of page faults for any reference string and frame count. It is the theoret...

4asked 2xavg 5 marks · due (skipped 2082) · File Allocation Table
Answer

A 2 GB disk has a 4-KB block size, calculate the size of the file allocation table if each entry of the table is 4 bytes. [5]

Parameter Value ------------------ Disk Size 2 GB Block Size 4 KB FAT Entry Size 4 bytes $$\text{Disk Size} = 2 \text{ GB} = 2 \times 2^{30} = 2^{31} \text{ bytes}$$ $$\text{Block Size} = 4 \text{ KB} = 4 \times 2^{10} = 2^{12} \text{ by...

5asked 2xavg 8 marks · due (skipped 2082) · Types of operating systems
Answer

What are the different types of operating system? Differentiate between Real time and Batch OS.[10]

Types of Operating Systems and Difference Between Real-Time and Batch OS

Types of Operating Systems

An Operating System (OS) is system software that manages hardware and software resources and provides services to computer programs. Operating systems are classified into the following types:


1. Batch Operating System

  • Jobs with similar requirements are grouped (batched) together and executed without user interaction.
  • A job scheduler picks jobs from the batch and submits them to the CPU one by one.
  • Example: Early IBM mainframe systems, payroll processing.

2. Time-Sharing (Multitasking) Operating System

  • CPU time is shared among multiple users/processes simultaneously.
  • Each process gets a small time slice (quantum) in a round-robin fashion.
  • Provides fast response time and interactive use.
  • Example: UNIX, Linux, Windows.

3. Real-Time Operating System (RTOS)

  • Designed to process data and respond within a strict, guaranteed time constraint (deadline).
  • Used in time-critical applications.
  • Example: Air traffic control, medical devices, missile guidance systems, VxWorks.

4. Distributed Operating System

  • Manages a group of independent computers and makes them appear as a single system to the user.
  • Resources (CPU, memory, storage) are distributed across multiple machines.
  • Example: LOCUS, Amoeba.

5. Network Operating System

  • Provides features to manage data, users, groups, security, and applications over a network.
  • Each machine has its own local OS but can share resources over the network.
  • Example: Windows Server, Novell NetWare.

6. Multiprocessor Operating System

  • Supports systems with more than one CPU sharing the same memory and I/O devices.
  • Increases throughput and reliability.
  • Example: Symmetric Multiprocessing (SMP) systems.

7. Embedded Operating System

  • Designed to operate on small machines (embedded systems) with limited resources.
  • Highly specialized and resource-efficient.
  • Example: Android (mobile), FreeRTOS, Windows CE.

8. Mobile Operating System

  • Designed specifically for smartphones and tablets.
  • Manages mobile hardware such as touchscreen, GPS, camera.
  • Example: Android, iOS.

Difference Between Real-Time OS and Batch OS

BasisReal-Time OS (RTOS)Batch OS
DefinitionAn OS that processes tasks and produces results within a strict time deadline.An OS that collects jobs into batches and processes them sequentially without user interaction.
Response TimeExtremely fast and guaranteed (microseconds to milliseconds).Response time is slow and not guaranteed; depends on queue length.
User InteractionMinimal or no user interaction during execution; but system reacts to real-world events.No user interaction once the batch is submitted.
DeadlineStrict deadlines must be met (missing a deadline can cause system failure).No concept of strict deadlines; jobs are processed as resources become available.
PriorityTasks are assigned priorities; high-priority tasks preempt lower ones.Jobs are processed in the order they are batched (FCFS or similar).
SchedulingPriority-based, preemptive scheduling is used.Non-preemptive, sequential scheduling is used.
TypesHard RTOS (strict deadlines) and Soft RTOS (flexible deadlines).Simple batch and multiprogrammed batch.
CPU UtilizationCPU utilization may not be maximum; correctness and timing are more important.Aims for maximum CPU utilization.
Error HandlingMust handle errors immediately and reliably.Errors are reported after job completion; job may be skipped.
ApplicationsMedical devices, missile systems, air traffic control, robotics.Payroll processing, bank statements, weather forecasting data processing.
ComplexityMore complex due to timing constraints and event-driven nature.Relatively simpler to design and implement.
Example SystemsVxWorks, FreeRTOS, QNX.Early IBM OS/360, simple mainframe batch systems.

Summary

Operating systems are classified based on how they manage processes, respond to users, and handle time constraints. Batch OS focuses on throughput and sequential job processing with no real-time constraints, while Real-Time OS focuses on correctness within strict time limits, making it essential for safety-critical and time-sensitive applications.

Most repeated questions

Topics asked at least twice, most-asked first.

asked 3xavg 8 marks · 2080, 2078, 0
Answer

Suppose that a disk drive has the cylinder numbered, 0 to 199 is currently serving a request at cylinder 143. The request queue is kept in the FIFO order 25, 17, 119, 197, 194, 15, 182, 115, and 183. What is the total head movement needed to satisfy these request for the following disk scheduling algorithm.

a) FCFS

b) SSTF [5]

Disk Scheduling: FCFS and SSTF

Given Data

  • Cylinder range: 0 to 199
  • Current head position: 143
  • Request queue (FIFO): 25, 17, 119, 197, 194, 15, 182, 115, 183

a) FCFS (First Come First Served)

Service order: 143 → 25 → 17 → 119 → 197 → 194 → 15 → 182 → 115 → 183

FromToDistance
14325118
25178
17119102
11919778
1971943
19415179
15182167
18211567
11518368

$$\text{Total} = 118+8+102+78+3+179+167+67+68 = 790$$

FCFS total head movement = 790 cylinders


b) SSTF (Shortest Seek Time First)

Always move to the nearest pending request.

At every step the head jumps to whichever pending cylinder is closest, so the distances to all remaining requests are compared before each move.

CurrentNearest pending optionsChosenDistance
143119 (24), 115 (28), 182 (39)11924
119115 (4), 182 (63), 183 (64)1154
115182 (67), 183 (68), 25 (90)18267
182183 (1), 194 (12), 197 (15)1831
183194 (11), 197 (14)19411
194197 (3), 25 (169)1973
19725 (172), 17 (180)25172
2517 (8), 15 (10)178
1715 (2)152

Service order: 143 → 119 → 115 → 182 → 183 → 194 → 197 → 25 → 17 → 15

$$\text{Total} = 24+4+67+1+11+3+172+8+2 = 292$$

SSTF total head movement = 292 cylinders

Note that 119 has to be taken before 115, since $|143-119| = 24$ is smaller than $|143-115| = 28$. Servicing 115 first would violate the shortest-seek rule even though the two requests sit close together.


Summary

AlgorithmTotal Head Movement
FCFS790 cylinders
SSTF292 cylinders

SSTF greatly reduces head movement versus FCFS, at the risk of starvation for distant requests.

asked 3xavg 5 marks · 2082, 2080, 0
Answer

Define system call? What are its objectives? [5]

System Call: Definition and Objectives

Definition

A system call is a programmatic way in which a computer program requests a service from the kernel of the operating system. It provides an interface between a user-level process and the operating system, allowing user programs to request OS services that require higher privilege levels (kernel mode) than the user mode in which normal programs run.

In simple terms, a system call is a controlled entry point into the kernel through which a running program can ask the OS to perform operations on its behalf.

Example: When a program wants to read a file, it issues a read() system call rather than directly accessing the hardware.


Objectives of System Calls

System calls serve the following key objectives:

1. Hardware Abstraction

System calls hide the complexity of hardware from user programs. Programmers do not need to know the details of hardware devices; they simply call standard system call interfaces.

2. Protection and Security

They ensure that user programs cannot directly access hardware or critical OS resources. The OS validates each request, preventing unauthorized or harmful operations.

3. Resource Management

System calls allow the OS to manage and allocate resources (CPU, memory, I/O devices, files) in a controlled and fair manner among multiple processes.

4. Mode Switching (User Mode to Kernel Mode)

System calls provide a safe and controlled mechanism to switch from user mode to kernel mode, so that privileged instructions can be executed only under OS supervision.

5. Process Control

They allow user programs to create, terminate, and manage processes and threads (e.g., fork(), exec(), exit()).

6. Inter-Process Communication (IPC)

System calls provide mechanisms for processes to communicate and synchronize with each other (e.g., pipes, message queues, shared memory).

7. File and I/O Operations

They provide a standard interface for file management and input/output operations such as open(), read(), write(), and close().


Summary Table

ObjectiveExample System Call
Process Controlfork(), exit(), wait()
File Managementopen(), read(), write()
Device Managementioctl(), read(), write()
Information Maintenancegetpid(), alarm()
Communication (IPC)pipe(), shmget()

In conclusion, system calls act as the bridge between user applications and the operating system kernel, ensuring security, abstraction, and controlled access to system resources.

asked 2xavg 8 marks · 2080, 2079
Answer

Why virtual memory technique is used in the computer system? What is logical address? Explain the process of conversion of logical address to physical address using TLB.[10]

--- Virtual memory is a memory management technique that allows a computer to execute programs that are larger than the available physical memory (RAM). It creates an illusion of a very large memory space for each process by using a port...

asked 2xavg 8 marks · 2080, 2079
Answer

Why Optimal Page Replacement is best but not practically feasible page replacement algorithm? Calculate the number of page faults for Optimal, LRU and FIFO replacement algorithm for the reference string: 1, 3, 4, 2, 3, 5, 4, 3, 1, 2, 4, 6, 3, 2, 1, 4, 2 using 3 page frames.[10]

Best: The Optimal (OPT / Belady's) algorithm replaces the page that will not be used for the longest time in the future. This produces the minimum possible number of page faults for any reference string and frame count. It is the theoret...

asked 2xavg 5 marks · 2080, 2079
Answer

A 2 GB disk has a 4-KB block size, calculate the size of the file allocation table if each entry of the table is 4 bytes. [5]

Parameter Value ------------------ Disk Size 2 GB Block Size 4 KB FAT Entry Size 4 bytes $$\text{Disk Size} = 2 \text{ GB} = 2 \times 2^{30} = 2^{31} \text{ bytes}$$ $$\text{Block Size} = 4 \text{ KB} = 4 \times 2^{10} = 2^{12} \text{ by...

asked 2xavg 8 marks · 2079, 2078
Answer

What are the different types of operating system? Differentiate between Real time and Batch OS.[10]

Types of Operating Systems and Difference Between Real-Time and Batch OS

Types of Operating Systems

An Operating System (OS) is system software that manages hardware and software resources and provides services to computer programs. Operating systems are classified into the following types:


1. Batch Operating System

  • Jobs with similar requirements are grouped (batched) together and executed without user interaction.
  • A job scheduler picks jobs from the batch and submits them to the CPU one by one.
  • Example: Early IBM mainframe systems, payroll processing.

2. Time-Sharing (Multitasking) Operating System

  • CPU time is shared among multiple users/processes simultaneously.
  • Each process gets a small time slice (quantum) in a round-robin fashion.
  • Provides fast response time and interactive use.
  • Example: UNIX, Linux, Windows.

3. Real-Time Operating System (RTOS)

  • Designed to process data and respond within a strict, guaranteed time constraint (deadline).
  • Used in time-critical applications.
  • Example: Air traffic control, medical devices, missile guidance systems, VxWorks.

4. Distributed Operating System

  • Manages a group of independent computers and makes them appear as a single system to the user.
  • Resources (CPU, memory, storage) are distributed across multiple machines.
  • Example: LOCUS, Amoeba.

5. Network Operating System

  • Provides features to manage data, users, groups, security, and applications over a network.
  • Each machine has its own local OS but can share resources over the network.
  • Example: Windows Server, Novell NetWare.

6. Multiprocessor Operating System

  • Supports systems with more than one CPU sharing the same memory and I/O devices.
  • Increases throughput and reliability.
  • Example: Symmetric Multiprocessing (SMP) systems.

7. Embedded Operating System

  • Designed to operate on small machines (embedded systems) with limited resources.
  • Highly specialized and resource-efficient.
  • Example: Android (mobile), FreeRTOS, Windows CE.

8. Mobile Operating System

  • Designed specifically for smartphones and tablets.
  • Manages mobile hardware such as touchscreen, GPS, camera.
  • Example: Android, iOS.

Difference Between Real-Time OS and Batch OS

BasisReal-Time OS (RTOS)Batch OS
DefinitionAn OS that processes tasks and produces results within a strict time deadline.An OS that collects jobs into batches and processes them sequentially without user interaction.
Response TimeExtremely fast and guaranteed (microseconds to milliseconds).Response time is slow and not guaranteed; depends on queue length.
User InteractionMinimal or no user interaction during execution; but system reacts to real-world events.No user interaction once the batch is submitted.
DeadlineStrict deadlines must be met (missing a deadline can cause system failure).No concept of strict deadlines; jobs are processed as resources become available.
PriorityTasks are assigned priorities; high-priority tasks preempt lower ones.Jobs are processed in the order they are batched (FCFS or similar).
SchedulingPriority-based, preemptive scheduling is used.Non-preemptive, sequential scheduling is used.
TypesHard RTOS (strict deadlines) and Soft RTOS (flexible deadlines).Simple batch and multiprogrammed batch.
CPU UtilizationCPU utilization may not be maximum; correctness and timing are more important.Aims for maximum CPU utilization.
Error HandlingMust handle errors immediately and reliably.Errors are reported after job completion; job may be skipped.
ApplicationsMedical devices, missile systems, air traffic control, robotics.Payroll processing, bank statements, weather forecasting data processing.
ComplexityMore complex due to timing constraints and event-driven nature.Relatively simpler to design and implement.
Example SystemsVxWorks, FreeRTOS, QNX.Early IBM OS/360, simple mainframe batch systems.

Summary

Operating systems are classified based on how they manage processes, respond to users, and handle time constraints. Batch OS focuses on throughput and sequential job processing with no real-time constraints, while Real-Time OS focuses on correctness within strict time limits, making it essential for safety-critical and time-sensitive applications.

asked 2xavg 5 marks · 2079, 2078
Answer

How threads differ from processes? Explain user level thread and kernel level thread. [5]

--- Aspect Process Thread --------- Definition An independent program in execution with its own address space A lightweight unit of execution within a process Memory Has its own separate memory space Shares memory (code, data, heap) with...

asked 2xavg 5 marks · 2078, 0
Answer

What is DMA? Explain how it works in brief with suitable diagram. [5]

Direct Memory Access (DMA)

Definition

DMA (Direct Memory Access) is a feature of computer systems that allows certain hardware subsystems (such as disk controllers, network cards, or sound cards) to access main memory (RAM) independently of the CPU. It enables data transfer between I/O devices and memory without continuous CPU involvement, freeing the CPU to perform other tasks during the transfer.


Why DMA is Needed

Without DMA, the CPU must supervise every byte transferred between an I/O device and memory (programmed I/O), which wastes CPU cycles. DMA offloads this work to a dedicated DMA Controller (DMAC).


Key Components

ComponentRole
DMA Controller (DMAC)Manages the data transfer independently
Source Address RegisterHolds the source memory/device address
Destination Address RegisterHolds the destination memory address
Count RegisterHolds the number of bytes/words to transfer
Control RegisterSpecifies direction and mode of transfer

How DMA Works (Step-by-Step)

Step 1: CPU Initialization

  • The CPU programs the DMA controller by providing:
    • Source address
    • Destination address
    • Number of bytes to transfer
    • Direction of transfer (read/write)
  • The CPU then continues its own tasks.

Step 2: DMA Request

  • The I/O device signals the DMAC that it is ready to transfer data (via DMA Request line - DREQ).

Step 3: Bus Request

  • The DMAC requests control of the system bus from the CPU by asserting the Bus Request (BR) signal.

Step 4: Bus Grant

  • The CPU completes its current bus cycle and grants the bus to the DMAC by asserting Bus Grant (BG). The CPU is now temporarily disconnected from the bus (CPU is in a "hold" state).

Step 5: Data Transfer

  • The DMAC takes control of the address bus, data bus, and control bus.
  • Data is transferred directly between the I/O device and memory, one block at a time, without CPU involvement.
  • The address and count registers are updated after each transfer.

Step 6: Transfer Complete

  • When the count reaches zero (all data transferred), the DMAC sends an interrupt to the CPU to notify it that the transfer is complete.
  • The CPU resumes control of the bus.

Diagram

        +------------------+
        |       CPU        |
        +--------+---------+
                 |  BR / BG (Bus Request / Bus Grant)
                 |
        +--------+---------+
        |  DMA Controller  |<-------- DREQ (from I/O Device)
        | (Source Addr Reg)|
        | (Dest  Addr Reg) |
        | (Count Reg)      |
        +---+----------+---+
            |          |
     Address/Data/Control Bus
            |          |
    +-------+--+    +--+--------+
    |  Main    |    | I/O Device|
    |  Memory  |    | (Disk,NIC)|
    +----------+    +-----------+

Data Flow:

I/O Device  ----[DMA Controller]---->  Main Memory
                  (No CPU needed
                   during transfer)

Advantages of DMA

  • CPU is free to execute other instructions during data transfer.
  • Faster data transfer compared to programmed I/O or interrupt-driven I/O.
  • Suitable for high-speed, bulk data transfers (e.g., disk to memory).

Summary

DMA allows I/O devices to transfer data directly to/from memory by temporarily taking control of the system bus, with the CPU only involved at the start (initialization) and end (interrupt) of the transfer.

asked 2xavg 5 marks · 2078, 0
Answer

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]

CPU Scheduling: RR (q=3) and Priority

STEP 1 - Given Data

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$.


STEP 2 - Solve

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
asked 2xavg 10 marks · 2082, 0
Answer

When does page fault occur?Given the 7 page reference strings 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3, find the number of page fault using Optimal Page Replacement, FIFO and Second Chance Replacement algorithm. Assume the size of page frame is 4.[1+9]

Page Fault and Page Replacement Algorithms

When Does a Page Fault Occur?

A page fault occurs when a process references a page that is not currently present in main memory (RAM). The CPU generates a trap, and the OS must bring the required page from secondary storage into a frame. If no free frame exists, a page replacement algorithm chooses a victim to evict.


Given Data

  • Reference string: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 3
  • Number of frames: 4
  • Total references: 14

1. Optimal Page Replacement

Replace the page not needed for the longest time in the future.

RefFrames (contents)Fault
77F
07 0F
17 0 1F
27 0 1 2F
07 0 1 2Hit
3replace 1 → 7 0 3 2F
07 0 3 2Hit
4replace 7 → 4 0 3 2F
24 0 3 2Hit
3Hit
0Hit
3Hit
2Hit
3Hit

At ref 3 (index 6), page 1 is never used again → evict 1.
At ref 4, remaining future refs: 2,3,0,3,2,3. Page 7 never used again → evict 7.

Optimal Page Faults = 6


2. FIFO Page Replacement

Replace the oldest loaded page.

RefFramesFIFO QueueFault
77[7]F
07 0[7,0]F
17 0 1[7,0,1]F
27 0 1 2[7,0,1,2]F
07 0 1 2[7,0,1,2]Hit
3replace 7 → 0 1 2 3[0,1,2,3]F
00 1 2 3[0,1,2,3]Hit
4replace 0 → 1 2 3 4[1,2,3,4]F
21 2 3 4[1,2,3,4]Hit
31 2 3 4[1,2,3,4]Hit
0replace 1 → 2 3 4 0[2,3,4,0]F
32 3 4 0[2,3,4,0]Hit
22 3 4 0[2,3,4,0]Hit
32 3 4 0[2,3,4,0]Hit

FIFO Page Faults = 7


3. Second Chance (Clock) Page Replacement

FIFO order maintained, but on a hit the reference bit R is set to 1. When selecting a victim, if the oldest page has R=1, clear it to 0 and move it to the back (give it a second chance); if R=0, replace it.

Notation: page(R).

RefFrames (queue oldest→newest)ActionFault
77(0)loadF
07(0) 0(0)loadF
17(0) 0(0) 1(0)loadF
27(0) 0(0) 1(0) 2(0)loadF
07(0) 0(1) 1(0) 2(0)hit, set R(0)=1Hit
37 is oldest, R=0 → evict 7. New: 0(1) 1(0) 2(0) 3(0)replace 7F
00(1) 1(0) 2(0) 3(0)hit (0 already R=1)Hit
4Oldest 0 has R=1 → clear to 0, move back. Next oldest 1 has R=0 → evict 1. New: 2(0) 3(0) 0(0) 4(0)replace 1F
22(1) 3(0) 0(0) 4(0)hit, set R=1Hit
32(1) 3(1) 0(0) 4(0)hit, set R=1Hit
02(1) 3(1) 0(1) 4(0)hit, set R=1Hit
32(1) 3(1) 0(1) 4(0)hitHit
22(1) 3(1) 0(1) 4(0)hitHit
32(1) 3(1) 0(1) 4(0)hitHit

Step detail at ref 4: clock pointer at oldest = 0 (R=1) → set R=0, advance; page 1 (R=0) → victim. Result frames = {2,3,0,4}. This matches FIFO's replacement here because giving 0 a second chance saved it.

Second Chance Page Faults = 6


Summary

AlgorithmPage Faults
Optimal6
FIFO7
Second Chance6
asked 2xavg 8 marks · 2082, 2079
Answer

Discuss about working mechanism of banker’s algorithm. [5]

The Banker's Algorithm, proposed by Dijkstra, is a deadlock avoidance algorithm used in operating systems. It is named after a banking system where a banker grants loans only if the total amount requested does not exceed available resour...

Study every one of these with model answers, flashcards, and MCQs.

Open BIT204 study modes