SRTF Scheduling

Duration: 7 min

This video lesson is available to enrolled students.

Enroll to watch — ISRO Scientist/Engineer 'SC'

AI Summary

An AI-generated summary of this video lecture.

The video provides a comprehensive lecture on the Shortest Remaining Time First (SRTF) scheduling algorithm, a pre-emptive variant of Shortest Job First. The instructor begins by defining SRTF, explaining that whenever a new process enters the ready state, a scheduling decision is re-evaluated. If the new process has a smaller CPU burst requirement than the remaining burst of the currently running process, the running process is pre-empted. The instructor highlights that this algorithm is considered "optimal" because it guarantees the minimal average waiting time for a given set of processes. Following the theoretical introduction, the instructor demonstrates the algorithm using a numerical example involving five processes (P0 to P4) with specific arrival and burst times. He constructs a Gantt chart to visualize the execution order, showing how processes are interrupted and resumed based on their remaining burst times. In the final segment, the instructor calculates the Completion Time (CT), Turn Around Time (TAT), and Waiting Time (WT) for each process using standard formulas, culminating in the calculation of the average waiting time.

Chapters

  1. 0:00 2:00 00:00-02:00

    The instructor introduces the Shortest Remaining Time First (SRTF) algorithm as a pre-emptive scheduling strategy. On-screen text explains that whenever a process enters the ready state, a scheduling decision is made. If the new process has a smaller CPU burst requirement than the remaining CPU burst of the running process, the running process is pre-empted. The text also notes this version is called "optimal" as it guarantees minimal average waiting time. The instructor verbally reinforces these points, emphasizing the dynamic nature of the decision-making process in SRTF compared to non-preemptive algorithms.

  2. 2:00 5:00 02:00-05:00

    The instructor sets up a numerical problem with five processes: P0 (AT=1, BT=7), P1 (AT=2, BT=5), P2 (AT=3, BT=1), P3 (AT=4, BT=2), and P4 (AT=5, BT=8). He draws a Gantt chart timeline at the bottom of the screen. He marks the start at t=0. At t=1, P0 arrives and starts running. At t=2, P1 arrives; since P1's burst (5) is less than P0's remaining time (6), P0 is pre-empted and P1 starts. At t=3, P2 arrives; P2's burst (1) is less than P1's remaining time (4), so P1 is pre-empted. P2 finishes at t=4. P3 arrives and runs. At t=5, P4 arrives, but P3 continues as its remaining time is shorter. P3 finishes at t=6. Then P1 (remaining 4) is chosen over P0 (remaining 6) and P4 (burst 8). P1 finishes at t=10. P0 runs next and finishes at t=16. Finally, P4 runs and finishes at t=24. The timeline visually confirms the sequence: P0, P1, P2, P3, P1, P0, P4.

  3. 5:00 6:44 05:00-06:44

    The instructor focuses on filling the table columns for Completion Time (CT), Turn Around Time (TAT), and Waiting Time (WT). He writes the CT values based on the Gantt chart: P0=16, P1=10, P2=4, P3=6, P4=24. He then applies the formula TAT = CT - AT. For P0, TAT = 16 - 1 = 15. For P1, TAT = 10 - 2 = 8. For P2, TAT = 4 - 3 = 1. For P3, TAT = 6 - 4 = 2. For P4, TAT = 24 - 5 = 19. Next, he calculates WT = TAT - BT. P0 WT = 15 - 7 = 8. P1 WT = 8 - 5 = 3. P2 WT = 1 - 1 = 0. P3 WT = 2 - 2 = 0. P4 WT = 19 - 8 = 11. Finally, he sums the waiting times (8 + 3 + 0 + 0 + 11 = 22) and divides by 5 to get the average waiting time of 4.4.

The lecture effectively bridges theory and practice by first defining the SRTF algorithm's pre-emptive nature and its optimality claim. It then transitions into a step-by-step numerical demonstration, visually constructing a Gantt chart to track process execution and pre-emption events. Finally, it reinforces the learning by calculating key performance metrics like Turn Around Time and Waiting Time, culminating in the average waiting time calculation. This progression ensures students understand not just the "what" of SRTF, but the "how" of its implementation and evaluation.