SlideShare a Scribd company logo
1 of 22
CPU Scheduling Prof.PrasadSawant Lecturer  MCA MACS College Pune Operating System Concepts Prasad Sawant
Alternating Sequence of CPU And I/O Bursts Operating System Concepts Prasad Sawant
CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1.	Switches from running to waiting state. 2.	Switches from running to ready state. 3.	Switches from waiting to ready. 4.	Terminates. Scheduling under 1 and 4 is nonpreemptive. All other scheduling is preemptive. Operating System Concepts Prasad Sawant
Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler. Operating System Concepts Prasad Sawant
Scheduling Criteria CPU utilization – keep the CPU as busy as possible Throughput– # of processes that complete their execution per time unit Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue Operating System Concepts Prasad Sawant
Keep  in mind  Waiting  time (WT)=start time(ST)-Arrival time (AT) Finish time (FT)=start time(ST)+Burst  Time(BT) Total  turn around time(TOT)=Finish time(FT)-Arrival time (AT ) Operating System Concepts Prasad Sawant
Optimization Criteria Max CPU utilization Max throughput Min turnaround time  Min waiting time  Min response time Operating System Concepts Prasad Sawant
First-Come, First-Served (FCFS) Scheduling Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3   schedule schedule           0                 10           20                                       30  schedule Waiting time for P1  = 0; P2  = 24; P3 = 27 Average waiting time:  (0 + 24 + 27)/3 = 17 P3  30    P2   27   P1                            24
First-Come, First-Served (FCFS) Scheduling Gantt Chart Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3   schedule schedule schedule Waiting time for P1  = 0; P2  = 24; P3 = 27 Average waiting time:  (0 + 24 + 27)/3 = 17 0              P1                                                      24 P2     27 P3     30
Exercise   Find Average waiting time for  Suppose that the processes arrive in the order: P2 , P3 , P1 Operating System Concepts Prasad Sawant
Shortest-Job-First (SJR) Scheduling Associate with each process the length of its next CPU burst.  Use these lengths to schedule the process with the shortest time. Two schemes:  nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt.  This scheme is know as the Shortest-Remaining-Time-First (SRTF). SJF is optimal – gives minimum average waiting time for a given set of processes. Operating System Concepts Prasad Sawant
Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant schedule schedule schedule schedule 0    P1                                           7 P3      8 P2      12 P4       16 Average waiting time = (0+6+3+7)/4=4
Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant P1                                           7 P3      8 P2      12 P4       16 Average waiting time = (0+6+3+7)/4=4  Average TOT =(7+10+4+11)/4=8
Preemptive SJF Operating System Concepts Prasad Sawant 7 P schedule 10 10-1=9 schedule 1 1-1=0 schedule 17 17-2=15 schedule 5 5-3=2 0 P1             1 P2                        5          P4               10 P1                  17 P3                 26
Priority Scheduling Operating System Concepts Prasad Sawant Schedule   6 6 Schedule   0 0 Schedule   16 16 Schedule   18 18 Schedule   1 1 41/5=8.2 ms 0      P2         1 P5                          6 P1                                             16 P3             18 P4    19 0
SJF Preemptive  Priority Scheduling  Operating System Concepts Prasad Sawant P 5 scheduled 19 19-3=16 scheduled 24 24-1=23 scheduled 12 12-3=9 scheduled 3 3-3=0 48/4=12 ms 0      P1        3  P4                12   P3          19 P1           24 P2             30
Round Robin  Scheduling   Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds.  After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/nof the CPU time in chunks of at most q time units at once.  No process waits more than (n-1)q time units. Operating System Concepts Prasad Sawant
Time Quantum and Context Switch Time  Operating System Concepts Prasad Sawant 0 0                                          10 1 6           10 9 2 3 4 5 6 7 8 9 10 1
Round Robin  Time  Quantum 4 Operating System Concepts Prasad Sawant 24-4=20 20-4=16 16-4=12 12-4=8 8-4=4 4-4=0 scheduled 30 scheduled 7 scheduled 10 0    P1  4   P2        7   P3        10   P1        14   P1        18   P1        22   P1        26   P1        30
Questions  Define the difference between pre-emptive and non-pre-emptive scheduling.  Explain the concept of a priority used in scheduling. Why is priority working usually chosen for real time processes? Define by difference between preemptive and non-emptive scheduling. Comment on the principle disadvantage of each of these scheduling methods: FCFS, SJF, RR Operating System Concepts Prasad Sawant
Bibliography  Operating System Principle-Peter Galvin Galvin   Prof.S.G.Lakhdive (Dept .Computer Sci ) Prof.Ramkirshna More A.C.S College Akurdi Mr. AbhishekNagar  Web Administrator at Symbiois Operating System Concepts Prasad Sawant
Thanks  you  Operating System Concepts Prasad Sawant

More Related Content

What's hot

Process Scheduling
Process SchedulingProcess Scheduling
Process Schedulingvampugani
 
