Introduction
Before studying CPU scheduling algorithms, it is important to understand where processes wait and which scheduler makes each decision. A process does not simply move straight from creation to CPU execution.
At different times, a process may be newly created, ready for CPU, running, waiting for an event, suspended, or terminated. The operating system uses scheduling queues and schedulers to manage these movements clearly.
Why Scheduling Queues Exist
Many processes can exist at the same time, but all of them cannot run on the CPU together. Some processes are ready to run, some are waiting for I/O, and some may still be entering the active system.
Scheduling queues help the OS group processes according to their current situation. This makes it easier to decide what should happen next.
For example, a ready process should wait for CPU time, while a blocked process should wait for its event to complete. These two processes should not be treated in the same way.
Why Scheduling Queues Exist
Process States Behind Scheduling Queues
Scheduling queues are closely related to process states. A process moves between states during its lifetime, and queues help the OS organize those processes.
Common process states include:
Newly created: The process is being created and admitted.
Ready: The process is waiting for CPU time.
Running: The process is currently executing on the CPU.
Waiting or blocked: The process is waiting for an event such as I/O, timer, input, lock, or resource.
Suspended: The process is paused or temporarily removed from active memory.
Terminated: The process has finished or was killed.
The important idea is that every process is not waiting for the same thing. The queue tells the OS what kind of waiting is happening.
What Is A Scheduling Queue?
A scheduling queue is a data structure used by the operating system to group processes that are in a similar condition. The OS can then choose processes from the correct queue when the next action is possible.
For example, the ready queue contains processes that are ready to run and only need CPU time. A waiting queue contains processes that cannot run until an event completes.
This structure keeps process management organized when many processes are active together.
Types Of Scheduling Queues
Different queues represent different waiting points in the system. The exact names and implementation can vary across operating systems, but the core idea remains the same.
Queue | Meaning |
|---|---|
New queue | Processes being created or admitted into the system |
Ready queue | Processes ready to run and waiting for CPU time |
Running queue | Processes currently executing on CPU cores |
Waiting queue | Processes blocked until an event completes |
Suspended queue | Processes paused or swapped out temporarily |
Terminated queue | Finished processes waiting for final cleanup or status handling |
The ready queue and waiting queues are especially important for CPU scheduling because they explain why a process may not be using the CPU even though it still exists.
Flow Of A Process Through Queues
A process usually starts in the new state. After it is admitted and prepared, it enters the ready queue and waits for CPU time.
The basic flow is:
New: The process is created and admitted into the system.
Ready: It waits in the ready queue for CPU time.
Running: The scheduler selects it and gives it CPU time.
Waiting: It moves to a waiting queue if it needs I/O, input, a timer, a lock, or another event.
Ready again: After the event completes, it returns to the ready queue.
Terminated: It finishes execution or is killed, and cleanup begins.
This ready-running-waiting cycle can happen many times. A process may repeatedly use the CPU, wait for events, return to ready, and run again.
Flow Of A Process Through Queues
Types Of Schedulers
Schedulers decide how processes move through the system. The three important types are long-term scheduler, short-term scheduler, and medium-term scheduler.
Scheduler | Main Question | Main Work |
|---|---|---|
Long-term scheduler | Who enters the active system? | Admits jobs or processes into memory |
Short-term scheduler | Who gets the CPU next? | Picks from the ready queue |
Medium-term scheduler | Who leaves or returns to memory? | Suspends, swaps out, or resumes processes |
The words long-term, short-term, and medium-term describe how often these schedulers make decisions. Short-term scheduling happens very frequently, while long-term scheduling happens less often.
Long-Term Scheduler
The long-term scheduler decides which submitted jobs or processes are allowed to enter the active system. It is also called the job scheduler in many explanations.
In classic batch systems, many jobs may wait in a job pool on disk. The long-term scheduler selects some of them and admits them into memory so they can join the ready system.
Its main work is to control the degree of multiprogramming. This means it decides how many processes should be active in the system at the same time.
Short-Term Scheduler
The short-term scheduler is also called the CPU scheduler. It chooses which ready process or thread gets the CPU next.
This scheduler runs very frequently because CPU decisions happen again and again. For this reason, it must be fast.
Most CPU scheduling algorithms, such as FCFS, SJF, Round Robin, Priority Scheduling, and MLFQ, mainly describe short-term scheduler behavior.
Medium-Term Scheduler
The medium-term scheduler temporarily removes a process from memory and may later bring it back. This is usually explained using suspension, swapping out, and swapping in.
It is useful when memory is under pressure or when too many processes are active. By moving some processes out temporarily, the OS can reduce system load and free RAM.
In modern systems, full swapping may be less visible than in classic textbook models, but the idea is still important for understanding memory pressure and suspended processes.
Types Of Schedulers
Summary
Scheduling queues help the operating system organize processes according to what they are currently doing. A process may be new, ready, running, waiting, suspended, or terminated.
Schedulers decide how processes move through these queues. The long-term scheduler admits processes, the short-term scheduler gives CPU time, and the medium-term scheduler suspends or resumes processes to control memory and system load.
Be the first to add a comment.