🎓 BookMCQ
← Back to 6. CPU Scheduling

📝 Shortest Job First Scheduling Algorithm in Operating System (59 MCQs)

📖 From Operating System • 6. CPU Scheduling • 59 questions available

What is Shortest Job First Scheduling Algorithm in Operating System?

Definition:
SJF selects the process with the smallest next CPU burst time bnextb_{next}, providing optimal average waiting time but requiring knowledge of future burst lengths.

Example:
Given four processes with bursts 6ms, 8ms, 7ms, and 3ms, the scheduler executes them in order 3→6→7→8, minimizing total waiting time compared to any other sequence.

Reason:
SJF is provably optimal for minimizing average waiting time, but its practical limitation is the inability to know exact future CPU burst lengths, necessitating exponential averaging prediction techniques.

8
Easy
14
Medium
37
Hard

📝 All Shortest Job First Scheduling Algorithm in Operating System MCQs

Q1. What is the fundamental principle of the Shortest-Job-First (SJF) scheduling algorithm?

A.The process with the longest CPU burst runs first
B.The process with the smallest next CPU burst is assigned the CPU ✅
C.Processes are scheduled in round-robin order
D.The process with the highest priority runs first
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: SJF assigns the CPU to the process with the smallest next CPU burst. This minimizes average waiting time by allowing short processes to complete quickly before longer ones, reducing overall waiting times.

Q2. How does SJF break ties when two processes have the same next CPU burst length?

A.Round-robin scheduling
B.Priority scheduling
C.FCFS scheduling ✅
D.Random selection
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: When two processes have identical next CPU burst lengths, SJF uses FCFS scheduling to break the tie. The process that arrived first gets the CPU, maintaining FIFO order among equal-burst processes.

Q3. What would be a more accurate name for the SJF scheduling algorithm?

A.Shortest-total-process algorithm
B.Shortest-next-CPU-burst algorithm ✅
C.First-come-first-served algorithm
D.Priority scheduling algorithm
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: SJF is more accurately called the shortest-next-CPU-burst algorithm because it schedules based on the length of the next CPU burst, not the total process length. This distinction is important for processes with multiple CPU bursts.

Q4. For processes P1(6ms), P2(8ms), P3(7ms), P4(3ms), what is the average waiting time under SJF?

A.7ms ✅
B.10.25ms
C.8ms
D.9ms
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: SJF order: P4(3) runs 0-3, P1(6) runs 3-9, P3(7) runs 9-16, P2(8) runs 16-24. Waiting times: P1=3, P2=16, P3=9, P4=0. Average = (3+16+9+0)/4 = 28/4 = 7ms. This demonstrates SJF's optimal average waiting time.

Q5. What is the average waiting time for the same processes under FCFS with order P1, P2, P3, P4?

A.10.25ms ✅
B.7ms
C.12ms
D.8.5ms
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: FCFS order P1(6), P2(8), P3(7), P4(3): waiting times P1=0, P2=6, P3=14, P4=21. Average = (0+6+14+21)/4 = 41/4 = 10.25ms. SJF's 7ms average is better, showing why SJF is optimal for minimizing average waiting time.

Q6. Which of the following statements about SJF scheduling is true?

A.It always gives the maximum average waiting time
B.It is provably optimal in giving the minimum average waiting time ✅
C.It is always implemented in short-term scheduling
D.It does not require knowledge of burst lengths
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: SJF is provably optimal for minimizing average waiting time for a given set of processes. This mathematical proof shows that scheduling shorter processes before longer ones always reduces the overall average waiting time.

Q7. What is the real difficulty with implementing the SJF algorithm?

A.It is too complex to code
B.Knowing the length of the next CPU request ✅
C.It requires too much memory
D.It causes excessive context switches
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The main difficulty with SJF is knowing the length of the next CPU burst. Unlike FCFS which needs no prediction, SJF requires knowledge of future burst lengths, which is impossible to know exactly in advance for short-term scheduling.

Q8. In long-term (job) scheduling, how can the length of the next CPU burst be estimated for SJF?

A.By random guessing
B.Using the process time limit specified by the user ✅
C.By measuring previous runs
D.By averaging all processes
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: For long-term scheduling in batch systems, users specify a time limit when submitting jobs. This limit can be used as the burst length estimate for SJF, though users are motivated to estimate accurately to avoid time-limit-exceeded errors.

Q9. Why is SJF used frequently in long-term scheduling but not in short-term scheduling?

