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.