operating-systems scheduling

Definition

Shortest Process Next (SPN)

Shortest Process Next (SPN) is a scheduling strategy that selects the process with the shortest expected CPU burst time.

Characteristics

  • Selection Function: The process with the minimum estimated execution time is chosen.
  • Decision Mode: Non-preemptive.

Advantages and Disadvantages

  • Pros:
    • Significantly improves Response Times for short processes compared to FCFS.
    • Proven to be optimal for minimising the average wait time in a non-preemptive environment.
  • Cons:
    • Starvation: Long processes may never run if there is a steady stream of short processes.
    • Estimation Difficulty: The OS must estimate the length of future CPU bursts, typically using an exponential averaging of past bursts.
    • Variability: High variability in response times for long processes.

Shortest Remaining Time (SRT)

Shortest Remaining Time (SRT) is the preemptive version of SPN.

  • Mechanism: Whenever a new process becomes ready or a process finishes its burst, the OS selects the process with the shortest remaining execution time.
  • Performance: Provides even better turnaround times for short processes than SPN but requires tracking the service time consumed by each process.