Last updated
Last updated
Different CPU scheduling algorithms have various criteria for choosing the next process to run on the CPU. Here's a list of some common CPU scheduling algorithms, along with their criteria, advantages, disadvantages, and important facts:
First-Come-First-Served (FCFS) Scheduling:
Criteria: Processes are executed in the order they arrive in the ready queue.
Advantages:
Simple and easy to implement.
Fair to all processes.
Disadvantages:
May suffer from poor turnaround time, especially if long-running processes arrive first (convoy effect).
Doesn't consider process priority.
Important Facts:
Also known as FIFO (First-In-First-Out) scheduling.
Shortest Job Next (SJN) or Shortest Job First (SJF) Scheduling:
Criteria: Selects the process with the shortest burst time to execute next.
Advantages:
Minimizes average waiting time and turnaround time.
Efficient for CPU-bound tasks.
Disadvantages:
Requires knowledge of each process's execution time, which is often not available in real-world scenarios.
May lead to starvation for longer processes.
Important Facts:
Also known as SRTF (Shortest Remaining Time First) when preemption is used.
Priority Scheduling:
Criteria: Selects the process with the highest priority for execution.
Advantages:
Allows for task prioritization.
Useful for real-time systems.
Disadvantages:
Can suffer from starvation if lower-priority processes are never allowed to execute.
May lead to priority inversion.
Important Facts:
Can be either preemptive or non-preemptive (priority can change dynamically).
Round Robin (RR) Scheduling:
Criteria: Allocates a fixed time slice (quantum) to each process in a cyclic manner.
Advantages:
Fair access to the CPU.
Suitable for time-sharing systems.
Disadvantages:
May have high context-switching overhead with very small time slices.
Poor for tasks with varying execution times.
Important Facts:
Uses a circular queue to manage processes.
Larger time slices reduce overhead but may impact responsiveness.
Multilevel Queue Scheduling:
Criteria: Organizes processes into multiple priority levels, each with its own scheduling algorithm.
Advantages:
Provides different priority levels for processes.
Suitable for systems with various types of processes.
Disadvantages:
Complex to manage with many queues.
Doesn't consider the actual state of processes.
Important Facts:
Each queue may use a different scheduling algorithm.
Multilevel Feedback Queue Scheduling:
Criteria: Allows processes to change priority dynamically based on their behavior.
Advantages:
Adaptive and handles a mix of I/O-bound and CPU-bound processes effectively.
Reduces the likelihood of starvation.
Disadvantages:
Complexity in setting parameters and managing queues.
Important Facts:
Processes move between queues based on their behavior and CPU usage.
The choice of scheduling algorithm depends on the specific requirements and characteristics of the system, such as the nature of processes, hardware capabilities, and performance goals. Each algorithm has its strengths and weaknesses, and the selection should be made based on the priorities and constraints of the particular application or operating environment.