CPU SCHEDULING AND DEADLOCK
CPU SCHEDULING AND	DEADLOCKCPU SCHEDULING AND	DEADLOCK
CPU SCHEDULING AND DEADLOCKVicky Kumar
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU SchedulingIzaz Roghani
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinUniversitas Pembangunan Panca Budi
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinShubham Singh
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)Harshit Jain
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin schedulingRaghav S
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSMargrat C R
 
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)Anne Lee
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithmsShanu Kumar
 
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
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)Nagarajan
 

What's hot (20)

OSCh6
OSCh6OSCh6
OSCh6
 
Ch5
Ch5Ch5
Ch5
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
cpu scheduling in os
cpu scheduling in oscpu scheduling in os
cpu scheduling in os
 
CPU SCHEDULING AND DEADLOCK
CPU SCHEDULING AND	DEADLOCKCPU SCHEDULING AND	DEADLOCK
CPU SCHEDULING AND DEADLOCK
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
 
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round RobinComparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
Comparison Analysis of CPU Scheduling : FCFS, SJF and Round Robin
 
Ch6 CPU Scheduling galvin
Ch6 CPU Scheduling galvinCh6 CPU Scheduling galvin
Ch6 CPU Scheduling galvin
 
Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Scheduling
SchedulingScheduling
Scheduling
 
5 Process Scheduling
5 Process Scheduling5 Process Scheduling
5 Process Scheduling
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Round robin scheduling
Round robin schedulingRound robin scheduling
Round robin scheduling
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
05 lcd slides 1 - CPU SCHEDULING (Powerpoint)
 
CPU Scheduling algorithms
CPU Scheduling algorithmsCPU Scheduling algorithms
CPU Scheduling algorithms
 
Ch6
Ch6Ch6
Ch6
 
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.
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 

Viewers also liked (18)

Cartesio: la conoscenza
Cartesio: la conoscenzaCartesio: la conoscenza
Cartesio: la conoscenza
 
La conoscenza
La conoscenzaLa conoscenza
La conoscenza
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
 
Cartesio
CartesioCartesio
Cartesio
 
Licei scientifico e linguistico cartesio
Licei scientifico e linguistico cartesioLicei scientifico e linguistico cartesio
Licei scientifico e linguistico cartesio
 
Cartesio
CartesioCartesio
Cartesio
 
1. renato cartesio 1
1. renato cartesio 11. renato cartesio 1
1. renato cartesio 1
 
El teatro barroco la comedia nueva
El teatro barroco la comedia nuevaEl teatro barroco la comedia nueva
El teatro barroco la comedia nueva
 
Teatro barroco
Teatro barrocoTeatro barroco
Teatro barroco
 
El teatro barroco y la comedia nueva
El teatro barroco y la comedia nuevaEl teatro barroco y la comedia nueva
El teatro barroco y la comedia nueva
 
Cartesio
CartesioCartesio
Cartesio
 
El teatro barroco
El teatro barrocoEl teatro barroco
El teatro barroco
 
El Teatro Barroco 1ºBach
El Teatro Barroco 1ºBachEl Teatro Barroco 1ºBach
El Teatro Barroco 1ºBach
 
EL TEATRO BARROCO
EL TEATRO BARROCOEL TEATRO BARROCO
EL TEATRO BARROCO
 
El teatro del Barroco
El teatro del BarrocoEl teatro del Barroco
El teatro del Barroco
 
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosa
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosaLiteratura del Barroco: teatro del Siglo de Oro, lírica y prosa
Literatura del Barroco: teatro del Siglo de Oro, lírica y prosa
 
Teatro barroco (I)
Teatro barroco (I)Teatro barroco (I)
Teatro barroco (I)
 

Similar to CPU Sheduling

Operating System 5
Operating System 5Operating System 5
Operating System 5tech2click
 
Ch6
Ch6Ch6
Ch6C.U
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Nagarajan
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2pri534
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling gopi7
 
Operating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingOperating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingVaibhav Khanna
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System SchedulingVishnu Prasad
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.Ravi Kumar Patel
 
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...Shanmuganathan C
 
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 - EngineeringYogesh Santhan
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfAkarshNag
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfRakibul Rakib
 

Similar to CPU Sheduling (20)

Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Ch6
Ch6Ch6
Ch6
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Operating System Sheduling
Operating System ShedulingOperating System Sheduling
Operating System Sheduling
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
 
CH06.pdf
CH06.pdfCH06.pdf
CH06.pdf
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Os..
Os..Os..
Os..
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling
 
Operating system 29 non preemptive scheduling
Operating system 29 non preemptive schedulingOperating system 29 non preemptive scheduling
Operating system 29 non preemptive scheduling
 
Operating System Scheduling
Operating System SchedulingOperating System Scheduling
Operating System Scheduling
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
AlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorithmsAlgorit...
 
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
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdf
 
Distributed Operating System_2
Distributed Operating System_2Distributed Operating System_2
Distributed Operating System_2
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdf
 
Fcfs and sjf
Fcfs and sjfFcfs and sjf
Fcfs and sjf
 