A.It is too complex for long-term
B.Long-term scheduling can use user-specified time limits ✅
C.Short-term scheduling doesn't need SJF
D.Long-term scheduling is less important
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: SJF is used in long-term scheduling because users provide time limits, giving the necessary burst length information. Short-term scheduling cannot know future CPU bursts, making SJF impossible to implement directly without prediction methods.

Q10. What is the exponential average formula used for in SJF scheduling?

A.To calculate the exact next CPU burst
B.To predict the length of the next CPU burst ✅
C.To determine process priority
D.To calculate average waiting time
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The exponential average formula predicts the next CPU burst length based on past burst history. It combines the most recent burst (tn) with the previous prediction (τn) using a weighting parameter α to forecast the next burst length.

Q11. In the exponential average formula τ_{n+1} = αt_n + (1-α)τ_n, what does α represent?

A.The age of the process
B.The relative weight of recent versus past history ✅
C.The CPU burst length
D.The waiting time
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The parameter α controls how much weight is given to recent history versus past history. Higher α values give more weight to the most recent burst, while lower α values give more weight to past behavior, affecting the prediction's responsiveness to changes.

Q12. If Îą = 0 in the exponential average formula, what does this imply?

A.Only the most recent CPU burst matters
B.Recent history has no effect ✅
C.Past history has no effect
D.The prediction is random
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When α = 0, τ_{n+1} = τ_n, meaning recent history has no effect on the prediction. This assumes current conditions are transient and the past history is a better predictor. The prediction remains constant regardless of recent CPU burst lengths.

Q13. If Îą = 1 in the exponential average formula, what does this imply?

A.Only the most recent CPU burst matters ✅
B.Past history is most important
C.The prediction is constant
D.Recent history has no effect
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When α = 1, τ_{n+1} = t_n, meaning only the most recent CPU burst matters. This assumes history is old and irrelevant, and the next burst will be exactly like the most recent one. Past history is completely ignored in this case.

Q14. What is the most commonly used value for Îą in the exponential average formula?

A.0
B.1
C.01-Feb ✅
D.01-Apr
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The most commonly used value for α is 1/2, which gives equal weight to recent history and past history. This balanced approach provides a reasonable prediction that adapts to changes while maintaining some stability.

Q15. What is the initial value τ₀ typically set to in the exponential average formula?

A.Always 0
B.Always the first burst length
C.A constant or overall system average ✅
D.Random value
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The initial value τ₀ is typically set to a constant or an overall system average. This provides a starting point before any history is available. The constant is often 10, but this can vary based on the system and expected burst lengths.

Q16. What is the difference between preemptive and nonpreemptive SJF?

A.Preemptive SJF is always faster
B.Preemptive SJF can preempt currently running process if new process has shorter remaining burst ✅
C.Nonpreemptive SJF can also preempt
D.There is no difference
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Preemptive SJF (Shortest-Remaining-Time-First) can preempt the currently running process if a newly arrived process has a shorter remaining CPU burst. Nonpreemptive SJF allows the current process to finish its burst regardless of new arrivals.

Q17. What is another name for preemptive SJF scheduling?

A.Round-robin scheduling
B.Shortest-remaining-time-first scheduling ✅
C.Priority scheduling
D.First-come-first-served scheduling
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Preemptive SJF is called Shortest-Remaining-Time-First (SRTF) scheduling. The name emphasizes that the algorithm considers the remaining time, not the total burst, and preempts when a process with shorter remaining time arrives.

Q18. What is the average waiting time for the same set of processes under nonpreemptive SJF?

A.6.5ms
B.7.75ms ✅
C.8.5ms
D.9ms
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Nonpreemptive SJF schedule: P1 runs 0-8 (arrived at 0). P2 arrives at 1, P3 at 2, P4 at 3. After P1 completes at 8, order by burst: P2(4), P4(5), P3(9). Schedule: P1 0-8, P2 8-12, P4 12-17, P3 17-26. Waiting times: P1=0, P2=8-1=7, P4=12-3=9, P3=17-2=15. Average = (0+7+9+15)/4 = 31/4 = 7.75ms. This is higher than preemptive SJF (6.5ms) because P1 wasn't preempted when shorter processes arrived.

Q19. Why does moving a short process before a long one decrease the average waiting time?

A.It reduces context switching
B.The short process's waiting time decreases more than the long process's increases ✅
C.It increases CPU utilization
D.It eliminates all waiting time
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Moving a short process before a long one decreases the short process's waiting time significantly while only slightly increasing the long process's waiting time. The net effect reduces the average waiting time, which is the mathematical basis for SJF's optimality.

