BIT204 · TU past paper
Operating Systems 2080 question paper
The complete TU 2080 exam paper for Operating Systems (BIT204), all 12 questions with solved model answers written to the mark scheme.
Tap a question to open its answer.
- 110 marksTranslation Lookaside BufferHideAnswer
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...
- 210 marksNumericalOptimal page replacement algorithmHideAnswer
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...
- 310 marksNumericalTurnaround time calculationHideAnswer
CPU Scheduling Analysis
Find Average waiting time and turn-around time for the following example using FIFO, SRTF and Round Robin scheduling algorithm. Assume quantum as 4 ms.
Process id Arrival time Burst time (ms) P1 0 8 P2 1 5 P3 1 10 P4 2 13 P5 2 17 [10]
Process Arrival Time Burst Time ---------------------------------- P1 0 8 P2 1 5 P3 1 10 P4 2 13 P5 2 17 Quantum $q = 4$ ms. Formulas: TAT = CT - AT, WT = TAT - BT. --- Order by arrival: P1 → P2 → P3 → P4 → P5. Gantt: P1[0-8] P2[8-13] P3...
- 45 marksNumericalFile Allocation TableHideAnswer
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...
- 55 marksCoalescing and compaction techniquesHideAnswer
Write down the basic difference between coalescing and compaction with diagram. [5]
--- Definition: Coalescing is the process of merging two or more adjacent free memory blocks into a single larger free block when a block is deallocated. - It happens immediately when a block is freed and its neighbor(s) are also free. -...
- 65 marksNumericalDisk scheduling algorithmsHideAnswer
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
From To Distance 143 25 118 25 17 8 17 119 102 119 197 78 197 194 3 194 15 179 15 182 167 182 115 67 115 183 68 $$\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.
Current Nearest pending options Chosen Distance 143 119 (24), 115 (28), 182 (39) 119 24 119 115 (4), 182 (63), 183 (64) 115 4 115 182 (67), 183 (68), 25 (90) 182 67 182 183 (1), 194 (12), 197 (15) 183 1 183 194 (11), 197 (14) 194 11 194 197 (3), 25 (169) 197 3 197 25 (172), 17 (180) 25 172 25 17 (8), 15 (10) 17 8 17 15 (2) 15 2 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
Algorithm Total Head Movement FCFS 790 cylinders SSTF 292 cylinders SSTF greatly reduces head movement versus FCFS, at the risk of starvation for distant requests.
- 75 marks3-state process modelHideAnswer
What is process? Explain 3 state process models with suitable diagram. [5]
Process and 3-State Process Model
What is a Process?
A process is a program in execution. It is an active entity that requires resources such as CPU time, memory, files, and I/O devices to accomplish its task. A process is more than just program code (text section); it also includes the current activity represented by the value of the program counter, processor registers, stack, and data section.
In simple terms: Program + Execution State = Process
3-State Process Model
As a process executes, it moves through different states. In the 3-state (three-state) process model, a process can be in one of the following three states:
States
State Description Running The process is currently being executed by the CPU. Ready The process is ready to execute but is waiting for the CPU to be assigned to it. Blocked (Waiting) The process is waiting for some event to occur (e.g., I/O completion, signal) and cannot proceed until that event happens.
State Transition Diagram
Dispatch +--------->---------+ | | | v READY RUNNING ^ | | Timeout/ | +-------<-----------+ (Preempt) | | Wait for | I/O or Event v BLOCKED | | I/O or Event | Completes | +--------->-----> READY
Explanation of Transitions
-
Ready → Running (Dispatch)
- The OS scheduler selects the process from the ready queue and assigns the CPU to it.
-
Running → Ready (Timeout / Preemption)
- The running process is preempted because its time slice (quantum) has expired, or a higher-priority process becomes ready. The process goes back to the ready queue.
-
Running → Blocked (Wait for I/O or Event)
- The running process requests an I/O operation or waits for an event (e.g., reading from disk). Since it cannot continue, it moves to the blocked state.
-
Blocked → Ready (I/O or Event Completes)
- When the awaited I/O or event is complete, the process moves back to the ready state and waits for CPU allocation.
Key Points
- Only one process can be in the Running state at a time on a single-processor system.
- Multiple processes can be in the Ready or Blocked state simultaneously.
- A process never goes directly from Blocked to Running; it must pass through Ready first.
- This model forms the foundation for more complex models (5-state, 7-state models).
-
- 85 marksMemory mapped I/OHideAnswer
What is memory mapped I/O? Explain about device independent I/O software. [5]
Memory Mapped I/O is a method of performing input/output operations between the CPU and peripheral devices in which the I/O devices are mapped into the same address space as the main memory. - In this scheme, a portion of the memory addr...
- 95 marksDeadlock versus starvationHideAnswer
Differentiate between deadlock and starvation? Discuss the process of detecting deadlocks when there are multiple resources of each type. [5]
--- Aspect Deadlock Starvation --------- Definition A situation where a set of processes are permanently blocked, each waiting for a resource held by another process in the set A situation where a process waits indefinitely because other...
- 105 marksProgram versus process distinctionHideAnswer
Differentiate between process and a program. What is PCB? [5]
Basis Program Process ------------------------- Definition A program is a static set of instructions stored on disk (passive entity) A process is a program in execution (active entity) Nature Passive, just a file containing code Active, ...
- 115 marksProducer consumer problem with message pasHideAnswer
Write down the Solving technique of the producer consumer problem with Message passing? [5]
Message passing is an inter-process communication (IPC) technique where processes communicate by sending and receiving messages rather than using shared memory. This eliminates the need for explicit mutual exclusion (no shared variables,...
- 125 marksSystem call definition and objectivesHideAnswer
What is system call? Explain the system call process in detail. [5]
A system call is a programmatic way in which a user-level program requests a service from the operating system kernel. It provides an interface between a running process (user space) and the operating system (kernel space). System calls ...