SlideShare a Scribd company logo
1 of 13
CPU Scheduling
Contents
 CPU Scheduling
 Scheduling Criteria
 Scheduling Algorithms
 First Come First Served Scheduling
 Shortest Job First Scheduling
 Priority Scheduling
 Round Robin Scheduling
CPU Scheduling
 It is the change of ready state to running state of the process.
CPU scheduling decisions may take place when a process:
 Switches from running to waiting state.
 Switches from running to ready state.
 Switches from waiting to ready.
 Terminates
Scheduling Criteria
 CPU utilization : keep the CPU as busy as possible.
 Turn around Time: amount of time to execute a particular
process.
 Waiting time : amount of time a process has been waiting in
the queue.
 Response time : amount of time it takes from when a request
was submitted until the first response is produced not output.
Scheduling Algorithms
 First Come First Served Scheduling
 Shortest Job First Scheduling
 Priority Scheduling
 Round Robin Scheduling
First Come First Served
Suppose that the processes arrive in the order:
 P1 , P2 , P3
 The Gantt Chart for the schedule is:
 Waiting time for P1 = 0; P2 = 24; P3 = 27
 Average waiting time: (0 + 24 + 27)/3 = 17
Process Burst Time
P1 24
P2 3
P3 3
p1 p2 p3
0 24 27 30
First Come, First Served
 Suppose that the processes arrive in the order :
 P2 , P3 , P1 (P1:24,P2:3,P3:3)
 The Gantt chart for the schedule is:
0 3 6 30
 Waiting time for P1 = 6; P2 = 0; P3 = 3
 Average waiting time: (6 + 0 + 3)/3 = 3
 Much better than previous case
 Convoy effect - short process behind long process
p2 p3 p1
Shortest Job First
Normal SJF
The Gantt Chart for SJF (Normal) is:
0 3 7 14
Average waiting time = (0 + 3 + 7)/3 = 3.33
Process Burst Time
P1 7
P2 3
P3 4
p2 p3 p1
Shortest Job First
Non-Preemptive SJF
 The Gantt Chart for SJF (non-preemptive) is:
0 7 8 12 16
 Average waiting time = (0 + 6 + 3 + 7)/4 = 4
Process Arrival Time Burst
Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
p1 p3 p2 p4
Shortest Job First
 Preemptive SJF
 The Gantt Chart for SJF (preemptive) is:
0 2 4 5 7 11 16
 Average waiting time = (9 + 1 + 0 +2)/4 = 3
Process Arrival Time Burst
Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4
p1 p2 p3 p2 p4 p1
Priority
 Gantt Chart
0 1 6 16 18 19
 Average waiting time = (6 + 0 + 16 + 18 + 1)/5 = 8.2
Process Burst Time Priority
P1 10 3
P2 1 1
P3 2 4
P4 1 5
P5 5 2
p2 p5 p1 p3 p4
Round Robin
 Quantum time = 4 milliseconds
 The Gantt chart is:
0 4 7 10 14 18 22 26 30
 Average waiting time = {[0+(10-4)]+4+7}/3 = 5.6
Process Burst Time
P1 24
P2 3
P3 3
p1 p2 p3 p1 p1 p1 p1 p1
Thank You

More Related Content

What's hot

First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)nikeAthena
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Mukesh Chinta
 
Cs6503 theory of computation lesson plan
Cs6503 theory of computation  lesson planCs6503 theory of computation  lesson plan
Cs6503 theory of computation lesson planappasami
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithmssathish sak
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu schedulingpiku das
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating systemAli Haider
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Ra'Fat Al-Msie'deen
 
Priority Scheduling
Priority Scheduling  Priority Scheduling
Priority Scheduling JawadHaider36
 
deadlock avoidance
deadlock avoidancedeadlock avoidance
deadlock avoidancewahab13
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
Critical section problem in operating system.
Critical section problem in operating system.Critical section problem in operating system.
Critical section problem in operating system.MOHIT DADU
 
Solving Quadratic Assignment Problems (QAP) using Ant Colony System
Solving Quadratic Assignment Problems (QAP) using Ant Colony SystemSolving Quadratic Assignment Problems (QAP) using Ant Colony System
Solving Quadratic Assignment Problems (QAP) using Ant Colony SystemAjay Bidyarthy
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-SystemsVenkata Sreeram
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OSMsAnita2
 

What's hot (20)

First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)First-Come-First-Serve (FCFS)
First-Come-First-Serve (FCFS)
 
Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)Process scheduling (CPU Scheduling)
Process scheduling (CPU Scheduling)
 
