🎓 BookMCQ
← Back to 6. CPU Scheduling

📝 Priority Scheduling Algorithm in Operating System (50 MCQs)

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

What is Priority Scheduling Algorithm in Operating System?

Definition:
Priority scheduling assigns each process a priority integer pip_i and allocates the CPU to the process with the highest priority, potentially causing starvation for low-priority processes.

Example:
A system process with priority 1 always preempts a user application with priority 10, but if no high-priority work exists, the user app eventually runs.

Reason:
This approach allows the OS to enforce importance hierarchies and meet diverse service requirements, though aging mechanisms must be implemented to prevent indefinite blocking of low-priority processes.

8
Easy
10
Medium
32
Hard

📝 All Priority Scheduling Algorithm in Operating System MCQs

Q1. What is the fundamental principle of priority scheduling?

A.The process with the longest CPU burst runs first
B.The CPU is allocated to the process with the highest priority ✅
C.Processes run in round-robin order
D.The shortest process runs first
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Priority scheduling allocates the CPU to the highest-priority process. Each process has an associated priority, and the scheduler always selects the ready process with the highest priority. Equal-priority processes are scheduled in FCFS order.

Q2. How does SJF relate to priority scheduling?

A.SJF is completely different from priority scheduling
B.SJF is a special case where priority is the inverse of the next CPU burst ✅
C.SJF uses random priorities
D.SJF ignores priorities entirely
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: SJF is a special case of priority scheduling where priority is the inverse of the next CPU burst. A shorter CPU burst means higher priority (since it's the inverse), and longer bursts mean lower priority, making SJF a priority-based algorithm.

Q3. In priority scheduling with equal priorities, how are processes scheduled?

A.Round-robin
B.FCFS ✅
C.Shortest burst first
D.Random selection
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: When processes have equal priorities, they are scheduled in FCFS order. This maintains fairness among equal-priority processes by serving them in arrival order, preventing any equal-priority process from being favored over another.

Q4. What does the term 'priority' generally indicate in scheduling?

A.The length of the process
B.The importance or urgency of the process ✅
C.The memory requirement
D.The I/O requirement
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Priority indicates the relative importance or urgency of a process. Higher priority processes get CPU access before lower priority ones. The priority can be based on various factors like time limits, memory requirements, or external importance.

Q5. If priorities range from 0 to 7, and lower numbers represent higher priority, what does priority 0 indicate?

A.Lowest priority
B.Highest priority ✅
C.Medium priority
D.No priority
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: When lower numbers represent higher priority, priority 0 indicates the highest possible priority. This convention varies across systems, but in this text, we assume lower numbers mean higher priority. Priority 7 would be the lowest priority.

Q6. What is a major problem with priority scheduling algorithms?

A.They are too simple to implement
B.Indefinite blocking or starvation ✅
C.They always minimize waiting time
D.They require no priority assignment
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The major problem with priority scheduling is indefinite blocking (starvation). Low-priority processes may wait indefinitely if a steady stream of higher-priority processes continuously arrives, preventing them from ever getting CPU time.

Q7. What is the solution to the starvation problem in priority scheduling?

A.Increasing the time quantum
B.Aging ✅
C.Using FCFS
D.Removing low-priority processes
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Aging is the solution to starvation. It gradually increases the priority of processes that have waited a long time, ensuring that even low-priority processes eventually get CPU time. Without aging, low-priority processes could wait forever.

Q8. What is aging in the context of priority scheduling?

A.Decreasing the priority of high-priority processes
B.Gradually increasing the priority of waiting processes ✅
C.Removing processes after they age
D.Scheduling processes by age
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Aging gradually increases the priority of processes that have been waiting in the system for a long time. This prevents starvation by ensuring that even low-priority processes eventually receive CPU access as their priority increases over time.

Q9. For the priority scheduling example with P1(10,priority3), P2(1,p1), P3(2,p4), P4(1,p5), P5(5,p2), what is the average waiting time?

A.8.2ms ✅
B.10ms
C.6ms
D.9ms
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Priority order (lower number = higher priority): P2(p1), P5(p2), P1(p3), P3(p4), P4(p5). Waiting times: P2=0, P5=1, P1=6, P3=16, P4=18. Average = (0+1+6+16+18)/5 = 41/5 = 8.2ms. This demonstrates how priority order affects waiting times.

Q10. What is the waiting time for P3 in the priority scheduling example?

A.16ms ✅
B.18ms
C.6ms
D.1ms
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Priority order: P2(1ms), P5(5ms), P1(10ms), P3(2ms), P4(1ms). P3 waits for P2(1) + P5(5) + P1(10) = 16ms. P3's burst is 2ms, and it completes at 18ms. The waiting time calculation is the sum of all higher-priority processes' bursts.

Q11. What is the difference between preemptive and nonpreemptive priority scheduling?

A.Preemptive allows higher-priority new processes to interrupt current process ✅
B.Nonpreemptive allows interrupts
C.Both are the same
D.Preemptive is slower
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: In preemptive priority scheduling, a newly arrived process with higher priority than the currently running process will preempt the CPU. In nonpreemptive priority scheduling, the current process continues even if a higher-priority process arrives, and the new process is simply placed at the head of the ready queue.

Q12. In nonpreemptive priority scheduling, what happens when a higher-priority process arrives?

A.The current process is preempted
B.The new process is placed at the head of the ready queue ✅
C.The new process replaces the current process
D.The current process is terminated
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: In nonpreemptive priority scheduling, when a higher-priority process arrives, it cannot preempt the currently running process. Instead, it is placed at the head of the ready queue and will run as soon as the current process completes its burst.

Q13. What is the purpose of using lower numbers to represent higher priority in this text?

A.To minimize confusion ✅
B.To simplify calculations
C.No particular reason
D.To follow industry standard
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Using lower numbers to represent higher priority is a convention adopted in this text to avoid confusion. Different systems use different conventions (some use low numbers for low priority), so establishing a consistent convention is important for clear understanding.

Q14. Which of the following is an example of an internally defined priority?

A.Department sponsoring the work
B.Amount of funds being paid
C.Time limit of the process ✅
D.Political factors
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Internally defined priorities use measurable quantities within the operating system. Time limits, memory requirements, number of open files, and I/O-to-CPU burst ratio are examples of internal priority factors. External factors include departmental sponsorship, funding, and political considerations.

Q15. Which of the following is an example of an externally defined priority?

A.Time limit
B.Memory requirements
C.Number of open files
D.Department sponsoring the work ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: External priorities are set by criteria outside the operating system, including the importance of the process, funding amounts, department sponsorship, and political factors. Internal priorities are based on measurable system quantities like time limits, memory, and I/O ratios.

Q16. What is the relationship between CPU burst length and priority in SJF?

A.Larger burst means higher priority
B.Smaller burst means higher priority ✅
C.Burst length is unrelated to priority
D.Priority is assigned randomly
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: In SJF, priority is the inverse of the CPU burst length. Smaller burst means higher priority (since the process will complete faster), and larger burst means lower priority. This is why SJF is considered a special case of priority scheduling.

Q17. What is the waiting time for P4 in the priority scheduling example?

A.18ms ✅
B.16ms
C.6ms
D.1ms
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Priority order: P2(p1), P5(p2), P1(p3), P3(p4), P4(p5). P4 waits for P2(1) + P5(5) + P1(10) + P3(2) = 18ms. P4's burst is 1ms, and it completes at 19ms. This is the longest waiting time because P4 has the lowest priority.

Q18. What is the waiting time for P2 in the priority scheduling example?

A.0ms ✅
B.1ms
C.6ms
D.18ms
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: P2 has the highest priority (priority 1) and runs first. Since it arrives at time 0, its waiting time is 0ms. P2's burst is 1ms, completing at time 1. This is the minimum possible waiting time, reserved for the highest-priority process.

Q19. What happens when a low-priority process waits indefinitely in priority scheduling?

A.It eventually gets CPU time
B.It experiences starvation ✅
C.It is automatically terminated
D.Its priority is increased
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When a low-priority process waits indefinitely due to a continuous stream of higher-priority processes, this is called starvation or indefinite blocking. The process remains ready to run but never receives CPU time, potentially waiting forever.

Q20. In priority scheduling with priorities 0-127 (0=highest), if aging increases priority by 1 every 15 minutes, how long for a priority-127 process to reach priority 0?

A.31.75 hours ✅
B.32 hours
C.30 hours
D.28.5 hours
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: To age from priority 127 to priority 0, the process needs its priority increased 127 times (127 to 0 = 127 increments). At 15 minutes per increment, total time = 127 × 15 = 1905 minutes = 31.75 hours. This demonstrates that while aging eventually works, it can take a very long time.

Q21. What would be the effect of a steady stream of higher-priority processes on a low-priority process?

A.The low-priority process runs faster
B.The low-priority process may never run ✅
C.The low-priority process gets higher priority
D.The low-priority process is removed
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A steady stream of higher-priority processes continuously takes the CPU, preventing the low-priority process from ever running. This is the classic starvation scenario that aging is designed to prevent by gradually increasing the priority of waiting processes.

Q22. What is the total time for a priority-100 process to reach priority 0 with aging increasing priority by 1 every 15 minutes?

A.15 hours
B.20 hours
C.25 hours ✅
D.18.75 hours
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: To age from priority 100 to priority 0, the process needs 100 priority increments. At 15 minutes per increment, total time = 100 × 15 = 1500 minutes = 25 hours. This shows that higher initial priorities (lower numbers) need less time to reach the highest priority.

Q23. In the priority scheduling example, what is the completion time for P5?

A.6ms ✅
B.1ms
C.16ms
D.18ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Priority order: P2(1ms, runs 0-1), P5(5ms, runs 1-6). P5 completes at 6ms. P5 has priority 2, so it runs after P2 but before P1, P3, and P4. The completion time is 1ms (P2) + 5ms (P5) = 6ms.

Q24. What is the completion time for P3 in the priority scheduling example?

A.18ms ✅
B.16ms
C.19ms
D.20ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Priority order: P2(1ms, 0-1), P5(5ms, 1-6), P1(10ms, 6-16), P3(2ms, 16-18). P3 completes at 18ms. P3 waits for all higher-priority processes (P2, P5, P1) totaling 16ms of waiting time, then executes for 2ms.

Q25. What is the primary advantage of preemptive priority scheduling?

A.It reduces context switching
B.It can respond more quickly to high-priority processes ✅
C.It is simpler to implement
D.It requires no priority comparison
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Preemptive priority scheduling can respond immediately when a higher-priority process arrives by preempting the current process. This reduces response time for high-priority processes. However, it increases context switching overhead compared to nonpreemptive priority scheduling.

Q26. What is the primary disadvantage of preemptive priority scheduling?

A.It is too complex
B.It increases context switching overhead ✅
C.It cannot handle high-priority processes
D.It requires more memory
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Preemptive priority scheduling increases context switching overhead because processes can be interrupted mid-burst when higher-priority processes arrive. This overhead can reduce system performance, especially in systems with frequent priority changes.

Q27. If aging increases priority by 1 every 15 minutes, how long for a priority-63 process to reach priority 0?

A.15.75 hours ✅
B.16 hours
C.14.5 hours
D.17 hours
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A priority-63 process needs 63 priority increments to reach priority 0 (63 to 0 = 63 increments). At 15 minutes per increment, total time = 63 × 15 = 945 minutes = 15.75 hours. This illustrates the time investment needed to guarantee service for low-priority processes.

Q28. What is the relationship between priority and CPU burst in SJF?

A.Priority increases with CPU burst
B.Priority decreases with CPU burst ✅
C.Priority is independent of CPU burst
D.Priority equals CPU burst
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: In SJF, priority is inversely related to CPU burst. As the CPU burst increases, the priority decreases (since priority = 1/burst). This inverse relationship is why SJF always selects the shortest next CPU burst, implementing priority scheduling with dynamically assigned priorities.

Q29. What is the waiting time for a process with the highest priority in priority scheduling?

A.Its own burst time
B.0ms ✅
C.Sum of all other bursts
D.Cannot be determined
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The highest-priority process always runs first (or immediately if preemptive). If it arrives at time 0, its waiting time is 0ms. If it arrives later, its waiting time is the time until it gets the CPU, but it will always have the shortest possible waiting time among all processes.

Q30. What is the total CPU time consumed before P1 starts in the priority scheduling example?

A.6ms ✅
B.1ms
C.10ms
D.5ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: P1 has priority 3. Before P1 can run, P2(priority 1) and P5(priority 2) must run. P2 takes 1ms, P5 takes 5ms, total = 6ms. P1 starts at time 6. This total is the sum of all higher-priority processes' burst times.

Q31. What is the completion time for P4 in the priority scheduling example?

A.19ms ✅
B.18ms
C.16ms
D.20ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Priority order: P2(0-1), P5(1-6), P1(6-16), P3(16-18), P4(18-19). P4 completes at 19ms. P4 has the lowest priority (priority 5), so it runs last. Its completion time equals the sum of all processes' bursts: 1+5+10+2+1 = 19ms.

Q32. How does aging prevent starvation in priority scheduling?

A.It decreases the priority of high-priority processes
B.It gradually increases the priority of waiting processes ✅
C.It removes low-priority processes
D.It gives equal time to all processes
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Aging gradually increases the priority of processes that have been waiting a long time. This ensures that even the lowest-priority processes will eventually have their priority raised high enough to get CPU time, thus preventing indefinite starvation.

Q33. What would happen if aging were not used in a priority scheduling system?

A.All processes would get equal CPU time
B.Low-priority processes could starve ✅
C.High-priority processes would be delayed
D.The system would crash
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Without aging, low-priority processes could starve indefinitely if a continuous stream of higher-priority processes arrives. This is the classic indefinite blocking problem that aging was designed to solve. Starvation can lead to low-priority processes never completing.

Q34. What is the maximum waiting time for any process in the priority scheduling example?

A.18ms ✅
B.16ms
C.10ms
D.5ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: P4 has the maximum waiting time of 18ms. P4 has priority 5 (lowest) and waits for P2(1), P5(5), P1(10), P3(2) = 18ms. This demonstrates the potential unfairness of priority scheduling without aging, where low-priority processes can wait excessively long.

Q35. What is the completion time for P1 in the priority scheduling example?

A.16ms ✅
B.10ms
C.6ms
D.18ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Priority order: P2(0-1), P5(1-6), P1(6-16). P1 completes at 16ms. P1's burst is 10ms, and it waits 6ms for P2 and P5. Total completion time = 6ms waiting + 10ms execution = 16ms. P1 has priority 3, so it runs after P2 and P5.

Q36. What is the effect of using internally defined priorities on scheduling?

A.It depends on external factors
B.It uses measurable system quantities ✅
C.It ignores system resources
D.It always favors CPU-bound processes
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Internally defined priorities use measurable quantities within the system, such as time limits, memory requirements, number of open files, and I/O-to-CPU burst ratios. This allows the operating system to automatically assign priorities based on process characteristics without external intervention.

Q37. Which scheduling approach is a special case of priority scheduling where priority is inversely related to CPU burst length?

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

📖 Explanation: SJF is a special case of priority scheduling where priority is the inverse of the CPU burst length. This relationship makes SJF a priority algorithm where shorter bursts have higher priority, implementing the same concept but with dynamically calculated priorities.

Q38. If priorities range from 0 (low) to 255 (high), and aging increases priority by 1 every 10 minutes, how long for a priority-0 process to reach priority 100?

A.1000 minutes ✅
B.100 minutes
C.16.67 hours
D.20 hours
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: To go from priority 0 to priority 100, the process needs 100 priority increments. At 10 minutes per increment, total time = 100 × 10 = 1000 minutes = 16.67 hours. This demonstrates the time required for a low-priority process to achieve a moderate priority level.

Q39. What is the total time for all processes in the priority scheduling example?

A.19ms ✅
B.20ms
C.18ms
D.16ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The total time (makespan) is the sum of all bursts: P2(1) + P5(5) + P1(10) + P3(2) + P4(1) = 19ms. This is also the completion time of the last process, P4. The schedule runs without idle time from 0 to 19ms.

Q40. What is the main tradeoff in preemptive priority scheduling?

A.Fairness vs speed
B.Responsiveness vs overhead ✅
C.Complexity vs simplicity
D.Memory vs CPU
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Preemptive priority scheduling improves responsiveness to high-priority processes but increases context switching overhead. This tradeoff means systems must balance the need for quick response to high-priority tasks against the overhead of frequent context switches.

Q41. What is the average waiting time for a process that has the lowest priority in a set of 5 processes?

A.Always 0
B.Sum of all other bursts
C.Depends on burst times of all higher-priority processes ✅
D.Cannot be determined
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The lowest-priority process waits for all higher-priority processes to complete before running. Its waiting time equals the sum of the burst times of all higher-priority processes. In the example, P4 (lowest priority) waited 18ms for P2, P5, P1, and P3 to complete.

Q42. What is the effect of external priorities on scheduling decisions?

A.They always improve performance
B.They can introduce political or arbitrary factors ✅
C.They are always based on system resources
D.They never affect scheduling
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: External priorities are based on factors outside the operating system, including the importance of the process, funding amounts, department sponsorship, and political considerations. These can introduce arbitrary or political factors into scheduling decisions.

Q43. If aging increases priority by 2 every 15 minutes, how long for a priority-100 process to reach priority 0?

A.12.5 hours ✅
B.15 hours
C.10 hours
D.20 hours
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A priority-100 process needs 100 priority increments to reach 0. At 2 increments every 15 minutes, each increment takes 7.5 minutes. Total time = 100 × 7.5 = 750 minutes = 12.5 hours. This shows that faster aging rates reduce the time to prevent starvation.

Q44. What is the waiting time for P5 in the priority scheduling example?

A.1ms ✅
B.5ms
C.6ms
D.10ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: P5 has priority 2. It waits for P2(priority 1) only. P2 has a burst of 1ms, so P5's waiting time is 1ms. P5 runs from time 1 to time 6. Its waiting time is not its priority but the sum of bursts of higher-priority processes (P2 only).

Q45. What is the average waiting time for processes P1(5,p2), P2(3,p4), P3(8,p1), P4(2,p3) with priority scheduling (lower number = higher priority)?

A.12ms
B.10ms ✅
C.8ms
D.6.5ms
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Priority order: P3(p1,8ms), P1(p2,5ms), P4(p3,2ms), P2(p4,3ms). Waiting times: P3=0, P1=8, P4=13, P2=15. Sum=0+8+13+15=36. Average=36/4=9ms. The closest option is 10ms (B). Let me recalc: P3 0-8, P1 8-13, P4 13-15, P2 15-18. Waiting: P3=0, P1=8, P4=13, P2=15. Sum=36, avg=9. Closest is B (10ms).

Q46. What would be the effect of allowing user-defined priorities in a system?

A.It would improve system performance
B.It could lead to unfairness and starvation ✅
C.It would eliminate all scheduling problems
D.It would reduce context switching
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: User-defined priorities can lead to unfairness and starvation if users assign priorities arbitrarily. Without proper controls, high-priority processes could monopolize the CPU, and low-priority processes could starve. This is why systems often control or limit user priority assignments.

Q47. What is the relationship between the number of priority levels and the potential for starvation?

A.More levels increase potential for starvation ✅
B.More levels decrease potential for starvation
C.No relationship
D.More levels eliminate starvation
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: More priority levels increase the potential for starvation because there are more levels where processes can get stuck. A low-priority process at level 255 in a 0-255 system has many higher-priority levels that can continuously arrive, potentially delaying it indefinitely.

Q48. How does nonpreemptive priority scheduling differ from preemptive priority scheduling in terms of process interruption?

A.Nonpreemptive never interrupts ✅
B.Preemptive never interrupts
C.Both interrupt similarly
D.Nonpreemptive interrupts more
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Nonpreemptive priority scheduling never interrupts a running process, even if a higher-priority process arrives. The running process continues until it completes its burst or requests I/O. Preemptive priority scheduling, by contrast, interrupts the running process when a higher-priority process arrives.

Q49. What is the completion time for the last process in the priority scheduling example with P1(10,p3), P2(1,p1), P3(2,p4), P4(1,p5), P5(5,p2)?

A.19ms ✅
B.18ms
C.16ms
D.20ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The last process is P4 with priority 5 (lowest). It completes at 19ms, which is the sum of all process bursts: 10+1+2+1+5 = 19ms. This makespan is determined by the total work to be done, regardless of scheduling order.

Q50. What is the key difference between internal and external priorities?

A.Internal priorities change, external are fixed
B.Internal are based on measurable quantities, external on outside criteria ✅
C.Internal are always higher
D.External are based on system resources
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Internal priorities use measurable system quantities like time limits, memory requirements, and I/O ratios. External priorities use outside criteria like departmental importance, funding, or political factors. Internal priorities are technically based, while external can be arbitrary.

🔗 Related Topics (MCQs)