Go Back

A Quick Abstract:

1. Introduction to SRTF (Preemptive SJF):

Definition:

Shortest Remaining Time First (SRTF) is a preemptive CPU scheduling algorithm where the process with the shortest remaining burst time is selected for execution. If a new process arrives with a shorter burst time than the currently executing process, it preempts the CPU.

2. Burst Time and Arrival:

Burst Time:

Each process has an associated burst time, representing the total time it requires on the CPU.

Arrival of Processes:

Processes are added to the ready queue upon arrival.

3. Execution and Preemption:

Execution:

The process with the shortest remaining burst time is selected for execution.

If a new process arrives with a shorter burst time than the currently executing process, preemption occurs.

4. Waiting Time and Turnaround Time:

Waiting Time:

Waiting time is the cumulative time a process spends in the ready queue.

Turnaround Time:

Turnaround time is the overall time taken by a process from submission to completion.

5. Pros and Cons:

Pros:

Optimizes turnaround time by prioritizing processes with the shortest remaining burst time.

Efficient for processes with varying burst times.

Cons:

May result in increased context-switching overhead due to frequent preemption.

6. Starvation:

SRTF is designed to minimize starvation, as shorter processes are given priority, but longer processes may still experience delays.

7. Example Scenario:

Consider processes A, B, and C with burst times 6, 4, and 8, respectively.

A → B → A → C → B → A → C → ... (and so on)

Processes are selected based on their remaining burst time, allowing for dynamic adjustments as new processes arrive.

8. Conclusion:

Shortest Remaining Time First (SRTF) is a preemptive scheduling algorithm that dynamically adapts to the burst times of arriving processes. While it optimizes turnaround time, careful consideration is needed to mitigate the potential increase in context-switching overhead.

Notes From The Slides:



Shortest-Remaining-Time-First (SRTF)

take the process with shortest remaining (still needed) CPU burst time (to finish the process)

Example of SRTF (Preemptive SJF)

Process

Arival Time

Burst Time

P1

0

8

P2

1

4

P3

2

9

P4

3

5

Example of SRTF (cont.)

Process

Arival Time

Burst Time

P1

0

8

P2

1

4

P3

2

9

P4

3

5