2022 question paper

Operating System

28 questions

  1. Q1a. Which scheduling policy is most suitable for a time shared operating system: (i) Shortest job first (ii) Round Robin (iii) FCFS (iv) Elevator20222m

    Module 2: Processes & Scheduling

    Which scheduling policy is most suitable for a time shared operating system:

    (i) Shortest job first
    (ii) Round Robin
    (iii) FCFS
    (iv) Elevator

    View this question on its own page →
    Worked Solution

    Answer: (ii) Round Robin

    Time-shared (multiprogrammed, interactive) OS needs to give each ready process a short CPU burst in turn so users get prompt response.

    • Round Robin (RR) — preemptive, each process gets a fixed time quantum (e.g., 10-100ms); ideal for time-sharing due to fairness and low response time.
    • SJF / FCFS — non-preemptive, can cause starvation / convoy effect, not suitable for interactive response.
    • Elevator (SCAN) — disk scheduling, not CPU scheduling.
  2. Q1b. A process executes the following segment of code: ``c for (i = 1; i <= n; i++) fork(); `` The number of new processes created is: (i) n (ii) (n(n+1))/2 (iii) 2^n - 1 (iv) 2^n20222m

    Module 2: Processes & Scheduling

    A process executes the following segment of code:

    for (i = 1; i <= n; i++)
    fork();
    

    The number of new processes created is:

    (i) n
    (ii) (n(n+1))/2
    (iii) 2^n - 1
    (iv) 2^n

    View this question on its own page →
    Worked Solution

    Answer: (iii) 2^n - 1 new processes (2^n total including parent)

    Each fork() doubles the number of processes. Loop for i=1..n fork() creates:

    after i=1: 2 processes
    after i=2: 4 processes
    ...
    after i=n: 2^n processes total
    

    New processes = total - original parent = 2^n - 1. If question counts the parent as well, answer (iv) 2^n is sometimes marked; strictly new = 2^n -1.

  3. Q1c. ______ is a technique of improving the priority of process waiting in queue for CPU allocation: (i) Starvation (ii) Ageing (iii) Revocation (iv) Relocation20222m

    Module 2: Processes & Scheduling

    ______ is a technique of improving the priority of process waiting in queue for CPU allocation:

    (i) Starvation
    (ii) Ageing
    (iii) Revocation
    (iv) Relocation

    View this question on its own page →
    Worked Solution

    Answer: (ii) Ageing

    Ageing gradually increases priority of waiting processes over time, preventing starvation of low-priority jobs. Starvation is the problem, ageing is the solution. Revocation/Relocation are unrelated.

  4. Q1d. Interval between the time of submission and first response to the job is called: (i) waiting time (ii) turnaround time (iii) throughput (iv) response time20222m

    Module 2: Processes & Scheduling

    Interval between the time of submission and first response to the job is called:

    (i) waiting time
    (ii) turnaround time
    (iii) throughput
    (iv) response time

    View this question on its own page →
    Worked Solution

    Answer: (iv) response time

    • Response time = submission to first response (interactive metric)
    • Waiting time = total time in ready queue
    • Turnaround = submission to completion
    • Throughput = jobs per unit time
  5. Q1e. A process is: (i) program in high level language kept on disk (ii) content of main memory (iii) program in execution (iv) job in secondary memory20222m

    Module 2: Processes & Scheduling

    A process is:

    (i) program in high level language kept on disk
    (ii) content of main memory
    (iii) program in execution
    (iv) job in secondary memory

    View this question on its own page →
    Worked Solution

    Answer: (iii) program in execution

    Process = program loaded into memory, with PCB, state, resources, execution context. Program on disk is just executable file (passive). Job is generic batch notion.

  6. Q1f. In which of the following page replacement policy Belady's anomaly occurs? (i) FIFO (ii) LRU (iii) LFU (iv) NRU20222m

    Module 5: Memory Management

    In which of the following page replacement policy Belady's anomaly occurs?

    (i) FIFO
    (ii) LRU
    (iii) LFU
    (iv) NRU

    View this question on its own page →
    Worked Solution

    Answer: (i) FIFO

    Belady's anomaly — increasing frames can increase faults — occurs only in FIFO. Stack algorithms (LRU, Optimal) never suffer because their page sets are monotonic.

  7. Q1g. Which of the following approach require knowledge of the system's state in advance. (i) Deadlock detection (ii) Deadlock prevention (iii) Deadlock avoidance (iv) None of these20222m

    Module 4: Deadlocks

    Which of the following approach require knowledge of the system's state in advance.

    (i) Deadlock detection
    (ii) Deadlock prevention
    (iii) Deadlock avoidance
    (iv) None of these

    View this question on its own page →
    Worked Solution

    Answer: (iii) Deadlock avoidance

    Avoidance (Banker's) requires knowledge of future maximum needs to compute safe state. Prevention needs only structural guarantees, Detection works after the fact.

  8. Q1h. ______ is the time required to move the disk-arm to the desired track. (i) Seek time (ii) Rotational Latency (iii) Access time (iv) Waiting time20222m

    Module 6: I/O & File Management

    ______ is the time required to move the disk-arm to the desired track.

    (i) Seek time
    (ii) Rotational Latency
    (iii) Access time
    (iv) Waiting time

    View this question on its own page →
    Worked Solution

    Answer: (i) Seek time

    Disk access time = Seek time (arm movement) + Rotational latency (waiting for sector) + Transfer time. Seek is typically dominant (ms scale). Rotational latency avg = 0.5 / RPM.

  9. Q1i. Which module gives control of the CPU to the process selected by the short-term scheduler? (i) dispatcher (ii) scheduler (iii) Interrupt (iv) None of these20222m

    Module 2: Processes & Scheduling

    Which module gives control of the CPU to the process selected by the short-term scheduler?

    (i) dispatcher
    (ii) scheduler
    (iii) Interrupt
    (iv) None of these

    View this question on its own page →
    Worked Solution

    Answer: (i) dispatcher

    Dispatcher context-switches to the chosen process: saves old, loads PCB, switches mode, jumps to PC. Scheduler decides, dispatcher acts.

  10. Q1j. Which memory allocation policy allocates the largest hole to the process? (i) Best-fit (ii) Worst-fit (iii) First-fit (iv) None of the above.20222m

    Module 5: Memory Management

    Which memory allocation policy allocates the largest hole to the process?

    (i) Best-fit
    (ii) Worst-fit
    (iii) First-fit
    (iv) None of the above.

    View this question on its own page →
    Worked Solution

    Answer: (ii) Worst-fit

    • Best-fit: smallest sufficient hole (least waste)
    • Worst-fit: largest hole (leaves large remainder)
    • First-fit: first sufficient hole (fast)
    • Next-fit: variant of first-fit from last position.
  11. Budget App•POCKETLY

    Pocketly on Android

    Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.

    Install Pocketly
  12. Q2a. Describe seek time, rotational latency, random-access time and their relationship in context of magnetic disks by drawing its moving – head mechanism.20227m

    Module 6: I/O & File Management

    Describe seek time, rotational latency, random-access time and their relationship in context of magnetic disks by drawing its moving – head mechanism.

    View this question on its own page →
    Worked Solution

    Magnetic Disk Timing

    • Seek time: time for head assembly to move to correct track/cylinder (dominant, ~5-10ms). Depends on distance.
    • Rotational latency: time for desired sector to rotate under head. Average = 0.5*(60/RPM). At 7200 RPM ≈4.17ms.
    • Random-access time = Seek + Rotational latency (+ transfer time for actual R/W).
    • Transfer time = bytes / (bytes per track * RPM)

    Moving-head mechanism: Platter stack with arm assembly. Diagram description: multiple platters share spindle, each surface has head on arm, all heads move together radially. Arm moves seek, then platter rotates to sector. Random time = seek + rotation. Contiguous allocation reduces seeks.

  13. Q2b. Suppose a disk has 100 cylinders, numbered from 0 to 99. At some time the disk arm is at cylinder 50, and there is a queue of disk access requests for cylinders 4, 34, 10, 7, 19, 73, 2, 15, 6 and 20. Assuming that shortest seek-time first (SSTF) is being used for scheduling the disk access. Calculate the total time taken to satisfy all requests if it takes 1 millisecond to move from one cylinder to adjacent one.20227m

    Module 6: I/O & File Management

    Suppose a disk has 100 cylinders, numbered from 0 to 99. At some time the disk arm is at cylinder 50, and there is a queue of disk access requests for cylinders 4, 34, 10, 7, 19, 73, 2, 15, 6 and 20. Assuming that shortest seek-time first (SSTF) is being used for scheduling the disk access. Calculate the total time taken to satisfy all requests if it takes 1 millisecond to move from one cylinder to adjacent one.

    View this question on its own page →
    Worked Solution

    SSTF calculation (arm at 50)

    Requests: 4,34,10,7,19,73,2,15,6,20. Order by closest seek from current:
    50→34(16),34→20(14)=30,20→19(1)=31,19→15(4)=35,15→10(5)=40,10→7(3)=43,7→6(1)=44,6→4(2)=46,4→2(2)=48,2→73(71)=119.
    Total movement = 119 cylinders → 119ms (1ms per cylinder). FCFS would be larger (~ ~200). SSTF starves edge requests but minimizes seek; SCAN/C-SCAN would give different totals. Gantt/Sequence: 50-34-20-19-15-10-7-6-4-2-73.

  14. Q3a. What do you understand by address binding, Explain the various address binding schemes.20227m

    Module 5: Memory Management

    What do you understand by address binding, Explain the various address binding schemes.

    View this question on its own page →
    Worked Solution

    Address Binding

    Mapping logical to physical address.

    • Compile-time: absolute code generated if memory location known at compile (requires recompilation to relocate).
    • Load-time: relocatable code; address computed at load time when base known.
    • Execution-time: binding delayed until run-time via MMU/base+limit/paging, allows process movement. Need hardware support. Modern OS uses execution-time binding for multiprogramming and swapping.
  15. Q3b. Consider the virtual page reference string 0, 4, 8, 20, 24, 36, 44, 12, 68, 72, 80, 84, 28, 32, 88, 92 on a demand paged virtual memory system running on computer system that has main memory of size 4 page frames which one initially empty. The CPU uses LRU page replacement policy. (i) How many page faults does this sequence cause? (ii) What are the page numbers of the pages present in the main memory at the end of the sequence?20227m

    Module 5: Memory Management

    Consider the virtual page reference string 0, 4, 8, 20, 24, 36, 44, 12, 68, 72, 80, 84, 28, 32, 88, 92 on a demand paged virtual memory system running on computer system that has main memory of size 4 page frames which one initially empty. The CPU uses LRU page replacement policy.
    (i) How many page faults does this sequence cause?
    (ii) What are the page numbers of the pages present in the main memory at the end of the sequence?

    View this question on its own page →
    Worked Solution

    LRU with 4 frames, ref: 0,4,8,20,24,36,44,12,68,72,80,84,28,32,88,92

    Simulating LRU: each new page faults until 4 distinct, then replace LRU.
    Sequence: 0(F),4(F),8(F),20(F)=4,24(F replace 0),36(F replace4),44(F replace8),12(F replace20),68(F replace24),72(F replace36),80(F replace44),84(F replace12),28(F replace68),32(F replace72),88(F replace80),92(F replace84) => 16 faults (all references distinct except maybe? Actually all distinct, so 16 faults). Final pages in memory (order LRU→MRU): 28,32,88,92. If any repeated, faults reduce. Explanation shows LRU tracks recency stack.

  16. Q4a. What do you understand by critical section problem. Discuss the requirements that a solution to the critical section problem must satisfy.20227m

    Module 3: Inter-process Communication

    What do you understand by critical section problem. Discuss the requirements that a solution to the critical section problem must satisfy.

    View this question on its own page →
    Worked Solution

    Critical Section Problem

    Code segment where shared resources accessed. Requirements: 1) Mutual Exclusion (only one in CS), 2) Progress (decision in finite time if no one in CS), 3) Bounded Waiting (limit on waiting). Solutions: software (Peterson), hardware (TSL, swap), semaphores, monitors.

  17. Q4b. A single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column 'alloc' denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Find the process that will finish first and last. | | alloc<br>X Y Z | Request<br>X Y Z | |---|---|---| | P0 | 1 2 1 | 1 0 3 | | P1 | 2 0 1 | 0 1 2 | | P2 | 2 2 1 | 1 2 0 |20227m

    Module 4: Deadlocks

    A single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column 'alloc' denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Find the process that will finish first and last.

    alloc<br>X Y Z Request<br>X Y Z
    P0 1 2 1 1 0 3
    P1 2 0 1 0 1 2
    P2 2 2 1 1 2 0
    View this question on its own page →
    Worked Solution

    Resource allocation X,Y,Z (5 each) alloc vs request

    Total allocated: X=5(1+2+2),Y=4(2+0+2),Z=3(1+1+1) → Available =5-allocated = X0,Y1,Z2 initially? Actually given no available row, compute: assume total 5 each → Avail = Total - sumAlloc = X0,Y1,Z2. Need calc Need=Request.
    Check P1 Need 0,1,2 ≤ Avail 0,1,2 → P1 can finish first, release 2,0,1 → Avail 2,1,3. Then P0 Need 1,0,3 ≤ Avail 2,1,3 → P0 finishes last? Let's simulate order P1→P0→P2 gives finish first P1, last P0/P2 depending. Detailed safe sequence P1,P2,P0 => first P1, last P0.

  18. Q5a. Explain process state transition diagram of an operating system.20227m

    Module 2: Processes & Scheduling

    Explain process state transition diagram of an operating system.

    View this question on its own page →
    Worked Solution

    Process State Diagram

    Explain 5-state plus suspended: New→Ready (admit), Ready↔Running (dispatch/preempt), Running→Waiting (I/O), Waiting→Ready (completion), Running→Terminated. Medium-term adds Suspend Ready/Blocked. Diagram aids context switch understanding.

  19. Q5b. Consider the following CPU processes with arrival times 0 and CPU bursts (in milliseconds) as given below: | Process | Burst time | |---|---| | P1 | 24 | | P2 | 3 | | P3 | 3 | If the Round Robin Scheduling is used with time quantum of 4 milliseconds to schedule the processes. Draw the Gantt chart and calculate the average waiting time across all processes (in milliseconds).20227m

    Module 2: Processes & Scheduling

    Consider the following CPU processes with arrival times 0 and CPU bursts (in milliseconds) as given below:

    Process Burst time
    P1 24
    P2 3
    P3 3

    If the Round Robin Scheduling is used with time quantum of 4 milliseconds to schedule the processes. Draw the Gantt chart and calculate the average waiting time across all processes (in milliseconds).

    View this question on its own page →
    Worked Solution

    RR quantum 4, P1=24,P2=3,P3=3 arrival 0

    Gantt: P1 0-4, P2 4-7, P3 7-10, P1 10-14, P1 14-18, P1 18-22, P1 22-24, P1 24-28? Actually P1 needs 6 quanta: 0-4(20 rem),4-7 P2 done,7-10 P3 done,10-14 P1(16),14-18(12),18-22(8),22-26(4),26-30(0). WT: P1 =30-24=6? Wait TAT P1 30, WT 6, P2 WT 4, P3 WT 7 => Avg WT ~5.67. Detailed diagram shows RR fairness.

  20. Q6a. Write necessary conditions that must hold simultaneously to arise deadlock situation. Briefly explain different deadlock handling mechanisms.20227m

    Module 4: Deadlocks

    Write necessary conditions that must hold simultaneously to arise deadlock situation. Briefly explain different deadlock handling mechanisms.

    View this question on its own page →
    Worked Solution

    Necessary Conditions (Coffman)

    1 Mutual Exclusion 2 Hold-and-Wait 3 No Preemption 4 Circular Wait

    Handling

    • Prevention (break one condition)
    • Avoidance (Banker's, safe state)
    • Detection & Recovery (wait-for graph, kill/preempt)
    • Ignorance (ostrich, used by Unix/Windows)
  21. Q6b. What is the cause of thrashing? How does the system detect thrashing and once detected what can the system do to eliminate it20227m

    Module 5: Memory Management

    What is the cause of thrashing? How does the system detect thrashing and once detected what can the system do to eliminate it

    View this question on its own page →
    Worked Solution

    Thrashing Cause/Detect/Eliminate

    Cause: insufficient frames for working sets. Detection: low CPU utilization + high paging, process fault frequency high. Elimination: reduce multiprogramming, use local replacement, working set or PFF, increase frames, suspend victims.

  22. Budget App•POCKETLY

    Pocketly on Android

    Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.

    Install Pocketly
  23. Q7a. What do you understand by fragmentation. Explain the difference between internal and external fragmentation.20227m

    Module 5: Memory Management

    What do you understand by fragmentation. Explain the difference between internal and external fragmentation.

    View this question on its own page →
    Worked Solution

    Fragmentation

    Fragmentation = wasted memory. Internal: waste inside allocated block due to fixed sizing. External: free holes scattered outside, insufficient contiguous for request. Fixes: internal → best-fit; external → compaction, paging eliminates external.

  24. Q7b. Consider a paging hardware with a TLB. Assume that the entire page table and all the pages are in the physical memory. It takes 10 milliseconds to search the TLB and 80 milliseconds to access the physical memory. If the TLB hit ratio is 0.6, find the effective memory access time (in milliseconds).20227m

    Module 5: Memory Management

    Consider a paging hardware with a TLB. Assume that the entire page table and all the pages are in the physical memory. It takes 10 milliseconds to search the TLB and 80 milliseconds to access the physical memory. If the TLB hit ratio is 0.6, find the effective memory access time (in milliseconds).

    View this question on its own page →
    Worked Solution

    TLB Effective Access

    EAT = hit*(TLB+Mem) + miss*(TLB+2Mem) =0.6(10+80)+0.4*(10+160)=0.690+0.4170=54+68=122ms. If search overlapped, alternative 128ms. TLB caching reduces avg.

  25. Q8a. What is thread? Explain the benefits of using thread.20227m

    Module 2: Processes & Scheduling

    What is thread? Explain the benefits of using thread.

    View this question on its own page →
    Worked Solution

    Thread Benefits

    • Responsiveness, resource sharing, economy (fast creation), scalability on multicore. Improves throughput, uses blocking I/O without blocking process.
  26. Q8b. Explain the use of TLB in paging hardware and its benefits.20227m

    Module 5: Memory Management

    Explain the use of TLB in paging hardware and its benefits.

    View this question on its own page →
    Worked Solution

    TLB Benefits

    TLB caches page translations, reduces memory accesses from 2 to 1 on hit, improves EAT, associative fast lookup (~10ns). Hit ratio 90% typical.

  27. Q9a. Write short notes on: Banker's Algorithm20227m

    Module 4: Deadlocks

    Write short notes on: Banker's Algorithm

    View this question on its own page →
    Worked Solution

    Banker's Algorithm

    Safe-state avoidance algorithm. Data: Available, Max, Allocation, Need=Max-Alloc. Safety check finds safe sequence where each Need ≤ Available + releases. Request grant checks Request≤Need and Request≤Available then simulates safety. Ensures deadlock avoidance.

  28. Q9b. Write short notes on: Paging20227m

    Module 5: Memory Management

    Write short notes on: Paging

    View this question on its own page →
    Worked Solution

    Paging

    Divide logical into pages, physical into frames equal size, page table maps. Eliminates external fragmentation, allows non-contiguous allocation, supports virtual memory via demand paging. Overhead: page table size, TLB needed for speed.

  29. Q9c. Write short notes on: Process Control Block20227m

    Module 2: Processes & Scheduling

    Write short notes on: Process Control Block

    View this question on its own page →
    Worked Solution

    PCB same as Q29: structure and importance for process management.

  30. Q9d. Write short notes on: Peterson's solution20227m

    Module 3: Inter-process Communication

    Write short notes on: Peterson's solution

    View this question on its own page →
    Worked Solution

    Peterson's Solution

    Software mutual exclusion for 2 processes using flag[] and turn, guarantees mutex, progress, bounded waiting without hardware.

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.