- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Process Scheduling Fundamentals
Process Scheduling handles the selection of a process for the processor on the basis of a scheduling algorithm and also the removal of a process from the processor. It is an important part of multiprogramming in operating system.
Process Scheduling Algorithms
Process scheduling algorithms are used to handle the selection of a process for the processor or distribute resources maong processes.
Some of the process scheduling algorithms are given as follows −
- First Come First Served
This algorithm handles the processes in the order they arrive in the ready queue. FCFS is the simplest scheduling algorithm. There is no preemption in FCFS and so no starvation occurs. Still, its throughput is quite low because large processes may hold the CPU for a long time.
- Shortest Job First
This algorithm executes processes in order of their execution times i.e the process with the smallest execution time is selected first. SJF supports preemption and so can lead to starvation for some processes. However, it provides the maximum throughput in most cases.
- Fixed Priority Scheduling
This algorithm executes processes in order of their priority, which is specified for each process. Lower priority processes may be preempted by higher priority processes and this can lead to starvation for some processes.
- Round Robin Scheduling
This algorithm provides a fixed time slice for each process and cycles through all the processes until their execution is complete. There is no starvation possible since each process gets the chance to execute. If the time slice is too large then Round Robin algorithm behaves like FIFO and if it is too small, it behaves like SJF.
Process scheduling involves short-term schedulers, medium-term schedulers and long-term schedulers. Details about these are given as follows −
- Long-Term Schedulers
Long-term schedulers perform long-term scheduling. This involves selecting the processes from the storage pool in the secondary memory and loading them into the ready queue in the main memory for execution.
The long-term scheduler controls the degree of multiprogramming. It must select a careful mixture of I/O bound and CPU bound processes to yield optimum system throughput. If it selects too many CPU bound processes then the I/O devices are idle and if it selects too many I/O bound processes then the processor has nothing to do.
- Short-Term Schedulers
Short-term schedulers perform short-term scheduling. This involves selecting one of the processes from the ready queue and scheduling them for execution. A scheduling algorithm is used to decide which process will be scheduled for execution next by the short-term scheduler.
A diagram that demonstrates scheduling using long-term and short-term schedulers is given as follows −
- Medium-Term Schedulers
Medium-term schedulers perform medium-term scheduling. This involves swapping out a process from main memory. The process can be swapped in later from the point it stopped executing.
This can also be called as suspending and resuming the process and is helpful in reducing the degree of multiprogramming. Swapping is also useful to improve the mix of I/O bound and CPU bound processes in the memory.
A diagram that demonstrates medium-term scheduling is given as follows −
- What is Process Scheduling?
- Graph Fundamentals
- What are the types of process scheduling algorithms and which algorithms lead to starvation?
- Weighted Job Scheduling
- QOS Traffic Scheduling
- What are different types of CPU scheduling and the scheduling criteria?
- What is Global Scheduling?
- What are Scheduling Queues?
- Process vs Parent Process vs Child Process
- C++ Program for Priority Scheduling
- C Program for FCFS Scheduling
- Two City Scheduling in C++
- Estimation Techniques for Project Scheduling
- Preemptive and Non-Preemptive Scheduling
- What is Basic block scheduling?