CPU Process Scheduling
Algorithms
By:
Prinsha Shrestha 4th
Sept
CPU Process Scheduling Algorithms
• CPU process scheduling is a critical component of operating systems.
• It determines how processes are allocated CPU time.
• It manages what process gets CPU time and for how much time.
• It ensures that there is maximum utilization of CPU.
First-Come, First-Served (FCFS) Scheduling
• It is a non preemptive scheduling algorithm.
• In this algorithm the processes are executed based on their arrival time.
• Arrival:
• Processes are added to the queue in order of arrival.
• Execution:
• The first process in the queue is executed to completion.
• Next Process:
• Once completed, the next process in line begins execution.
First-Come, First-Served (FCFS) Scheduling
•Advantages:
•Simple to implement and understand.
•No starvation; every process will eventually be executed.
•Disadvantages:
•A short process may have to wait a long time if a long process is ahead of it.
•Not suitable for time-sharing systems.
Shortest Job First (SJF) Scheduling
• It is a non preemptive scheduling algorithm.
• In this algorithm the processes are executed based on their process time.
• It chooses the process that takes the shortest time to execute first.
• Arrival
• Processes arrive with known execution times.
• Selection
• The process with the shortest execution time is chosen.
• Execution
• Selected process runs to completion before next selection.
• Optimization
• Minimizes average waiting time for a given set of processes.
Shortest Job First (SJF) Scheduling
• Advantages:
• Minimizes average waiting time, making it efficient.
• Suitable for batch systems where job times are known.
• Disadvantages:
• Starvation: Longer processes may never get executed if shorter
processes keep arriving.
• Not feasible in real-time systems because burst time isn't always
known.
Priority Scheduling
• It is a preemptive scheduling algorithm.
• In this algorithm the processes are executed based on the priority of processes.
• Priority Assignment
• Each process is assigned a priority value.
• Higher priority processes are executed first.
• Execution Order
• Processes are selected based on their priority.
• Ties are broken using FCFS.
• Considerations
• Can lead to starvation of low-priority processes.
• Priority can be dynamic or static.
Priority Scheduling
• Advantages:
• Important processes can be executed first.
• Flexible, as priority can be adjusted dynamically.
• Disadvantages:
• Starvation: Lower priority processes may never be executed.
Round Robin (RR) Scheduling
• It is a preemptive scheduling algorithm.
• In this algorithm the processes are executed for a short time frame known as quantum
time.
• After one execution it moves to next process and so on.
• Quantum Time
• A fixed time slice is allocated to each process.
• Execution
• Process runs for one time quantum or until completion.
• Queue Rotation
• If incomplete, process moves to next process until end of queue.
• Next Rotation
• CPU moves to the beginning of process queue and execution continues until all processes
are complete.
Round Robin (RR) Scheduling
• Advantages:
• Fair allocation of CPU time among processes.
• Suitable for time-sharing systems.
• Disadvantages:
• The choice of quantum is critical; too small can lead to excessive context
switching, too large can behave like FCFS.
• Not optimal for minimizing average waiting time.
Thank You!!

Prinsha_Shrestha-Process Scheduling.pptx

  • 1.
  • 2.
    CPU Process SchedulingAlgorithms • CPU process scheduling is a critical component of operating systems. • It determines how processes are allocated CPU time. • It manages what process gets CPU time and for how much time. • It ensures that there is maximum utilization of CPU.
  • 3.
    First-Come, First-Served (FCFS)Scheduling • It is a non preemptive scheduling algorithm. • In this algorithm the processes are executed based on their arrival time. • Arrival: • Processes are added to the queue in order of arrival. • Execution: • The first process in the queue is executed to completion. • Next Process: • Once completed, the next process in line begins execution.
  • 4.
    First-Come, First-Served (FCFS)Scheduling •Advantages: •Simple to implement and understand. •No starvation; every process will eventually be executed. •Disadvantages: •A short process may have to wait a long time if a long process is ahead of it. •Not suitable for time-sharing systems.
  • 5.
    Shortest Job First(SJF) Scheduling • It is a non preemptive scheduling algorithm. • In this algorithm the processes are executed based on their process time. • It chooses the process that takes the shortest time to execute first. • Arrival • Processes arrive with known execution times. • Selection • The process with the shortest execution time is chosen. • Execution • Selected process runs to completion before next selection. • Optimization • Minimizes average waiting time for a given set of processes.
  • 6.
    Shortest Job First(SJF) Scheduling • Advantages: • Minimizes average waiting time, making it efficient. • Suitable for batch systems where job times are known. • Disadvantages: • Starvation: Longer processes may never get executed if shorter processes keep arriving. • Not feasible in real-time systems because burst time isn't always known.
  • 7.
    Priority Scheduling • Itis a preemptive scheduling algorithm. • In this algorithm the processes are executed based on the priority of processes. • Priority Assignment • Each process is assigned a priority value. • Higher priority processes are executed first. • Execution Order • Processes are selected based on their priority. • Ties are broken using FCFS. • Considerations • Can lead to starvation of low-priority processes. • Priority can be dynamic or static.
  • 8.
    Priority Scheduling • Advantages: •Important processes can be executed first. • Flexible, as priority can be adjusted dynamically. • Disadvantages: • Starvation: Lower priority processes may never be executed.
  • 9.
    Round Robin (RR)Scheduling • It is a preemptive scheduling algorithm. • In this algorithm the processes are executed for a short time frame known as quantum time. • After one execution it moves to next process and so on. • Quantum Time • A fixed time slice is allocated to each process. • Execution • Process runs for one time quantum or until completion. • Queue Rotation • If incomplete, process moves to next process until end of queue. • Next Rotation • CPU moves to the beginning of process queue and execution continues until all processes are complete.
  • 10.
    Round Robin (RR)Scheduling • Advantages: • Fair allocation of CPU time among processes. • Suitable for time-sharing systems. • Disadvantages: • The choice of quantum is critical; too small can lead to excessive context switching, too large can behave like FCFS. • Not optimal for minimizing average waiting time.
  • 11.