Q20. In the exponential average formula with α=1/2 and τ₀=10, if recent burst lengths are 6, 4, 6, what is the prediction for the next burst?

A.5
B.6 ✅
C.4
D.7
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Using τ_{n+1} = 0.5*t_n + 0.5*τ_n with τ₀=10: After first burst 6: τ₁ = 0.5*6 + 0.5*10 = 8. After second burst 4: τ₂ = 0.5*4 + 0.5*8 = 6. After third burst 6: τ₃ = 0.5*6 + 0.5*6 = 6. The prediction for the next burst is 6.

Q21. What happens if a user specifies a time limit that is too low for long-term SJF scheduling?

A.The process runs faster
B.A time-limit-exceeded error occurs and resubmission is required ✅
C.The process is given higher priority
D.The process is terminated permanently
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: If a user specifies a time limit that is too low, the process may exceed its limit, causing a time-limit-exceeded error. The process must then be resubmitted with a higher estimate. This motivates users to provide accurate estimates, balancing faster response (lower limit) against the risk of exceeded limits.

Q22. Which of the following is a key property of the exponential average formula when Îą < 1?

A.Recent history has more weight than past history
B.Each successive term has less weight than its predecessor ✅
C.All history is equally weighted
D.Recent history has no effect
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: When α < 1, (1-α) is also less than 1, so as we expand the formula, each successive term has less weight than its predecessor. This creates an exponential decay of historical importance, giving more weight to more recent bursts.

Q23. In preemptive SJF, what happens when a new process arrives with a CPU burst shorter than the remaining time of the currently running process?

A.The new process waits
B.The current process continues
C.The current process is preempted and the new process runs ✅
D.Both processes share the CPU
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: In preemptive SJF, the currently running process is preempted when a new process arrives with a shorter remaining CPU burst. The new process runs immediately, and the preempted process resumes later when the shorter process completes.

Q24. For the preemptive SJF example with P1(0,8), P2(1,4), P3(2,9), P4(3,5), what is the completion time for process P1?

A.17ms ✅
B.8ms
C.10ms
D.26ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Preemptive SJF schedule: P1 0-1 (1ms), P2 1-5 (4ms), P4 5-10 (5ms), P1 10-17 (remaining 7ms), P3 17-26 (9ms). P1 completes at 17ms. It was preempted twice: at time 1 by P2 and at time 10 by P4? Actually P1 ran 0-1, then was preempted by P2. Then P1 ran again 10-17. So completion time is 17ms.

Q25. What is the waiting time for process P3 in the preemptive SJF example?

A.15ms ✅
B.17ms
C.10ms
D.5ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: P3 arrives at time 2 with burst 9. It completes at time 26. Waiting time = completion - arrival - burst = 26 - 2 - 9 = 15ms. P3 waited from time 2 until time 17 when P1 completed, then ran from 17-26. So P3 waited 15ms (from 2 to 17).

Q26. Why is SJF considered provably optimal for a given set of processes?

A.It always completes processes fastest
B.It minimizes the average waiting time ✅
C.It maximizes CPU utilization
D.It reduces context switching
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: SJF is provably optimal because scheduling shorter processes before longer ones minimizes the sum of waiting times. Any schedule where a longer process precedes a shorter one can be improved by swapping them, reducing the total waiting time. This proof establishes SJF as the optimal algorithm for minimizing average waiting time.

Q27. What is the waiting time for process P2 in the nonpreemptive SJF example with arrival times?

A.7ms ✅
B.0ms
C.8ms
D.5ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Nonpreemptive SJF: P1 runs 0-8. P2 arrives at 1, waits until 8, runs 8-12. P2 waiting time = 8 - 1 = 7ms. The waiting time calculation subtracts the arrival time from the start time because the process was not present in the ready queue before arrival.

Q28. What would be the average waiting time if the processes P1(6), P2(8), P3(7), P4(3) were scheduled in SJF order?

A.7ms ✅
B.8ms
C.9ms
D.10ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: SJF order: P4(3), P1(6), P3(7), P2(8). Waiting times: P4=0, P1=3, P3=9, P2=16. Sum=0+3+9+16=28. Average=28/4=7ms. This demonstrates the optimality of SJF compared to FCFS's 10.25ms average.

Q29. In the exponential average formula, what happens as more CPU bursts are measured?

