CSC264 · TU past paper
Operating Systems 2076 question paper
The complete TU 2076 exam paper for Operating Systems (CSC264), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- Q1.10 marksNumericalProcess SchedulingHideAnswer
Interactive System Goals and Scheduling Algorithms
- Q2.10 marksPage Replacement AlgorithmsHideAnswer
How Second Chance page replacement algorithm differs from FIFO page replacement policy? Discuss the concept of Belady’s anomaly with suitable example.[10]
- Q3.10 marksNumericalDisk SchedulingHideAnswer
What is the main objective of disk scheduling algorithms? Why SSTF is not practically feasible? Assume that we have disk with 100 tracks and currently head is at track number 35. What will be the seek time for the algorithms SCAN and LOOK for processing IO requests queue: 52, 67, 21, 11, 43, 85, 18, 75, 92, 8?[10]
Disk Scheduling: Objectives, SSTF Feasibility, SCAN and LOOK
1. Main Objective of Disk Scheduling Algorithms
The primary objective of disk scheduling is to minimize the total seek time (the time the disk arm spends moving between tracks), because seek time dominates disk access latency and the disk is one of the slowest components of a system.
Related objectives:
- Maximize throughput (requests served per unit time)
- Minimize disk arm movement by ordering requests intelligently
- Ensure fairness so no request starves
- Minimize average response and waiting time
2. Why SSTF Is Not Practically Feasible
SSTF (Shortest Seek Time First) always services the request nearest to the current head position.
- Starvation: Requests far from the head may wait indefinitely if closer requests keep arriving. This is the main reason it is not practically feasible.
- Unfairness: Requests to the innermost/outermost tracks are consistently delayed.
- Not globally optimal: Minimizing each local step does not minimize total head movement.
- Unpredictable response time: Hard to guarantee bounded waiting.
Because of starvation and unfairness, SSTF is attractive theoretically but unsuitable in practice.
3. Numerical Solution
Given data:
- Total tracks: 100 (tracks $0$ to $99$)
- Current head position: 35
- Request queue: 52, 67, 21, 11, 43, 85, 18, 75, 92, 8
- Assumed initial direction: toward higher track numbers (standard assumption)
Sorted requests: 8, 11, 18, 21, 43, 52, 67, 75, 85, 92
SCAN (Elevator)
Head moves up, servicing all requests, reaches end track 99, then reverses to service lower requests.
Order: $35 \to 43 \to 52 \to 67 \to 75 \to 85 \to 92 \to 99 \to 21 \to 18 \to 11 \to 8$
From To Distance 35 43 8 43 52 9 52 67 15 67 75 8 75 85 10 85 92 7 92 99 7 99 21 78 21 18 3 18 11 7 11 8 3 Alternatively, total movement = (up: $99-35=64$) + (down: $99-8=91$) = $155$.
$$\text{Total Seek (SCAN)} = 8+9+15+8+10+7+7+78+3+7+3 = \mathbf{155 \text{ tracks}}$$
LOOK
Same as SCAN but the head only goes as far as the last request (92) in the upward direction, not to track 99.
Order: $35 \to 43 \to 52 \to 67 \to 75 \to 85 \to 92 \to 21 \to 18 \to 11 \to 8$
From To Distance 35 43 8 43 52 9 52 67 15 67 75 8 75 85 10 85 92 7 92 21 71 21 18 3 18 11 7 11 8 3 Alternatively, total movement = (up: $92-35=57$) + (down: $92-8=84$) = $141$.
$$\text{Total Seek (LOOK)} = 8+9+15+8+10+7+71+3+7+3 = \mathbf{141 \text{ tracks}}$$
Summary
Algorithm Total Seek Time SCAN 155 tracks LOOK 141 tracks (If seek time per track is $t$ ms, multiply by $t$: SCAN $=155t$, LOOK $=141t$.)
- Q4.5 marksOperating System StructuresHideAnswer
What are two modes of OS? Discuss different OS structures briefly. [5]
Two Modes of OS and OS Structures
Two Modes of OS (Kernel Modes)
Modern operating systems operate in two distinct processor modes to protect the system from faulty or malicious programs:
1. User Mode
- In this mode, the executing program does not have direct access to hardware or memory.
- Application programs (user programs) run in user mode.
- If a user program needs to access hardware or perform privileged operations, it must request the OS through a system call.
- Prevents user programs from accidentally or intentionally damaging the system.
2. Kernel Mode (Supervisor/Privileged Mode)
- In this mode, the OS (kernel) has full access to all hardware and can execute any CPU instruction.
- The kernel runs in this mode to perform critical tasks like memory management, process scheduling, and I/O operations.
- Switching from user mode to kernel mode happens via system calls or interrupts.
The dual-mode operation protects the OS from user programs and protects users from each other.
OS Structures
Different approaches have been used to organize and structure an operating system:
1. Monolithic Structure (Simple / No Structure)
- The entire OS runs as a single large program in kernel mode.
- All OS services (file system, memory management, device drivers, etc.) are packed together.
- Advantage: Fast and efficient due to no overhead of communication between components.
- Disadvantage: Difficult to maintain, debug, and extend. A bug in one part can crash the entire system.
- Example: Early UNIX, MS-DOS.
2. Layered Structure
- The OS is divided into a number of layers (levels), each built on top of the lower one.
- The bottom layer (Layer 0) is the hardware; the topmost layer is the user interface.
- Each layer only uses functions and services of the layer below it.
- Advantage: Easy to debug and maintain (one layer at a time).
- Disadvantage: Defining the layers properly is difficult; performance overhead due to multiple layer traversals.
- Example: THE operating system by Dijkstra.
3. Microkernel Structure
- Only the most essential functions (like inter-process communication, basic scheduling, and memory management) are kept in the kernel.
- All other services (file system, device drivers, etc.) run in user space as separate processes.
- Advantage: More reliable and secure; a failure in one service does not crash the kernel.
- Disadvantage: Performance overhead due to frequent message passing between user-space services and the kernel.
- Example: MINIX, QNX.
4. Virtual Machine Structure
- The OS creates an illusion of multiple independent machines on a single physical machine.
- Each virtual machine gets its own (virtual) copy of the hardware.
- Advantage: Multiple different OS environments can run simultaneously on the same hardware.
- Disadvantage: Complex to implement; some overhead in virtualization.
- Example: VMware, IBM VM/370.
5. Client-Server Structure (Modular Structure)
- A variation of the microkernel approach where OS services are divided into server processes.
- Client processes request services from server processes through message passing.
- Advantage: Highly modular and flexible; suitable for distributed systems.
- Disadvantage: Communication overhead between client and server processes.
Summary Table:
Structure Key Idea Example Monolithic Single large kernel MS-DOS, UNIX Layered Hierarchical layers THE OS Microkernel Minimal kernel + user-space services MINIX, QNX Virtual Machine Multiple virtual OS instances VMware Client-Server Services as separate server processes Distributed OS - Q5.5 marksUser and Kernel Space ThreadsHideAnswer
When threads are better than processes? Explain the concept of user level threads in detail. [5]
- Q6.5 marksNumericalMonoprogramming vs. Multi-programmingHideAnswer
Differentiate between multi programming and Monoprogramming. What will be the CPU utilization with 6 processes with 60% IO waiting time are in memory? [5]
- Q7.5 marksFree Space ManagementHideAnswer
How can you manage free disk space? Explain the linked list approach of managing free disk space with example. [5]
- Q8.5 marksHandling IOHideAnswer
When programmed IO is suitable than other IO handling techniques? Explain the process of IO handling using DMA. [5]
- Q9.5 marksHandling DeadlocksHideAnswer
Differentiate between deadlock and starvation? Discuss the process of detecting deadlocks when there are multiple resources of each type. [5]
- Q10.5 marksMonitorsHideAnswer
What is problem associated with semaphores? Explain the concept of monitors in brief. [5]
- Q11.5 marksRelocation and ProtectionHideAnswer
Why program relocation and protection is important? Explain the technique of achieving program relocation and protection. [5]
- Q12.5 marksResource - Allocation GraphHideAnswer
Write short notes on: a. Linux File System b. Resource Allocation Graph [5]