SlideShare a Scribd company logo
1 of 16
SCHEDULING
ALGORITHMS
MARGRAT C R
S5 CSE-B
21
A Process Scheduler schedules different processes to be assigned to the CPU based on
particular scheduling algorithms. There are five popular process scheduling
algorithms
• First-Come, First-Served (FCFS) Scheduling
• Shortest-Job-Next (SJN) Scheduling
• Priority Scheduling
• Round Robin(RR) Scheduling
• Multiple-Level Queues Scheduling
 These algorithms are either non-preemptive or preemptive.
 Non-preemptive algorithms are designed so that once a process enters the running state,
it cannot be preempted until it completes its allotted time,
 whereas the preemptive scheduling is based on priority where a scheduler may preempt
a low priority running process anytime when a high priority process enters into a ready
state.
First Come First Serve (FCFS)
• Jobs are executed on first come, first serve basis.
• It is a non-preemptive scheduling algorithm.
• Easy to understand and implement.
• Its implementation is based on FIFO queue.
• Poor in performance as average wait time is high.
Process Wait Time : Service Time - Arrival Time
P0 0 - 0 = 0
P1 5 - 1 = 4
P2 8 - 2 = 6
P3 16 - 3 = 13
Average Wait Time: (0+4+6+13) / 4 = 5.75
Shortest Job Next (SJN)
 This is also known as shortest job first, or SJF
 This is a non-preemptive scheduling algorithm.
 Best approach to minimize waiting time.
 Easy to implement in Batch systems where required CPU time is known in advance.
 Impossible to implement in interactive systems where required CPU time is not known.
 The processer should know in advance how much time process will take.
Process Wait Time : Service Time - Arrival Time
P0 3 - 0 = 3
P1 0 - 0 = 0
P2 16 - 2 = 14
P3 8 - 3 = 5
Average Wait Time: (3+0+14+5) / 4 = 5.50
Priority Based Scheduling
 Priority scheduling is a non-preemptive algorithm and one of the most common scheduling
algorithms in batch systems.
 Each process is assigned a priority. Process with highest priority is to be executed first and so
on.
 Processes with same priority are executed on first come first served basis.
 Priority can be decided based on memory requirements, time requirements or any other
resource requirement.
Process Wait Time : Service Time - Arrival Time
P0 9 - 0 = 9
P1 6 - 1 = 5
P2 14 - 2 = 12
P3 0 - 0 = 0
Average Wait Time: (9+5+12+0) / 4 = 6.5
Round Robin Scheduling
 Round Robin is the preemptive process scheduling algorithm.
 Each process is provided a fix time to execute, it is called a quantum.
 Once a process is executed for a given time period, it is preempted and other
process executes for a given time period.
 Context switching is used to save states of preempted processes
Process Wait Time : Service Time - Arrival Time
P0 (0 - 0) + (12 - 3) = 9
P1 (3 - 1) = 2
P2 (6 - 2) + (14 - 9) + (20 - 17) = 12
P3 (9 - 3) + (17 - 12) = 11
Average Wait Time: (9+2+12+11) / 4 = 8.5
Multiple-Level Queues Scheduling
Multiple-level queues are not an independent scheduling algorithm. They make use of other existing
algorithms to group and schedule jobs with common characteristics.
• Multiple queues are maintained for processes with common characteristics.
• Each queue can have its own scheduling algorithms.
• Priorities are assigned to each queue.
For example, CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue.
The Process Scheduler then alternately selects jobs from each queue and assigns them to the CPU based
on the algorithm assigned to the queue.
SCHEDULING ALGORITHMS

More Related Content

What's hot

Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process SchedulingShipra Swati
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process SchedulingDamian T. Gordon
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Fixed partitioning of memory
Fixed partitioning of memoryFixed partitioning of memory
Fixed partitioning of memoryJohn Scott Giini
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGgarishma bhatia
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System CallsVandana Salve
 
Disk Scheduling Algorithms
Disk Scheduling AlgorithmsDisk Scheduling Algorithms
Disk Scheduling Algorithmsali jawad
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptxSanad Bhowmik
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First ServeEdwin Makeu
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating systemAli Haider
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Schedulingsathish sak
 

What's hot (20)

Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Operating System-Process Scheduling
Operating System-Process SchedulingOperating System-Process Scheduling
Operating System-Process Scheduling
 
Operating Systems: Process Scheduling
Operating Systems: Process SchedulingOperating Systems: Process Scheduling
Operating Systems: Process Scheduling
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Fixed partitioning of memory
Fixed partitioning of memoryFixed partitioning of memory
Fixed partitioning of memory
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
MULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULINGMULTILEVEL QUEUE SCHEDULING
MULTILEVEL QUEUE SCHEDULING
 
Deadlock Prevention
Deadlock PreventionDeadlock Prevention
Deadlock Prevention
 
System calls
System callsSystem calls
System calls
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
Disk Scheduling Algorithms
Disk Scheduling AlgorithmsDisk Scheduling Algorithms
Disk Scheduling Algorithms
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Memory management
Memory managementMemory management
Memory management
 
Round Robin Algorithm.pptx
Round Robin Algorithm.pptxRound Robin Algorithm.pptx
Round Robin Algorithm.pptx
 
First Come First Serve
First Come First ServeFirst Come First Serve
First Come First Serve
 
OS UNIT – 2 - Process Management
OS UNIT – 2 - Process ManagementOS UNIT – 2 - Process Management
OS UNIT – 2 - Process Management
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
Real-Time Scheduling
Real-Time SchedulingReal-Time Scheduling
Real-Time Scheduling
 

