100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Long-Term vs Short-Term Scheduler: What Is the Difference?

Long-term vs short-term scheduler compared: admission control, CPU dispatch, and invocation frequency, with an interview-ready example.

mediumQ221 of 224 in Operating Systems Est. time: 5 minsLast updated:
Open Code Lab

Expected Interview Answer

The long-term scheduler controls how many processes are admitted from the job queue into memory (the degree of multiprogramming) and runs infrequently, while the short-term scheduler picks which already-resident, ready process gets the CPU next and runs extremely frequently, often on every clock tick.

The long-term scheduler is invoked rarely β€” seconds or minutes apart β€” because it decides admission control: it selects processes from the pool waiting on disk and loads them into memory, ideally balancing a healthy mix of CPU-bound and I/O-bound jobs so neither the CPU nor the devices sit idle. The short-term scheduler, also called the CPU scheduler, runs on the order of milliseconds, invoked whenever the CPU needs a new process to execute β€” after a time-slice expiry, an interrupt, or a blocking call β€” and it must be extremely fast since its own execution time is pure overhead. Because the short-term scheduler runs so much more often, its algorithm must be lightweight, whereas the long-term scheduler can afford a more deliberate, expensive selection process since it runs so rarely. Systems with no long-term scheduler at all, such as many time-sharing OSes, admit every process immediately and rely purely on the short-term scheduler and memory management to cope with load.

  • Clarifies why admission control and CPU dispatch are separate concerns
  • Explains the frequency/cost trade-off between the two schedulers
  • Connects the long-term scheduler to multiprogramming degree and job mix
  • Sets up the medium-term scheduler as a third, intermediate layer

AI Mentor Explanation

The long-term scheduler is like a franchise’s team selection committee deciding, once per season, which players from the wider pool get contracted into the full squad β€” a slow, careful decision made rarely. The short-term scheduler is like the captain deciding, ball by ball, which already-contracted bowler comes on next β€” a fast decision made constantly. The committee controls how many players are in the squad at all; the captain only chooses among those already on the field.

Step-by-Step Explanation

  1. Step 1

    Job arrives

    A new process enters the system and sits in the job queue on disk, not yet in memory.

  2. Step 2

    Long-term selection

    The long-term scheduler runs infrequently, choosing a mix of jobs to admit into memory based on capacity and job type balance.

  3. Step 3

    Ready queue placement

    Admitted processes enter the ready queue, now eligible for CPU dispatch.

  4. Step 4

    Short-term dispatch

    The short-term scheduler runs on nearly every clock tick, quickly picking the next ready process to run on the CPU.

What Interviewer Expects

  • Correctly stating which scheduler controls admission vs CPU dispatch
  • Contrasting the invocation frequency of each scheduler
  • Explaining why the short-term scheduler must be algorithmically cheap
  • Mentioning that some systems skip the long-term scheduler entirely

Common Mistakes

  • Swapping the definitions of long-term and short-term scheduler
  • Assuming both schedulers run at the same frequency
  • Forgetting the long-term scheduler's role in balancing CPU-bound vs I/O-bound mix
  • Conflating the short-term scheduler with the dispatcher (which performs the actual context switch)

Best Answer (HR Friendly)

β€œThe long-term scheduler is the gatekeeper that decides, every so often, which waiting tasks get let into memory at all, controlling how much work the system takes on. The short-term scheduler is the fast-moving traffic cop that, many times per second, decides which of the tasks already let in gets the CPU right now. One controls how much work enters the system; the other controls the moment-to-moment order of execution.”

Code Example

Long-term admission vs short-term dispatch (simplified)
#define MAX_RESIDENT 20

int resident_count = 0;

/* Long-term scheduler: runs rarely, controls admission */
void long_term_schedule(struct pcb *job_queue) {
    while (resident_count < MAX_RESIDENT && job_queue != NULL) {
        struct pcb *job = pop(&job_queue);
        job->state = READY;
        enqueue(&ready_queue, job);
        resident_count++;
    }
}

/* Short-term scheduler: runs on nearly every tick, controls CPU dispatch */
struct pcb *short_term_schedule(void) {
    return dequeue(&ready_queue);   /* pick next ready process for the CPU */
}

Follow-up Questions

  • What is the medium-term scheduler and how does it relate to these two?
  • Why must the short-term scheduler execute quickly?
  • How does the long-term scheduler affect the degree of multiprogramming?
  • Which systems typically omit a long-term scheduler entirely?

MCQ Practice

1. Which scheduler controls the degree of multiprogramming?

The long-term scheduler decides how many processes are admitted into memory, directly setting the multiprogramming level.

2. Why must the short-term scheduler be algorithmically lightweight?

Because it is invoked on nearly every scheduling event, any inefficiency in the short-term scheduler itself wastes CPU cycles.

3. What does the long-term scheduler typically try to balance?

Admitting a good mix of CPU-bound and I/O-bound jobs keeps both the CPU and I/O devices well utilized.

Flash Cards

What does the long-term scheduler control? β€” Which processes are admitted from disk into memory, and how many (multiprogramming degree).

What does the short-term scheduler control? β€” Which ready, in-memory process gets the CPU next.

Which scheduler runs more frequently? β€” The short-term scheduler, often on every clock tick.

Why balance CPU-bound and I/O-bound jobs on admission? β€” So neither the CPU nor I/O devices sit idle while the other is overloaded.

1 / 4

Continue Learning