Recently uploaded

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 

Recently uploaded (20)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 

CPU Sheduling

  • 1. CPU Scheduling Prof.PrasadSawant Lecturer MCA MACS College Pune Operating System Concepts Prasad Sawant
  • 2. Alternating Sequence of CPU And I/O Bursts Operating System Concepts Prasad Sawant
  • 3. CPU Scheduler Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state. 2. Switches from running to ready state. 3. Switches from waiting to ready. 4. Terminates. Scheduling under 1 and 4 is nonpreemptive. All other scheduling is preemptive. Operating System Concepts Prasad Sawant
  • 4. Dispatcher Dispatcher module gives control of the CPU to the process selected by the short-term scheduler. Operating System Concepts Prasad Sawant
  • 5. Scheduling Criteria CPU utilization – keep the CPU as busy as possible Throughput– # of processes that complete their execution per time unit Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue Operating System Concepts Prasad Sawant
  • 6. Keep in mind Waiting time (WT)=start time(ST)-Arrival time (AT) Finish time (FT)=start time(ST)+Burst Time(BT) Total turn around time(TOT)=Finish time(FT)-Arrival time (AT ) Operating System Concepts Prasad Sawant
  • 7. Optimization Criteria Max CPU utilization Max throughput Min turnaround time Min waiting time Min response time Operating System Concepts Prasad Sawant
  • 8. First-Come, First-Served (FCFS) Scheduling Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3 schedule schedule 0 10 20 30 schedule Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 P3 30 P2 27 P1 24
  • 9. First-Come, First-Served (FCFS) Scheduling Gantt Chart Operating System Concepts Prasad Sawant Suppose that the processes arrive in the order: P1 , P2 , P3 schedule schedule schedule Waiting time for P1 = 0; P2 = 24; P3 = 27 Average waiting time: (0 + 24 + 27)/3 = 17 0 P1 24 P2 27 P3 30
  • 10. Exercise Find Average waiting time for Suppose that the processes arrive in the order: P2 , P3 , P1 Operating System Concepts Prasad Sawant
  • 11. Shortest-Job-First (SJR) Scheduling Associate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. Two schemes: nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF). SJF is optimal – gives minimum average waiting time for a given set of processes. Operating System Concepts Prasad Sawant
  • 12. Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant schedule schedule schedule schedule 0 P1 7 P3 8 P2 12 P4 16 Average waiting time = (0+6+3+7)/4=4
  • 13. Example of Non-Preemptive SJF Operating System Concepts Prasad Sawant P1 7 P3 8 P2 12 P4 16 Average waiting time = (0+6+3+7)/4=4 Average TOT =(7+10+4+11)/4=8
  • 14. Preemptive SJF Operating System Concepts Prasad Sawant 7 P schedule 10 10-1=9 schedule 1 1-1=0 schedule 17 17-2=15 schedule 5 5-3=2 0 P1 1 P2 5 P4 10 P1 17 P3 26
  • 15. Priority Scheduling Operating System Concepts Prasad Sawant Schedule 6 6 Schedule 0 0 Schedule 16 16 Schedule 18 18 Schedule 1 1 41/5=8.2 ms 0 P2 1 P5 6 P1 16 P3 18 P4 19 0
  • 16. SJF Preemptive Priority Scheduling Operating System Concepts Prasad Sawant P 5 scheduled 19 19-3=16 scheduled 24 24-1=23 scheduled 12 12-3=9 scheduled 3 3-3=0 48/4=12 ms 0 P1 3 P4 12 P3 19 P1 24 P2 30
  • 17. Round Robin Scheduling Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue. If there are n processes in the ready queue and the time quantum is q, then each process gets 1/nof the CPU time in chunks of at most q time units at once. No process waits more than (n-1)q time units. Operating System Concepts Prasad Sawant
  • 18. Time Quantum and Context Switch Time Operating System Concepts Prasad Sawant 0 0 10 1 6 10 9 2 3 4 5 6 7 8 9 10 1
  • 19. Round Robin Time Quantum 4 Operating System Concepts Prasad Sawant 24-4=20 20-4=16 16-4=12 12-4=8 8-4=4 4-4=0 scheduled 30 scheduled 7 scheduled 10 0 P1 4 P2 7 P3 10 P1 14 P1 18 P1 22 P1 26 P1 30
  • 20. Questions Define the difference between pre-emptive and non-pre-emptive scheduling. Explain the concept of a priority used in scheduling. Why is priority working usually chosen for real time processes? Define by difference between preemptive and non-emptive scheduling. Comment on the principle disadvantage of each of these scheduling methods: FCFS, SJF, RR Operating System Concepts Prasad Sawant
  • 21. Bibliography Operating System Principle-Peter Galvin Galvin Prof.S.G.Lakhdive (Dept .Computer Sci ) Prof.Ramkirshna More A.C.S College Akurdi Mr. AbhishekNagar Web Administrator at Symbiois Operating System Concepts Prasad Sawant
  • 22. Thanks you Operating System Concepts Prasad Sawant