Cs6503 theory of computation lesson plan
Cs6503 theory of computation  lesson planCs6503 theory of computation  lesson plan
Cs6503 theory of computation lesson plan
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Process scheduling
Process schedulingProcess scheduling
Process scheduling
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"Operating Systems - "Chapter 5 Process Synchronization"
Operating Systems - "Chapter 5 Process Synchronization"
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
Priority Scheduling
Priority Scheduling  Priority Scheduling
Priority Scheduling
 
Tcp/ip model
Tcp/ip  modelTcp/ip  model
Tcp/ip model
 
deadlock avoidance
deadlock avoidancedeadlock avoidance
deadlock avoidance
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
Critical section problem in operating system.
Critical section problem in operating system.Critical section problem in operating system.
Critical section problem in operating system.
 
Solving Quadratic Assignment Problems (QAP) using Ant Colony System
Solving Quadratic Assignment Problems (QAP) using Ant Colony SystemSolving Quadratic Assignment Problems (QAP) using Ant Colony System
Solving Quadratic Assignment Problems (QAP) using Ant Colony System
 
DeadLock in Operating-Systems
DeadLock in Operating-SystemsDeadLock in Operating-Systems
DeadLock in Operating-Systems
 
Deadlock Avoidance - OS
Deadlock Avoidance - OSDeadlock Avoidance - OS
Deadlock Avoidance - OS
 
Sa by shekhar
Sa by shekharSa by shekhar
Sa by shekhar
 
Lecture 4 process cpu scheduling
Lecture 4   process cpu schedulingLecture 4   process cpu scheduling
Lecture 4 process cpu scheduling
 

Similar to Cpu scheduling

Similar to Cpu scheduling (20)

cpu schduling ppt.pdf
cpu schduling ppt.pdfcpu schduling ppt.pdf
cpu schduling ppt.pdf
 
CPU Scheduling.pdf
CPU Scheduling.pdfCPU Scheduling.pdf
CPU Scheduling.pdf
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
Operating system
Operating systemOperating system
Operating system
 
Operating system
Operating systemOperating system
Operating system
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
What is the waiting time of each process for each of the scheduling a.pdf
What is the waiting time of each process for each of the scheduling a.pdfWhat is the waiting time of each process for each of the scheduling a.pdf
What is the waiting time of each process for each of the scheduling a.pdf
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
OSCh6
OSCh6OSCh6
OSCh6
 
OS_Ch6
OS_Ch6OS_Ch6
OS_Ch6
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 
Operating Systems Third Unit - Fourth Semester - Engineering
Operating Systems Third Unit  - Fourth Semester - EngineeringOperating Systems Third Unit  - Fourth Semester - Engineering
Operating Systems Third Unit - Fourth Semester - Engineering
 
Ch5
Ch5Ch5
Ch5
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
Os module 2 ba
Os module 2 baOs module 2 ba
Os module 2 ba
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 

More from Arafat Hossan

Data Dictionary in System Analysis and Design
Data Dictionary in System Analysis and DesignData Dictionary in System Analysis and Design
Data Dictionary in System Analysis and DesignArafat Hossan
 
Digital Data to Digital Signal Conversion
Digital Data to Digital Signal ConversionDigital Data to Digital Signal Conversion
Digital Data to Digital Signal ConversionArafat Hossan
 
Error and Exception Handling in PHP
Error and Exception Handling in PHPError and Exception Handling in PHP
Error and Exception Handling in PHPArafat Hossan
 
Bus Interface Unit(BIU) of 8086 Microprocessor
Bus Interface Unit(BIU) of 8086 MicroprocessorBus Interface Unit(BIU) of 8086 Microprocessor
Bus Interface Unit(BIU) of 8086 MicroprocessorArafat Hossan
 
Mapping cardinalities
Mapping cardinalitiesMapping cardinalities
Mapping cardinalitiesArafat Hossan
 
Relational algebra in DBMS
Relational algebra in DBMSRelational algebra in DBMS
Relational algebra in DBMSArafat Hossan
 
Processes in Operating System
Processes in Operating SystemProcesses in Operating System
Processes in Operating SystemArafat Hossan
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest pathArafat Hossan
 
Job sequencing with deadline
Job sequencing with deadlineJob sequencing with deadline
Job sequencing with deadlineArafat Hossan
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaArafat Hossan
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaArafat Hossan
 

More from Arafat Hossan (20)

Data Dictionary in System Analysis and Design
Data Dictionary in System Analysis and DesignData Dictionary in System Analysis and Design
Data Dictionary in System Analysis and Design
 
Digital Data to Digital Signal Conversion
Digital Data to Digital Signal ConversionDigital Data to Digital Signal Conversion
Digital Data to Digital Signal Conversion
 
Error and Exception Handling in PHP
Error and Exception Handling in PHPError and Exception Handling in PHP
Error and Exception Handling in PHP
 
