Skip to content

Scheduling Queues

1. Introduction to Scheduling Queues

In a multiprogramming operating system, multiple processes are managed simultaneously. To efficiently handle these processes, the OS maintains various scheduling queues that help in process scheduling.

πŸ’‘ Why Scheduling Queues?

  • Organizes processes based on their states.
  • Helps the OS efficiently allocate CPU and resources.
  • Manages process execution smoothly using scheduling algorithms.

2. Types of Scheduling Queues

πŸ“Œ 1. Job Queue (New Queue)

βœ… Stores all newly created processes before they enter the Ready Queue.
βœ… A process remains here until the OS admits it into the system.
βœ… Used in batch processing systems.

βœ” Example:

  • A user submits multiple print jobs. These jobs first enter the Job Queue.

πŸ“Œ 2. Ready Queue

βœ… Stores processes that are ready for execution but waiting for CPU time.
βœ… The CPU Scheduler picks the highest-priority process from this queue.
βœ… Uses different scheduling algorithms (e.g., FCFS, Round Robin, Priority Scheduling).

βœ” Example:

  • When you open multiple applications (Chrome, MS Word, VLC), they are in the Ready Queue waiting for CPU.

πŸ“Œ 3. CPU Queue (Running Queue)

βœ… Stores the process that is currently executing on the CPU.
βœ… Only one process can be in this queue at a time in a single-core system.

βœ” Example:

  • If MS Word is currently using the CPU to check spelling, it’s in the CPU Queue.

πŸ“Œ 4. Waiting Queue (I/O Queue or Blocked Queue)

βœ… Stores processes that are waiting for I/O operations (disk read, network request).
βœ… Once the I/O operation is complete, the process moves back to the Ready Queue.

βœ” Example:

  • Downloading a file in a browser – the process waits for network data.

πŸ“Œ 5. Terminated Queue

βœ… Stores processes that have completed execution or have been killed.
βœ… The OS removes them from memory to free up resources.

βœ” Example:

  • When you close a video player, its process moves to the Terminated Queue before being removed from memory.

3. Diagram of Scheduling Queues

Here’s how processes move between different scheduling queues:

luaCopyEdit  +-------------+      +-------------+      +-------------+      +-------------+
  |   Job Queue | ---> | Ready Queue | ---> | Running     | ---> | Terminated  |
  +-------------+      +-------------+      +-------------+      +-------------+
                               |                    |
                               v                    v
                      +----------------+      +----------------+
                      | Waiting (I/O)  |      | CPU Scheduling |
                      +----------------+      +----------------+
  • New processes enter the Job Queue.
  • OS selects them and moves them to the Ready Queue.
  • The CPU Scheduler picks a process to execute.
  • If the process needs I/O, it moves to the Waiting Queue.
  • Once execution is complete, the process enters the Terminated Queue.

4. How Scheduling Queues Work Together?

βœ” Multi-level Queues: Some OSes divide the Ready Queue into different levels (Foreground, Background, etc.).
βœ” Preemptive Scheduling: If a process is interrupted, it goes back to the Ready Queue.
βœ” Long-Term vs. Short-Term Scheduling:

  • Long-Term Scheduler decides which processes move from Job Queue β†’ Ready Queue.
  • Short-Term Scheduler selects which process gets CPU time from the Ready Queue.
  • Medium-Term Scheduler temporarily removes processes (swapping).

5. Conclusion

βœ” Scheduling Queues help the OS manage process execution efficiently.
βœ” Different queues handle processes based on their state (Ready, Running, Waiting, etc.).
βœ” Schedulers (Long-term, Short-term, and Medium-term) control queue transitions.