A.The prediction becomes less accurate
B.The influence of the initial value τ₀ diminishes ✅
C.The prediction becomes constant
D.Recent history becomes less important
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: As more bursts are measured, the influence of the initial value τ₀ diminishes because each new term multiplies by (1-α)^n, which approaches zero as n grows. The prediction converges to reflect the actual burst behavior more accurately.

Q30. What is the minimum possible waiting time for a process in SJF scheduling?

A.0ms ✅
B.1ms
C.Its burst time
D.Cannot be determined
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The minimum possible waiting time is 0ms, which occurs when a process is the shortest and runs first. In the example, P4 waited 0ms because it was the shortest and ran first. Waiting time cannot be negative, so 0 is the absolute minimum.

Q31. Which of the following factors makes SJF difficult to implement in short-term scheduling?

A.The algorithm is too complex
B.CPU burst lengths are not known in advance ✅
C.It causes excessive overhead
D.It requires too much memory
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: SJF is difficult to implement in short-term scheduling because CPU burst lengths are not known in advance. While long-term scheduling can use user-specified time limits, short-term scheduling must predict burst lengths, leading to inaccuracies and making perfect SJF impossible.

Q32. How does the prediction error in exponential averaging affect SJF performance?

A.It has no effect on performance
B.It reduces the optimality of SJF ✅
C.It improves performance
D.It causes starvation
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When the exponential average prediction is inaccurate, the algorithm schedules based on predicted rather than actual burst lengths. This can lead to non-optimal scheduling decisions, reducing the average waiting time improvement that perfect SJF would achieve.

Q33. In the preemptive SJF example, why does P1 get preempted at time 1?

A.P1 has longer remaining time than P2's burst ✅
B.P1 terminates
C.P2 has higher priority
D.The time quantum expires
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: At time 1, P1 has used 1ms of its 8ms burst, leaving 7ms remaining. P2 arrives with a 4ms burst. Since P2's burst (4ms) is shorter than P1's remaining time (7ms), preemptive SJF preempts P1 and runs P2. This demonstrates the 'shortest remaining time' principle.

Q34. What is the turnaround time for process P4 in the preemptive SJF example?

A.10ms
B.7ms ✅
C.5ms
D.12ms
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: P4 arrives at time 3 with burst 5. It runs from time 5 to 10, completing at 10. Turnaround time = completion - arrival = 10 - 3 = 7ms. P4's waiting time was 2ms (3 to 5), and execution time was 5ms, giving a total turnaround of 7ms.

Q35. Which statement correctly describes the effect of Îą on the exponential average prediction?

A.Îą=0 gives maximum weight to recent history
B.Îą=1 gives minimum weight to recent history
C.α=0.5 gives equal weight to recent and past history ✅
D.Îą=0.5 gives no weight to recent history
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: α=0.5 gives equal weight to recent history (t_n) and past history (τ_n). This balanced approach is commonly used because it provides a reasonable compromise between responsiveness to changes and stability.

Q36. Why would a system designer choose nonpreemptive SJF over preemptive SJF?

A.To minimize average waiting time
B.To reduce context switching overhead ✅
C.To improve response time
D.To handle I/O-bound processes
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Nonpreemptive SJF reduces context switching overhead because processes are not interrupted mid-burst. Preemptive SJF incurs more context switches when new shorter processes arrive. In systems where context switching overhead is significant, nonpreemptive SJF might be preferred despite its slightly higher average waiting time.

Q37. If a process is the longest in a set, what is its waiting time under SJF?

A.0ms
B.Sum of all other burst lengths ✅
C.Equal to its own burst
D.Minimum waiting time
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The longest process in SJF runs last, so its waiting time equals the sum of all other processes' burst lengths. In the example P2(8) was longest and waited 16ms (3+6+7). This is the price of SJF's optimality for short processes.

Q38. What happens to the exponential average prediction if a process has a very long CPU burst after many short ones?

A.The prediction jumps to the long burst immediately
B.The prediction gradually increases toward the long burst ✅
C.The prediction stays short
D.The prediction becomes random
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The exponential average responds gradually to changes. A very long burst will cause the prediction to increase, but because past history still has some weight (when α<1), the prediction won't jump immediately to the long value. It will gradually adjust toward the new burst length.

Q39. What is the primary advantage of preemptive SJF over nonpreemptive SJF?

A.It has lower context switching overhead
B.It can achieve even lower average waiting times ✅
C.It is simpler to implement
D.It requires less memory
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Preemptive SJF can achieve lower average waiting times than nonpreemptive SJF because it can preempt a running process when a shorter process arrives. This gives shorter processes even faster service than nonpreemptive SJF, as demonstrated by the example where preemptive SJF achieved 6.5ms versus 7.75ms average waiting time.

