SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
Nagarajan
 

Tendances (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
 

En vedette

Cartesio: la conoscenza
Cartesio: la conoscenzaCartesio: la conoscenza
Cartesio: la conoscenza
ritaleuzzi
 
1. renato cartesio 1
1. renato cartesio 11. renato cartesio 1
1. renato cartesio 1
Elisa2088
 
El Teatro Barroco 1ºBach
El Teatro Barroco 1ºBachEl Teatro Barroco 1ºBach
El Teatro Barroco 1ºBach
javilasan
 
Teatro barroco (I)
Teatro barroco (I)Teatro barroco (I)
Teatro barroco (I)
amm76
 

En vedette (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)
 

Similaire à CPU Sheduling

Operating System 5
Operating System 5Operating System 5
Operating System 5
tech2click
 
Ch6
Ch6Ch6
Ch6
C.U
 
Process management in os
Process management in osProcess management in os
Process management in os
Miong 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 2
pri534
 
cpu sechduling
cpu sechduling cpu sechduling
cpu sechduling
gopi7
 
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 - Engineering
Yogesh Santhan
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdf
AkarshNag
 

Similaire à 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
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Os..
Os..Os..
Os..
 
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
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

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