Non preemptive scheduling โ Solved Gate%20 Question Papers
Non preemptive scheduling โ Solved Gate%20 Question Papers
Absolutely! Hereโs a complete breakdown of Non-Preemptive Scheduling with a solved GATE-style question, including explanation, table, and Gantt chart โ tailored for GATE CSE/IT aspirants.
Contents [hide]
Topic: Non-Preemptive Scheduling
Subject: Operating System
GATE Relevance: High
Type: Numerical-based Questions (Process Scheduling)
What is Non-Preemptive Scheduling?
In Non-Preemptive Scheduling, once a process starts executing on the CPU, it cannot be stopped until it completes. The CPU is assigned only after the current process finishes.
This contrasts with Preemptive scheduling, where the CPU can be taken away by a higher-priority task.
Common Non-Preemptive Scheduling Algorithms:
Algorithm | Description |
---|---|
FCFS (First Come First Serve) | Processed in order of arrival |
SJF (Shortest Job First) | Process with shortest burst time first |
Priority Scheduling (Non-preemptive) | Highest priority (lowest number) runs first |
Solved GATE-Style Question: SJF (Non-Preemptive)
Question:
Consider the following processes:
Process | Arrival Time | Burst Time |
---|---|---|
P1 | 0 ms | 8 ms |
P2 | 1 ms | 4 ms |
P3 | 2 ms | 9 ms |
P4 | 3 ms | 5 ms |
Use Non-Preemptive SJF Scheduling.
Find the Average Waiting Time and Average Turnaround Time.
Step 1: Gantt Chart (SJF โ Shortest Job First)
Initial time = 0, only P1 has arrived โ Execute P1
At time 8, P2, P3, P4 have arrived
Shortest burst time among them = P2 (4ms)
Next = P4 (5ms)
Then = P3 (9ms)
Gantt Chart:
Step 2: Calculate Completion, Turnaround, and Waiting Times
Process | Arrival Time | Burst Time | Completion Time | Turnaround Time (CT โ AT) | Waiting Time (TAT โ BT) |
---|---|---|---|---|---|
P1 | 0 | 8 | 8 | 8 | 0 |
P2 | 1 | 4 | 12 | 11 | 7 |
P3 | 2 | 9 | 26 | 24 | 15 |
P4 | 3 | 5 | 17 | 14 | 9 |
Final Answers:
-
Average Waiting Time = (0 + 7 + 15 + 9) / 4 = 7.75 ms
-
Average Turnaround Time = (8 + 11 + 24 + 14) / 4 = 14.25 ms
Summary:
Metric | Value |
---|---|
Avg Waiting Time | 7.75 ms |
Avg Turnaround Time | 14.25 ms |
Key Concepts to Remember:
-
In Non-preemptive SJF, CPU waits for a process to finish before giving it to the next.
-
Always update available processes at each CPU idle time.
-
For equal burst times, use arrival time as tie-breaker.
Want more GATE previous year solved papers for OS scheduling?
I can generate a full PDF set, practice quizzes, or custom short tricks โ just let me know what format you prefer!