0
0
Operating Systemsknowledge~20 mins

Priority scheduling in Operating Systems - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Priority Scheduling Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Priority Scheduling Basics

In priority scheduling, processes are assigned priorities. The CPU is allocated to the process with the highest priority first.

Which statement best describes what happens if two processes have the same priority?

AThe CPU randomly selects one of the processes.
BThe process with the longer burst time is scheduled first.
CThe process that arrived first is scheduled first.
DBoth processes run simultaneously.
Attempts:
2 left
💡 Hint

Think about how operating systems handle ties in priority.

📋 Factual
intermediate
2:00remaining
Preemptive vs Non-preemptive Priority Scheduling

Which of the following correctly distinguishes preemptive priority scheduling from non-preemptive priority scheduling?

AIn non-preemptive scheduling, processes are interrupted by higher priority processes; in preemptive, they run to completion.
BPreemptive scheduling ignores process priority when scheduling.
CBoth preemptive and non-preemptive scheduling always run processes to completion without interruption.
DIn preemptive scheduling, a running process can be interrupted if a higher priority process arrives; in non-preemptive, it cannot.
Attempts:
2 left
💡 Hint

Consider what happens when a higher priority process arrives while another is running.

🔍 Analysis
advanced
3:00remaining
Calculating Average Waiting Time

Given three processes with arrival times and priorities:

  • P1: arrival=0, burst=4, priority=2
  • P2: arrival=1, burst=3, priority=1
  • P3: arrival=2, burst=1, priority=3

Using preemptive priority scheduling (lower number means higher priority), what is the average waiting time?

A2.67 units
B2.0 units
C1.0 units
D0.67 units
Attempts:
2 left
💡 Hint

Simulate the process execution timeline considering preemption by higher priority processes.

Comparison
advanced
2:00remaining
Effect of Aging in Priority Scheduling

What is the main purpose of aging in priority scheduling?

ATo assign fixed priorities based on process arrival time.
BTo increase the priority of waiting processes over time to prevent starvation.
CTo randomly change priorities to balance CPU usage.
DTo decrease the priority of all processes to speed up execution.
Attempts:
2 left
💡 Hint

Think about how aging helps processes that wait too long.

Reasoning
expert
2:00remaining
Identifying Starvation Scenario

Consider a priority scheduling system where priorities range from 1 (highest) to 5 (lowest). If a low priority process arrives and there is a continuous stream of higher priority processes, what will happen to the low priority process?

AIt will wait indefinitely and may never get CPU time (starvation).
BIt will run immediately after arrival regardless of other processes.
CIt will preempt higher priority processes after a fixed time.
DIt will be assigned a higher priority automatically.
Attempts:
2 left
💡 Hint

Consider what happens when higher priority processes keep arriving.