Viewers also liked

Operating system
Operating systemOperating system
Operating systemLovly Angel
 
Srt algorithm
Srt algorithmSrt algorithm
Srt algorithmdianne10
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Shreya Kumar
 
Page replacement
Page replacementPage replacement
Page replacementsashi799
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithmsPiyush Rochwani
 

Viewers also liked (7)

Operating system
Operating systemOperating system
Operating system
 
Srt algorithm
Srt algorithmSrt algorithm
Srt algorithm
 
Lru Stack
Lru StackLru Stack
Lru Stack
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.
 
Page Replacement
Page ReplacementPage Replacement
Page Replacement
 
Page replacement
Page replacementPage replacement
Page replacement
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 

Similar to SCHEDULING ALGORITHMS

operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdfAliyanAbbas1
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.pptKeyreSebre
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .pptSaba651353
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-schedulingNazir Ahmed
 
Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntationJamsheed Ali
 
Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithmsPaurav Shah
 
CPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxCPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxHarry83774
 
Ch6
Ch6Ch6
Ch6C.U
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2pri534
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System SchedulingVishnu Prasad
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxRevathi Kmp
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling AlgorithmsTayba Farooqui
 

Similar to SCHEDULING ALGORITHMS (20)

operating system (1).pdf
operating system (1).pdfoperating system (1).pdf
operating system (1).pdf
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
scheduling Uni processor Long-term .ppt
scheduling  Uni processor Long-term .pptscheduling  Uni processor Long-term .ppt
scheduling Uni processor Long-term .ppt
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntation
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
CPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxCPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptx
 
Ch6
Ch6Ch6
Ch6
 
Os..
Os..Os..
Os..
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
CPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdfCPU Scheduling Part-III.pdf
CPU Scheduling Part-III.pdf
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptx
 
Scheduling
SchedulingScheduling
Scheduling
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 

SCHEDULING ALGORITHMS

  • 2. A Process Scheduler schedules different processes to be assigned to the CPU based on particular scheduling algorithms. There are five popular process scheduling algorithms • First-Come, First-Served (FCFS) Scheduling • Shortest-Job-Next (SJN) Scheduling • Priority Scheduling • Round Robin(RR) Scheduling • Multiple-Level Queues Scheduling  These algorithms are either non-preemptive or preemptive.  Non-preemptive algorithms are designed so that once a process enters the running state, it cannot be preempted until it completes its allotted time,  whereas the preemptive scheduling is based on priority where a scheduler may preempt a low priority running process anytime when a high priority process enters into a ready state.
  • 3. First Come First Serve (FCFS) • Jobs are executed on first come, first serve basis. • It is a non-preemptive scheduling algorithm. • Easy to understand and implement. • Its implementation is based on FIFO queue. • Poor in performance as average wait time is high.
  • 4.
  • 5. Process Wait Time : Service Time - Arrival Time P0 0 - 0 = 0 P1 5 - 1 = 4 P2 8 - 2 = 6 P3 16 - 3 = 13 Average Wait Time: (0+4+6+13) / 4 = 5.75
  • 6. Shortest Job Next (SJN)  This is also known as shortest job first, or SJF  This is a non-preemptive scheduling algorithm.  Best approach to minimize waiting time.  Easy to implement in Batch systems where required CPU time is known in advance.  Impossible to implement in interactive systems where required CPU time is not known.  The processer should know in advance how much time process will take.
  • 7.
  • 8. Process Wait Time : Service Time - Arrival Time P0 3 - 0 = 3 P1 0 - 0 = 0 P2 16 - 2 = 14 P3 8 - 3 = 5 Average Wait Time: (3+0+14+5) / 4 = 5.50
  • 9. Priority Based Scheduling  Priority scheduling is a non-preemptive algorithm and one of the most common scheduling algorithms in batch systems.  Each process is assigned a priority. Process with highest priority is to be executed first and so on.  Processes with same priority are executed on first come first served basis.  Priority can be decided based on memory requirements, time requirements or any other resource requirement.
  • 10.
  • 11. Process Wait Time : Service Time - Arrival Time P0 9 - 0 = 9 P1 6 - 1 = 5 P2 14 - 2 = 12 P3 0 - 0 = 0 Average Wait Time: (9+5+12+0) / 4 = 6.5
  • 12. Round Robin Scheduling  Round Robin is the preemptive process scheduling algorithm.  Each process is provided a fix time to execute, it is called a quantum.  Once a process is executed for a given time period, it is preempted and other process executes for a given time period.  Context switching is used to save states of preempted processes
  • 13.
  • 14. Process Wait Time : Service Time - Arrival Time P0 (0 - 0) + (12 - 3) = 9 P1 (3 - 1) = 2 P2 (6 - 2) + (14 - 9) + (20 - 17) = 12 P3 (9 - 3) + (17 - 12) = 11 Average Wait Time: (9+2+12+11) / 4 = 8.5
  • 15. Multiple-Level Queues Scheduling Multiple-level queues are not an independent scheduling algorithm. They make use of other existing algorithms to group and schedule jobs with common characteristics. • Multiple queues are maintained for processes with common characteristics. • Each queue can have its own scheduling algorithms. • Priorities are assigned to each queue. For example, CPU-bound jobs can be scheduled in one queue and all I/O-bound jobs in another queue. The Process Scheduler then alternately selects jobs from each queue and assigns them to the CPU based on the algorithm assigned to the queue.