SlideShare a Scribd company logo
1 of 25
OPERATING SYSTEM
CPU Scheduling
Algorithm
SCHEDULING CRITERIA
There are many scheduling algorithms and various
criteria to judge their performance some criteria are
as follows:
o CPU Utilization: CPU should be busy (from 0 to
100%)
o Throughput: the number of process executed in a
specified time period
o Turnaround time: needed to execute a process
o Waiting Time: amount of time a process has
waited
o Response Time: between request and response
A CPU SCHEDULING ALGORITHM
MUST MAXIMIZE THE FOLLOWING
CPU utilization should maximum
Throughput should maximum
A CPU SCHEDULING ALGORITHM MUST
MINIMIZE THE FOLLOWING:
 Waiting Time should minimum
 Response Time should minimum
 Turnaround Time should minimum
SCHEDULING ALGORITHMS:
Below is the list of some well known
algorithms
First Come First Served (FCFS)
scheduling- non preemptive
Shortest job First(SJF) scheduling
preemptive non preemptive
Priority Scheduling preemptive non
preemptive
Round robin scheduling preemptive
TIMELINES:
Scheduling is based on the information
that is available at the give time. we
need some ways to represent the state
of the system and any process in it
and how it change over time.
Gantt chart are used for this purpose
to present them in graphical way.
GANTT CHART
1st Process 2nd Process More Processes
1st process end time 2nd Process end time…… End time.
Start time p1 end time p2end time……End time.
First come First Served (FCFS)
•Simplest
•Similar to queue
Process Name Start Time Burst Time
Process 1 0 24
Process 2 0 3
Process3 0 3
Example 1
Process1 Process2 Process3
0 24 27 30
FCFS
 The following table shows the waiting time for each
