CPU Scheduling · Operating System
37 questions · asked in 24 of 27 years (2000–2026)
MCQ 24 · MSQ 2 · NAT 111-mark 21 · 2-mark 16
2000Questions per year2026
Questions 26–30 of 37
An operating system uses Shortest Remaining Time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes:
Process Execution time Arrival time
P1 20 0
P2 25 15
P3 10 30
P4 15 45 What is the total waiting time for process P2?Answer: (B)
Shortest Remaining Time first: whenever a process arrives or finishes, the process with the least remaining time runs.
- 0 to 20: P1 runs. P2 arrives at 15, when P1 has 5 ms left against 25 ms for P2, so P1 is not preempted and finishes at 20.
- 20 to 30: P2 (burst 25 ms) runs 10 ms, leaving 15 ms.
- t = 30: P3 arrives with 10 ms, less than the 15 ms P2 has left, so P3 preempts P2 and runs 30 to 40.
- 40 to 55: P2 resumes. P4 arrives at 45 with 15 ms, while P2 has 10 ms left, so P2 is not preempted and finishes at 55.
- 55 to 70: P4 runs.
Waiting time = completion time arrival time burst time.
For P2: ms. This matches the chart: P2 waited from 15 to 20 (5 ms) and from 30 to 40 (10 ms), 15 ms in all.
Answer: (B)
Group 1 contains some CPU scheduling algorithms and Group 2 contains some applications. Match entries in Group 1 to entries in Group 2. Group I Group II
Answer: (A)
- P. Gang scheduling: the threads of one process are scheduled together, at the same time on different CPUs. So it matches Thread scheduling (3).
- Q. Rate monotonic scheduling: fixed priorities for periodic tasks, where a shorter period gives a higher priority. It is a real-time algorithm, so it matches Real-time scheduling (2).
- R. Fair share scheduling: each user (or group) gets a fair share of the CPU, regardless of how many processes it runs. This is the idea behind Guaranteed scheduling (1), where each of the n users is promised about 1/n of the CPU time.
So P-3, Q-2, R-1.
Answer: (A)
- Q. Rate monotonic scheduling: fixed priorities for periodic tasks, where a shorter period gives a higher priority. It is a real-time algorithm, so it matches Real-time scheduling (2).
- R. Fair share scheduling: each user (or group) gets a fair share of the CPU, regardless of how many processes it runs. This is the idea behind Guaranteed scheduling (1), where each of the n users is promised about 1/n of the CPU time.
So P-3, Q-2, R-1.
Answer: (A)
The arrival time, priority, and duration of the CPU and I/O bursts for each of three processes and are given in the table below. Each process has a CPU burst followed by an I/O burst followed by another CPU burst. Assume that each process has its own I/O resource.
The multi-programmed operating system uses preemptive priority scheduling. What are the finish times of the processes and ?
The multi-programmed operating system uses preemptive priority scheduling. What are the finish times of the processes and ?
Answer: (B)
Priorities: is highest (1), is next (2), is lowest (3). Each process has its own I/O device, so I/O never waits for another process.
I/O of the three processes:
- 0 to 1: runs its first CPU burst. Then its I/O runs from 1 to 6.
- 2 to 3: arrives and runs (1 of 3 units done).
- 3 to 5: arrives with higher priority and pre-empts . It runs its 2 units. Its I/O runs from 5 to 8.
- 5 to 6: the CPU goes back to (2 of 3 units done).
- 6 to 8: returns from I/O, pre-empts and runs 2 of its 3 units.
- 8 to 9: returns from I/O and pre-empts . It runs its last unit and finishes at 9.
- 9 to 10: runs its last unit and finishes at 10.
- 10 to 11: finishes its CPU burst. Then its I/O runs from 11 to 14.
- 14 to 15: runs its last CPU unit and finishes at 15.
So the finish times of are 10, 15 and 9.
Answer: (B)
I/O of the three processes:
- 0 to 1: runs its first CPU burst. Then its I/O runs from 1 to 6.
- 2 to 3: arrives and runs (1 of 3 units done).
- 3 to 5: arrives with higher priority and pre-empts . It runs its 2 units. Its I/O runs from 5 to 8.
- 5 to 6: the CPU goes back to (2 of 3 units done).
- 6 to 8: returns from I/O, pre-empts and runs 2 of its 3 units.
- 8 to 9: returns from I/O and pre-empts . It runs its last unit and finishes at 9.
- 9 to 10: runs its last unit and finishes at 10.
- 10 to 11: finishes its CPU burst. Then its I/O runs from 11 to 14.
- 14 to 15: runs its last CPU unit and finishes at 15.
So the finish times of are 10, 15 and 9.
Answer: (B)
Consider three processes, all arriving at time zero, with total execution time of 10, 20 and 30 units, respectively. Each process spends the first 20% of execution time doing I/O, the next 70% of time doing computation, and the last 10% of time doing I/O again. The operating system uses a shortest remaining compute time first scheduling algorithm and schedules a new process either when the running process get blocked on I/O or when the running process finishes its compute burst. Assume that all I/O operations can be overlapped as much as possible. For what percentage of time does the CPU remain idle?
Answer: (B)
Each process spends 20% of its time on I/O, then 70% on the CPU, then 10% on I/O. So the bursts (I/O, CPU, I/O) are P1: 2, 7, 1; P2: 4, 14, 2; P3: 6, 21, 3. All arrive at 0, and I/O can overlap, so all three begin their first I/O together.
- 0-2: all three are in their first I/O, so the CPU is idle for 2 ms.
- 2-9: P1 is ready first and runs its 7 ms. P2 (ready at 4) and P3 (ready at 6) have to wait, because a new process is chosen only when the running one blocks or finishes its compute burst.
- 9-23: P2 (14 ms) is shorter than P3 (21 ms), so P2 runs. P1 does its last 1 ms of I/O at 9-10.
- 23-44: P3 runs its 21 ms. P2 does its last I/O at 23-25.
- 44-47: P3 does its final 3 ms of I/O. No other process is left to use the CPU, so it is idle.
Total time = 47 ms, CPU idle time = 2 + 3 = 5 ms.
Answer: (B)
- 0-2: all three are in their first I/O, so the CPU is idle for 2 ms.
- 2-9: P1 is ready first and runs its 7 ms. P2 (ready at 4) and P3 (ready at 6) have to wait, because a new process is chosen only when the running one blocks or finishes its compute burst.
- 9-23: P2 (14 ms) is shorter than P3 (21 ms), so P2 runs. P1 does its last 1 ms of I/O at 9-10.
- 23-44: P3 runs its 21 ms. P2 does its last I/O at 23-25.
- 44-47: P3 does its final 3 ms of I/O. No other process is left to use the CPU, so it is idle.
Total time = 47 ms, CPU idle time = 2 + 3 = 5 ms.
Answer: (B)
Consider three processes (process id 0,1,2, respectively) with compute time bursts 2,4, and 8 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id . The average turn around time is
Answer: (A)
LRTF always runs the process with the longest remaining time, checked after every time unit. A tie goes to the lowest process id. Remaining times (P0, P1, P2) start at (2, 4, 8).
- 0-4: P2 is longest, so it runs and its remaining time falls from 8 to 4. Now P1 and P2 tie at 4.
- 4-5: the tie goes to P1 (lower id). Remaining (2, 3, 4).
- 5-6: P2 is longest. Remaining (2, 3, 3).
- 6-7: P1 and P2 tie at 3, so P1 runs. Remaining (2, 2, 3).
- 7-8: P2 runs. Remaining (2, 2, 2), a three-way tie.
- 8-9: P0 runs (lowest id). Remaining (1, 2, 2).
- 9-10: P1 runs (tie with P2). Remaining (1, 1, 2).
- 10-11: P2 runs. Remaining (1, 1, 1).
- 11-12: P0 runs and finishes. 12-13: P1 finishes. 13-14: P2 finishes.
A.T. Arrival Time, B.T. Burst Time, C.T. Completion Time, T.A.T. Turn Around Time (C.T. A.T.), W.T. Waiting Time (T.A.T. B.T.)
Average TAT units.
Answer: (A)
- 0-4: P2 is longest, so it runs and its remaining time falls from 8 to 4. Now P1 and P2 tie at 4.
- 4-5: the tie goes to P1 (lower id). Remaining (2, 3, 4).
- 5-6: P2 is longest. Remaining (2, 3, 3).
- 6-7: P1 and P2 tie at 3, so P1 runs. Remaining (2, 2, 3).
- 7-8: P2 runs. Remaining (2, 2, 2), a three-way tie.
- 8-9: P0 runs (lowest id). Remaining (1, 2, 2).
- 9-10: P1 runs (tie with P2). Remaining (1, 1, 2).
- 10-11: P2 runs. Remaining (1, 1, 1).
- 11-12: P0 runs and finishes. 12-13: P1 finishes. 13-14: P2 finishes.
A.T. Arrival Time, B.T. Burst Time, C.T. Completion Time, T.A.T. Turn Around Time (C.T. A.T.), W.T. Waiting Time (T.A.T. B.T.)
Average TAT units.
Answer: (A)
Keep practising
Topics in Operating System
System CallProcessThreadProcess SynchronizationDeadlock
CPU SchedulingYou are here
Disk SchedulingMemory ManagementFile Systems