Computer Science · Operating Systems · Video solution
25. Consider the following snapshot of a system Calculate AWT&ATAT using SRTF Pre-emptive…
Question
25. Consider the following snapshot of a system Calculate AWT&ATAT using SRTF Pre-emptive Scheduling algorithm.
Answer
Concept: SRTF Pre-emptive Scheduling
Step-by-step solution
1. Gantt Chart (0-1)
Time 0: P1 arrives • P1 starts execution • Runs for 1 unit
2. Gantt Chart (1-2)
Time 1: P2 arrives • P1 remaining: 7 • P2 burst: 4
3. Gantt Chart (2-3)
Time 2: P3 arrives • P2 remaining: 3 • P3 burst: 9
4. Gantt Chart (3-7)
Time 3: P4 arrives • P2 remaining: 2 • P4 burst: 5
5. Gantt Chart (7-30)
P4 (5) runs, completes at 12 • P1 (7) runs, completes at 19 • P3 (9) runs, completes at 28
6. Calculate Times
Completion Time (CT) • Turnaround Time (TAT) • Waiting Time (WT)
7. Average Times
Sum all WT, TAT • Divide by N=4
8. Yaad rakho / Key takeaway
SRTF minimizes average waiting time by pre-empting processes.
Remember
SRTF minimizes average waiting time by pre-empting processes.
Common mistake
Forgetting to pre-empt when a new process arrives with shorter burst time.
Got a doubt like this?
Scan your question and Doubtclip makes a whiteboard video solution for it.