process:
Average Waiting time is(0+24+27)/3=17
Process
name
Arrival
time
Burst time Finish time Waiting
time
Process1 0 24 24 0
Process2 0 3 27 24
Process3 0 3 30 27
Gantt chart
P1 P2 P3
0 3 6
30
Process Name Start Time Burst Time
Process 2 0 3
Process 3 0 3
Process1 0 24
Example 2
Process
name
Arrival time Burst time Finish time Waiting
time
Process2 0 3 3 0
Process3 0 3 6 3
Process1 0 24 30 6
Average Waiting time is (0+3+6)/3= 3
Shortest Job First:
Another way to scheduling jobs is
to pick the job that will take least
amount of time to complete, based
on burst size. In this way the
average waiting time reduced.
•Normal SJF
•Non preemptive
• Preemptive
Non preemptive SJF Example:
Process name Arrival time Burst time
Process1 0 7
Process2 2 4
Process3 4 2
Process4 5 4
Process name Arrival time Burst time Finish time Waiting time
Process1 0 7 7 0
Process2 2 4 13 7
Process3 4 2 9 3
Process4 5 4 17 8
Process name Arrival time Burst time
Process1 0 7
Process2 2 4
Process3 4 1
Process4 5 4
Preemptive SJF Example 2
Process name Arrival time Burst time Finish time Waiting time
Process1 0 7 16 9
Process2 2 4 7 1
Process3 4 1 5 0
Process4 5 4 11 2
Requires that each process should
have priority associated with it.
Priority scheduling:
Priority scheduling Example for Non Preemptive
Process name Burst Time Priority
Process1 10 3
Process2 1 1
Process3 2 3
Process4 1 4
Process5 5 2
Process2 Process5 Process1 Process3 Process4
Priority scheduling Example Preemptive
Process name Arrival time Burst time Priority
Process1 0 10 3
Process2 2 1 1
Process3 4 2 2
Process4 6 1 4
Process5 8 5 5
Gantt Chart
0 1 6 16 18 ` 19
P1 P2 P1 P3 P1 P2 P5
Round robin scheduling
Gantt Chart
0 2 3 4 6 13 14
19
Another way to schedule jobs is to assign a small amount of
time to each process in which it executes. This time the unite
is called time quantum or tie slice, the job is allocated to CPU
for the quantum. when the time quantum expires, the process
preempted from CPU and replaced by next process in the
circle queue.
Process name Burst time
Process1 24
Process2 3
Process3 3
Gantt Chart
P1 P2 P3 P1 P1 P1 P1 P1
0 4 7 10 14 18 22 26 30
(10+7+30)/3=16
THANKS…..
DO YOU HAVE
ANY QUESTION?

More Related Content

What's hot (11)

Operating systems-presentation
Operating systems-presentationOperating systems-presentation
Operating systems-presentation
 
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
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Operating Systems - Process Scheduling
Operating Systems - Process SchedulingOperating Systems - Process Scheduling
Operating Systems - Process Scheduling
 
CPU Sheduling
CPU Sheduling CPU Sheduling
CPU Sheduling
 
Scheduling ppt @ DOMS
Scheduling ppt @ DOMSScheduling ppt @ DOMS
Scheduling ppt @ DOMS
 
Run time
Run timeRun time
Run time
 
Rpd
RpdRpd
Rpd
 
Os
OsOs
Os
 
Sol5
Sol5Sol5
Sol5
 
Dbms recovering from a system crash
Dbms recovering from a system crashDbms recovering from a system crash
Dbms recovering from a system crash
 

Similar to Operating system (20)

CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
Ch05 cpu-scheduling
Ch05 cpu-schedulingCh05 cpu-scheduling
Ch05 cpu-scheduling
 
CPU Scheduling.pdf
CPU Scheduling.pdfCPU Scheduling.pdf
CPU Scheduling.pdf
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Cpu Scheduling Galvin
Cpu Scheduling GalvinCpu Scheduling Galvin
Cpu Scheduling Galvin
 
Round-ribon algorithm presntation
Round-ribon algorithm presntationRound-ribon algorithm presntation
Round-ribon algorithm presntation
 
OS Process Chapter 3.pdf
OS Process Chapter 3.pdfOS Process Chapter 3.pdf
OS Process Chapter 3.pdf
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
CPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptxCPU Scheduling Lecture 5 - 6.pptx
CPU Scheduling Lecture 5 - 6.pptx
 
cpu schduling ppt.pdf
cpu schduling ppt.pdfcpu schduling ppt.pdf
cpu schduling ppt.pdf
 
CH06.pdf
CH06.pdfCH06.pdf
CH06.pdf
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
ch_scheduling (1).ppt
ch_scheduling (1).pptch_scheduling (1).ppt
ch_scheduling (1).ppt
 
Unit iios process scheduling and synchronization
Unit iios process scheduling and synchronizationUnit iios process scheduling and synchronization
Unit iios process scheduling and synchronization
 
Cpu_sheduling.pptx
Cpu_sheduling.pptxCpu_sheduling.pptx
Cpu_sheduling.pptx
 
Window scheduling algorithm
Window scheduling algorithmWindow scheduling algorithm
Window scheduling algorithm
 
OSCh6
OSCh6OSCh6
OSCh6
 
OS_Ch6
OS_Ch6OS_Ch6
OS_Ch6
 
Ch5
Ch5Ch5
Ch5
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 

Recently uploaded

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Operating system

  • 2. SCHEDULING CRITERIA There are many scheduling algorithms and various criteria to judge their performance some criteria are as follows: o CPU Utilization: CPU should be busy (from 0 to 100%) o Throughput: the number of process executed in a specified time period o Turnaround time: needed to execute a process o Waiting Time: amount of time a process has waited o Response Time: between request and response
  • 3. A CPU SCHEDULING ALGORITHM MUST MAXIMIZE THE FOLLOWING CPU utilization should maximum Throughput should maximum
  • 4. A CPU SCHEDULING ALGORITHM MUST MINIMIZE THE FOLLOWING:  Waiting Time should minimum  Response Time should minimum  Turnaround Time should minimum
  • 5. SCHEDULING ALGORITHMS: Below is the list of some well known algorithms First Come First Served (FCFS) scheduling- non preemptive Shortest job First(SJF) scheduling preemptive non preemptive Priority Scheduling preemptive non preemptive Round robin scheduling preemptive
  • 6. TIMELINES: Scheduling is based on the information that is available at the give time. we need some ways to represent the state of the system and any process in it and how it change over time. Gantt chart are used for this purpose to present them in graphical way.
  • 7. GANTT CHART 1st Process 2nd Process More Processes 1st process end time 2nd Process end time…… End time. Start time p1 end time p2end time……End time. First come First Served (FCFS) •Simplest •Similar to queue
  • 8.
  • 9. Process Name Start Time Burst Time Process 1 0 24 Process 2 0 3 Process3 0 3 Example 1 Process1 Process2 Process3 0 24 27 30
  • 10. FCFS  The following table shows the waiting time for each process: Average Waiting time is(0+24+27)/3=17 Process name Arrival time Burst time Finish time Waiting time Process1 0 24 24 0 Process2 0 3 27 24 Process3 0 3 30 27
  • 11. Gantt chart P1 P2 P3 0 3 6 30 Process Name Start Time Burst Time Process 2 0 3 Process 3 0 3 Process1 0 24 Example 2
  • 12. Process name Arrival time Burst time Finish time Waiting time Process2 0 3 3 0 Process3 0 3 6 3 Process1 0 24 30 6 Average Waiting time is (0+3+6)/3= 3
  • 13. Shortest Job First: Another way to scheduling jobs is to pick the job that will take least amount of time to complete, based on burst size. In this way the average waiting time reduced. •Normal SJF •Non preemptive • Preemptive
  • 14.
  • 15.
  • 16. Non preemptive SJF Example: Process name Arrival time Burst time Process1 0 7 Process2 2 4 Process3 4 2 Process4 5 4
  • 17. Process name Arrival time Burst time Finish time Waiting time Process1 0 7 7 0 Process2 2 4 13 7 Process3 4 2 9 3 Process4 5 4 17 8
  • 18. Process name Arrival time Burst time Process1 0 7 Process2 2 4 Process3 4 1 Process4 5 4 Preemptive SJF Example 2
  • 19. Process name Arrival time Burst time Finish time Waiting time Process1 0 7 16 9 Process2 2 4 7 1 Process3 4 1 5 0 Process4 5 4 11 2
  • 20. Requires that each process should have priority associated with it. Priority scheduling: Priority scheduling Example for Non Preemptive Process name Burst Time Priority Process1 10 3 Process2 1 1 Process3 2 3 Process4 1 4 Process5 5 2
  • 21. Process2 Process5 Process1 Process3 Process4 Priority scheduling Example Preemptive Process name Arrival time Burst time Priority Process1 0 10 3 Process2 2 1 1 Process3 4 2 2 Process4 6 1 4 Process5 8 5 5 Gantt Chart 0 1 6 16 18 ` 19
  • 22. P1 P2 P1 P3 P1 P2 P5 Round robin scheduling Gantt Chart 0 2 3 4 6 13 14 19 Another way to schedule jobs is to assign a small amount of time to each process in which it executes. This time the unite is called time quantum or tie slice, the job is allocated to CPU for the quantum. when the time quantum expires, the process preempted from CPU and replaced by next process in the circle queue.
  • 23.
  • 24. Process name Burst time Process1 24 Process2 3 Process3 3 Gantt Chart P1 P2 P3 P1 P1 P1 P1 P1 0 4 7 10 14 18 22 26 30 (10+7+30)/3=16

Editor's Notes

  1. Raeesa imtiaz