Preemptive Scheduling

Preemptive Scheduling (Round Robin) problems involve scheduling processes where each process runs for a fixed time quantum before being preempted. You need to calculate average completion time or turnaround time.

10Worksheets
200+Practice Questions
AdvancedDifficulty
3-4 hoursHours to Master

Introduction to Preemptive Scheduling

Preemptive Scheduling (Round Robin) problems involve scheduling processes where each process runs for a fixed time quantum before being preempted. You need to calculate average completion time or turnaround time.

Prerequisites

Round Robin algorithm Time quantum Completion time calculation Average calculation
Why This Matters: Preemptive Scheduling problems appear in 1-2 questions in computer science exams and CAT. They test OS scheduling concepts.

How to Solve Preemptive Scheduling Problems

1

Step 1: List processes with burst times

2

Step 2: Set time quantum (Q)

3

Step 3: Simulate Round Robin: each process runs for Q or until completion

4

Step 4: Track completion time for each process

5

Step 5: Calculate average completion time = sum(completion times) / n

6

Step 6: Answer with average

Pro Strategy: Simulate timeline. Each process gets Q time units until its burst is exhausted. Completion time when burst reaches 0.

Example Problem

Example: Processes: P1(5), P2(3), P3(4). Time quantum = 2. Average completion time? Solution: Step 1: Order: P1(2), P2(2), P3(2), P1(2), P2(1), P3(2), P1(1) Step 2: Timeline: 0-2(P1),2-4(P2),4-6(P3),6-8(P1),8-9(P2),9-11(P3),11-12(P1) Step 3: Completion: P1=12, P2=9, P3=11 Step 4: Average = (12+9+11)/3 = 32/3 = 10.67 Answer: 10.67

Pro Tips & Tricks

  • Round Robin: each process gets Q time, then next in queue
  • If burst < Q, process completes and leaves
  • New processes go to end of queue
  • Completion time = last time process runs

Shortcut Methods to Solve Faster

If Q is large (≥ max burst), Round Robin = FCFS
If Q is very small, approximates processor sharing
Average completion time decreases with smaller Q? Actually increases due to overhead

Common Mistakes to Avoid

Forgetting to add processes to queue when they arrive
Assuming processes are in FCFS order (they are, but with preemption)
Not tracking remaining burst time correctly
Miscalculating completion times

Exam Importance

Preemptive Scheduling is an important topic for various competitive exams. Here's how frequently it appears:

SSC CGL
0-1 questions
BANKING PO
0-1 questions
RAILWAYS RRB
0-1 questions
CAT
1-2 questions
INSURANCE
0-1 questions

Ready to Master Preemptive Scheduling?

Start with Worksheet 1 and work your way up to expert level! Each worksheet includes:

20 practice questions
Detailed solutions
Step-by-step explanations
Start Practicing Now