Q40. Which scheduling algorithm is considered optimal for minimizing average waiting time but impractical for short-term scheduling?

A.FCFS
B.Round Robin
C.SJF ✅
D.Priority Scheduling
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: SJF is theoretically optimal for minimizing average waiting time but impractical for short-term scheduling because CPU burst lengths are unknown. While it's used in long-term scheduling where time limits are provided, short-term scheduling requires prediction methods that introduce inaccuracies.

Q41. In the exponential average formula, what does the term (1-α)^n τ₀ represent?

A.The weight of the nth burst
B.The weight of the initial prediction ✅
C.The weight of the most recent burst
D.The total prediction value
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: In the expanded formula, (1-α)^n τ₀ represents the contribution of the initial prediction τ₀ to the current prediction. As n increases, this term diminishes exponentially, showing how the initial value becomes less important as more measurements are taken.

Q42. What is the waiting time for process P1 in the preemptive SJF example with arrival times?

A.9ms ✅
B.8ms
C.10ms
D.7ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: P1 arrives at 0 with burst 8. It runs 0-1 (1ms), then waits from 1-10 (9ms), then runs 10-17 (7ms). Waiting time = 9ms. The total time from arrival to completion is 17ms, minus 8ms execution time = 9ms waiting time.

Q43. If the user specifies a time limit that is too high for long-term SJF scheduling, what is the likely effect?

A.The process will have shorter waiting time
B.The process may have longer waiting time because it's scheduled later ✅
C.The process will be rejected
D.The process will run immediately
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A higher time limit makes the process appear longer to the SJF scheduler, so it may be scheduled later after shorter processes. This increases waiting time. Users must balance lower time limits for faster response against the risk of exceeding the limit.

Q44. What is the relationship between the exponential average prediction and actual CPU bursts?

A.The prediction is always exactly correct
B.The prediction may be correct on average but individual predictions can be inaccurate ✅
C.The prediction is always too high
D.The prediction is always too low
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The exponential average provides a statistical prediction that is correct on average over many bursts, but individual predictions can be significantly inaccurate. This inherent uncertainty is why SJF is not perfect in practice and why other algorithms may be preferred despite SJF's theoretical optimality.

Q45. In nonpreemptive SJF with arrival times, what happens if a new process arrives while the CPU is running a longer process?

A.The current process is preempted
B.The new process is placed in the ready queue and waits ✅
C.The new process starts immediately
D.The current process is terminated
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: In nonpreemptive SJF, the current process continues running until it completes its burst, regardless of new arrivals. The new process joins the ready queue and will be scheduled when the CPU becomes free, based on burst length among all ready processes.

Q46. What is the maximum waiting time for a process in SJF scheduling?

A.Equal to its burst time
B.Sum of all shorter burst lengths ✅
C.Sum of all longer burst lengths
D.Always 0
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: In SJF, a process's waiting time equals the sum of all shorter burst lengths that run before it. The longest process waits the sum of all other bursts, while the shortest waits 0. This structure ensures that shorter processes have shorter waiting times, which minimizes the average.

Q47. How does the choice of Îą affect the stability of the exponential average prediction?

A.α=0 gives the most stable prediction ✅
B.Îą=1 gives the most stable prediction
C.Îą=0.5 gives the most stable prediction
D.Îą has no effect on stability
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: α=0 gives the most stable prediction because it ignores recent history and keeps the prediction constant (τ_{n+1} = τ_n). α=1 gives the least stable prediction because it fluctuates wildly with each new burst. The choice of α balances stability versus responsiveness.

Q48. Which of the following correctly describes the exponential average formula's behavior when a process has alternating short and long bursts?

A.The prediction alternates exactly with the bursts
B.The prediction smooths out the alternation ✅
C.The prediction becomes constant
D.The prediction follows only the short bursts
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The exponential average smooths out alternating short and long bursts, providing a running average that is less extreme than the individual bursts. With α=0.5, the prediction will converge to a value between the short and long bursts, representing an average behavior.

Q49. What is the completion time for process P3 in the preemptive SJF example?

A.26ms ✅
B.17ms
C.10ms
D.20ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: P3 arrives at time 2 with burst 9. It runs from time 17 to 26, completing at 26ms. P3 waited from time 2 to 17 (15ms) and executed for 9ms, giving a total completion time of 26ms. This makes P3 the last process to complete.

