๐Ÿง  What is a Short-Term Scheduler?

The Short-Term Scheduler selects one process from the Ready Queue and allocates the CPU to it.

It operates very frequently, often at every context switch, I/O event, or timer interrupt.


๐Ÿ” How It Fits Into the Process Lifecycle

[ Ready Queue ] --(Short-Term Scheduler)--> [ CPU ]
  • Maintains high CPU utilization

  • Picks from only processes in memory

  • Must be extremely fast and efficient


๐Ÿ“ฆ Characteristics of the Short-Term Scheduler

CharacteristicDescription
โšก FrequencyVery high (milliseconds)
โฑ๏ธ SpeedMust be very fast (microseconds)
๐Ÿง  ScopeChooses only from the Ready Queue
๐Ÿ” Repeated ExecutionRuns at every context switch or timer interrupt
๐Ÿ“Š Algorithm BasedImplements policies like Round Robin, Priority, etc.

๐ŸŽฏ Goals of Short-Term Scheduling

GoalDescription
โœ… Maximize CPU usageKeep the CPU busy
๐Ÿš€ Optimize performanceReduce response/wait times
โš–๏ธ Ensure fairnessPrevent starvation
๐Ÿง  Enforce prioritiesLet important processes run sooner

๐Ÿ”€ Trigger Events for the Short-Term Scheduler

EventExample
๐Ÿ•ฐ๏ธ Time slice expiredRound Robin timeout
๐Ÿ” I/O completesProcess returns from disk read
๐Ÿชซ Process blocksWaiting for I/O
๐Ÿ Process terminatesCPU becomes free
๐Ÿ†• New process admittedHigher priority may preempt

๐Ÿงฉ Scheduling Algorithms Used by the Short-Term Scheduler

TypeExamples
๐Ÿงฎ Non-PreemptiveFCFS, SJF
โšก PreemptiveRound Robin, Priority, SRTF, Multilevel Queue

โš™๏ธ Real World Analogy

Imagine a CPU as a single chair, and a line of students waiting to present.
The short-term scheduler decides:

  • Who gets to sit next

  • How long they stay

  • Whether someone can interrupt mid-way (preemption)


๐Ÿ“š Real OS Example

In Linux, the Short-Term Scheduler is implemented as the CFS (Completely Fair Scheduler).
It uses a Red-Black Tree to balance load and fairness among processes.


๐Ÿง  Interview-Ready Definition:

The Short-Term Scheduler, also known as the CPU Scheduler, is responsible for selecting a process from the ready queue and allocating the CPU to it. It executes frequently and quickly, using a scheduling algorithm to optimize performance, fairness, and responsiveness.