Advantages and Disadvantages of various CPU scheduling algorithms
CPU Scheduling involves many different scheduling algorithms which have their Advantages and Disadvantages.
1. First Come First Serve (FCFS):
Advantages:
- It is simple and easy to understand.
- FCFS provides fairness by treating all processes equally and giving them an equal opportunity to run.
- FCFS guarantees that every process will eventually get a chance to execute, as long as the system has enough resources to handle all the processes.
- FCFS has low scheduling overhead since it does not involve frequent context switches or complex scheduling decisions.
- FCFS is well-suited for long-running processes or workloads that do not have strict time constraints.
Disadvantages:
- The process with less execution time suffers i.e. waiting time is often quite long.
- Favors CPU Bound process then I/O bound process.
- Here, the first process will get the CPU first, other processes can get the CPU only after the current process has finished its execution. Now, suppose the first process has a large burst time, and other processes have less burst time, then the processes will have to wait more unnecessarily, this will result in more average waiting time, i.e., Convoy effect.
- This effect results in lower CPU and device utilization.
- FCFS algorithm is particularly troublesome for multiprogramming systems, where it is important that each user get a share of the CPU at regular intervals.
2. Shortest Job First (SJF) [Preemptive and Non- Preemptive]:
Advantages:
- Shortest jobs are favored.
- It is probably optimal, in that it gives the minimum average waiting time for a given set of processes.
Disadvantages:
- SJF may cause starvation if shorter processes keep coming. This problem is solved by aging.
- It cannot be implemented at the level of short-term CPU scheduling.
3. Round Robin (RR):
Advantages:
- Every process gets an equal share of the CPU.
- RR is cyclic in nature, so there is no starvation.
Disadvantages:
- Setting the quantum too short increases the overhead and lowers the CPU efficiency, but setting it too long may cause a poor response to short processes.
- The average waiting time under the RR policy is often long.
- If time quantum is very high then RR degrades to FCFS.
Advantages:
- This provides a good mechanism where the relative importance of each process may be precisely defined.
- PB scheduling allows for the assignment of different priorities to processes based on their importance, urgency, or other criteria.
Disadvantages:
- If high-priority processes use up a lot of CPU time, lower-priority processes may starve and be postponed indefinitely. The situation where a process never gets scheduled to run is called starvation.
- Another problem is deciding which process gets which priority level assigned to it.
5. Multilevel Queue Scheduling (MQS):
Advantages:
Application of separate scheduling for various kinds of processes is possible.
- System Process – FCFS
- Interactive Process – SJF
- Batch Process – RR
- Student Process – PB
Disadvantages:
- The lowest level process faces the starvation problem.
6. Multilevel Feedback Queue Scheduling (MFQS):
Advantages:
- Low scheduling overhead.
- Allows aging, thus no starvation.
Disadvantages:
- It’s not flexible.
- It also requires some means of selecting values for all the parameters to define the best scheduler, thus it is also the most complex.
Please Login to comment...