Bus Interface Unit(BIU) of 8086 Microprocessor
Bus Interface Unit(BIU) of 8086 MicroprocessorBus Interface Unit(BIU) of 8086 Microprocessor
Bus Interface Unit(BIU) of 8086 Microprocessor
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Web frameworks
Web frameworksWeb frameworks
Web frameworks
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Deadlock
DeadlockDeadlock
Deadlock
 
Data model
Data modelData model
Data model
 
Mapping cardinalities
Mapping cardinalitiesMapping cardinalities
Mapping cardinalities
 
Sql in dbms
Sql in dbmsSql in dbms
Sql in dbms
 
Relational algebra in DBMS
Relational algebra in DBMSRelational algebra in DBMS
Relational algebra in DBMS
 
Divisible rules
Divisible rulesDivisible rules
Divisible rules
 
Processes in Operating System
Processes in Operating SystemProcesses in Operating System
Processes in Operating System
 
All pair shortest path
All pair shortest pathAll pair shortest path
All pair shortest path
 
Asymptotic notation
Asymptotic notationAsymptotic notation
Asymptotic notation
 
Merge sort
Merge sortMerge sort
Merge sort
 
Job sequencing with deadline
Job sequencing with deadlineJob sequencing with deadline
Job sequencing with deadline
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 

Recently uploaded

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
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
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
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
 
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
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
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
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
(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
 

Recently uploaded (20)

9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
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
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
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 )
 
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
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
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
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
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.
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
(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...
 

Cpu scheduling

  • 2. Contents  CPU Scheduling  Scheduling Criteria  Scheduling Algorithms  First Come First Served Scheduling  Shortest Job First Scheduling  Priority Scheduling  Round Robin Scheduling
  • 3. CPU Scheduling  It is the change of ready state to running state of the process. CPU scheduling decisions may take place when a process:  Switches from running to waiting state.  Switches from running to ready state.  Switches from waiting to ready.  Terminates
  • 4. Scheduling Criteria  CPU utilization : keep the CPU as busy as possible.  Turn around Time: amount of time to execute a particular process.  Waiting time : amount of time a process has been waiting in the queue.  Response time : amount of time it takes from when a request was submitted until the first response is produced not output.
  • 5. Scheduling Algorithms  First Come First Served Scheduling  Shortest Job First Scheduling  Priority Scheduling  Round Robin Scheduling
  • 6. First Come First Served Suppose that the processes arrive in the order:  P1 , P2 , P3  The Gantt Chart for the schedule is:  Waiting time for P1 = 0; P2 = 24; P3 = 27  Average waiting time: (0 + 24 + 27)/3 = 17 Process Burst Time P1 24 P2 3 P3 3 p1 p2 p3 0 24 27 30
  • 7. First Come, First Served  Suppose that the processes arrive in the order :  P2 , P3 , P1 (P1:24,P2:3,P3:3)  The Gantt chart for the schedule is: 0 3 6 30  Waiting time for P1 = 6; P2 = 0; P3 = 3  Average waiting time: (6 + 0 + 3)/3 = 3  Much better than previous case  Convoy effect - short process behind long process p2 p3 p1
  • 8. Shortest Job First Normal SJF The Gantt Chart for SJF (Normal) is: 0 3 7 14 Average waiting time = (0 + 3 + 7)/3 = 3.33 Process Burst Time P1 7 P2 3 P3 4 p2 p3 p1
  • 9. Shortest Job First Non-Preemptive SJF  The Gantt Chart for SJF (non-preemptive) is: 0 7 8 12 16  Average waiting time = (0 + 6 + 3 + 7)/4 = 4 Process Arrival Time Burst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 p1 p3 p2 p4
  • 10. Shortest Job First  Preemptive SJF  The Gantt Chart for SJF (preemptive) is: 0 2 4 5 7 11 16  Average waiting time = (9 + 1 + 0 +2)/4 = 3 Process Arrival Time Burst Time P1 0.0 7 P2 2.0 4 P3 4.0 1 P4 5.0 4 p1 p2 p3 p2 p4 p1
  • 11. Priority  Gantt Chart 0 1 6 16 18 19  Average waiting time = (6 + 0 + 16 + 18 + 1)/5 = 8.2 Process Burst Time Priority P1 10 3 P2 1 1 P3 2 4 P4 1 5 P5 5 2 p2 p5 p1 p3 p4
  • 12. Round Robin  Quantum time = 4 milliseconds  The Gantt chart is: 0 4 7 10 14 18 22 26 30  Average waiting time = {[0+(10-4)]+4+7}/3 = 5.6 Process Burst Time P1 24 P2 3 P3 3 p1 p2 p3 p1 p1 p1 p1 p1