1.
Consider the following statements about process state transitions for a system using
preemptive scheduling.
• Running → Ready (True)
• Ready → Ready (True)
• Blocked → Running (False)
• Blocked → Ready (True)
• Correct: I, II, IV → Option (c)
2. The following C program is executed on Unix/Linux system. Total child processes
created?
• Loop runs 10 times, fork called 5 times
• Each fork doubles processes
• Total = 2^5 - 1 = 31 child processes
3. Which scheduling minimizes average waiting time for unequal CPU bursts?
• Shortest Remaining Time First (SRTF)
• Minimizes waiting time by running shortest job first
• Correct: Option (a)
4. Number of times process enters ready queue in given program?
• 1 for scanf (I/O)
• 20 times for printf (I/O)
• Total = 21 times
5. Differences:
• Long vs Short-term scheduler: admission vs CPU selection
• Preemptive vs Non-preemptive: can be interrupted vs cannot
• CPU-bound vs I/O-bound: computation vs I/O focus
• Time-sharing vs Batch: interactive vs non-interactive
6. CPU scheduling criteria?
• CPU utilization
• Throughput
• Turnaround time
• Waiting time
• Response time
• Fairness
7. Advantages:
• Aging: prevents starvation
• RAG: visualize deadlock
• PCB: process info storage
• Cooperating processes: info sharing
• System call: interface to OS
8. Deadlock conditions?
• Mutual exclusion
• Hold & wait
• No preemption
• Circular wait
9. Methods to handle deadlocks?
• Prevention
• Avoidance
• Detection
• Recovery
10. Prevention of deadlock?
• Eliminate one of necessary conditions
• E.g., avoid hold & wait or circular wait
11. Avoiding deadlock?
• Banker’s algorithm
• Safe state allocation
12. Deadlock detection?
• Resource allocation graph
• Wait-for graph analysis
13. Recovery from deadlock?
• Process termination
• Resource preemption
14. FCFS scheduling example (P0=7,P1=5,P2=2,P3=9)
• WT: P0=0,P1=7,P2=12,P3=14 → Avg WT=8.25
• TAT: P0=7,P1=12,P2=14,P3=23 → Avg TAT=14
15. SRTF example with P1=10,P2=13,P3=6,P4=9 (arrival 0,1,2,8)
• Schedule by preemption order
• Average Turnaround Time = 19 ms (approx)