Q50. Why might a system designer prefer FCFS over SJF despite SJF's optimal average waiting time?

A.FCFS is always better
B.SJF may cause starvation of long processes ✅
C.SJF requires less memory
D.FCFS has lower context switching overhead
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: SJF can cause starvation of long processes if many short processes continuously arrive, preventing long processes from ever getting CPU time. FCFS prevents starvation by providing guaranteed service in arrival order, making it preferable in systems where fairness to long processes is important.

Q51. In the preemptive SJF example, why is P4 scheduled before P1's remaining burst?

A.P4 has higher priority
B.P4's burst (5ms) is shorter than P1's remaining time (7ms) ✅
C.P4 arrived earlier
D.P1 has already completed
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When P4 arrives at time 3, P1 has remaining time of 7ms (P1 used 1ms from 0-1, then P2 ran 1-5). P4's burst is 5ms, which is shorter than P1's 7ms remaining. Preemptive SJF schedules P4 before P1's remaining burst, and P4 runs from 5-10.

Q52. What is the effect of using Îą=1/2 in the exponential average formula on the weight of the most recent burst?

A.It has full weight
B.It has half weight ✅
C.It has no weight
D.It has quarter weight
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: With α=1/2, the most recent burst has a weight of 1/2, the previous burst has a weight of 1/4, the one before that 1/8, and so on. The total weight of all terms equals 1, creating an exponential decay of historical importance.

Q53. What is the effect of the exponential average's recursive definition on its memory usage?

A.It requires storing all previous burst lengths
B.It only requires storing the current prediction and the current burst ✅
C.It requires storing the entire history
D.It requires no storage
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The recursive definition τ_{n+1} = αt_n + (1-α)τ_n only requires storing the current prediction (τ_n) and the most recent burst (t_n). This efficient memory usage is one of the advantages of the exponential average approach.

Q54. If a system uses SJF with exponential average prediction and Îą=0.5, what happens when a process consistently has bursts of length 5?

A.The prediction oscillates wildly
B.The prediction converges to 5 ✅
C.The prediction stays at the initial value
D.The prediction becomes random
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When α=0.5 and bursts are consistently length 5, the prediction converges to 5. Starting from τ₀, the prediction approaches 5 as more bursts are measured, because the formula τ_{n+1} = 0.5*5 + 0.5*τ_n has a fixed point at 5.

Q55. Which scheduling approach provides the minimum average waiting time but is not practical without prediction?

A.FCFS
B.Round Robin
C.SJF ✅
D.Priority Scheduling
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: SJF provides the theoretical minimum average waiting time but is not practical for short-term scheduling because CPU burst lengths are unknown in advance. Prediction methods like exponential averaging are used to approximate SJF, but they cannot achieve perfect optimality.

Q56. What is the waiting time for process P1 in the nonpreemptive SJF example with arrival times?

A.0ms ✅
B.8ms
C.7ms
D.5ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: In nonpreemptive SJF with P1(0,8), P2(1,4), P3(2,9), P4(3,5): P1 arrives at 0 and runs first (nonpreemptive), completing at 8. P1's waiting time is 0ms because it starts immediately upon arrival. The nonpreemptive nature allows P1 to complete before any shorter processes are considered.

Q57. What is the primary tradeoff in choosing Îą for the exponential average formula?

A.Stability versus accuracy
B.Stability versus responsiveness ✅
C.Accuracy versus memory usage
D.Responsiveness versus memory usage
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The primary tradeoff in choosing α is stability versus responsiveness. Lower α values give more stable predictions but respond slowly to changes in burst behavior. Higher α values respond quickly to changes but can be unstable (fluctuate too much). α=0.5 provides a balance between these competing goals.

Q58. For the preemptive SJF example, what is the total time from start to finish (makespan)?

A.26ms ✅
B.24ms
C.20ms
D.18ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The preemptive SJF schedule runs from time 0 to time 26, as P3 completes at 26. The makespan is 26ms. This is the same as the sum of all bursts (8+4+9+5=26), as all processes complete without idle time.

Q59. Why is SJF scheduling considered optimal for a given set of processes?

A.It minimizes the maximum waiting time
B.It minimizes the sum of waiting times ✅
C.It maximizes throughput
D.It minimizes response time
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: SJF is optimal because it minimizes the sum of waiting times for a given set of processes. Any schedule where a longer process precedes a shorter one can be improved by swapping them. By induction, the SJF schedule where processes are ordered by increasing burst length minimizes the total waiting time.

🔗 Related Topics (MCQs)