SlideShare a Scribd company logo
Misurata University
Faculty of Information Technology
Analyzing and evaluation Networks
Performance CN 422
Instructor : HAMZA ALI
Autumn 2015-2016
Scheduling Policies
1
Modified by: Ahmad S. AL-Majouk
Scheduling Policies
■ FIFO (first in, first out)
■ Round robin
■ SJF (shortest job first)
■ Priority Scheduling
■ Lottery scheduling
■ This is obviously an incomplete list
* 2
FIFO
FIFO is an acronym for First In, First Out, a method for organizing
and manipulating a data buffer, or data stack, where the oldest
entry, or 'bottom' of the stack, is processed first. It is analogous
to processing a queue with first-come, first-served (FCFS)
behavior: where the people leave the queue in the order in
which they arrive.
* 3
FIFO
■ FIFO: assigns the CPU based on the order of
requests
❑ Nonpreemptive: A process keeps running on a CPU
until it is blocked or terminated
❑ Also known as FCFS (first come, first serve)
+ Simple
- Short jobs can get stuck behind long jobs
* 4
FIFO
■
Suppose we have three jobs of equal length
A B Time
C
turnaround time of A
turnaround time of B
turnaround time of C
FIFO
* 5
Round Robin
■ Round Robin (RR) periodically releases the CPU
from long-running jobs
❑ Based on timer interrupts so short jobs can get a fair
share of CPU time
❑ Preemptive : a process can be forced to leave its
running state and replaced by another running process
❑ Time slice: interval between timer interrupts
* 6
Round Robin (Cont.)
■ If time slice is too long
❑ Scheduling degrades to FIFO
■ If time slice is too short
❑ Throughput suffers
❑ Context switching cost dominates
* 7
FIFO vs. Round Robin
■
Suppose we have three jobs of equal length
A B C A B C Ti
m
e
A B C
turnaround time of A
turnaround time of B
turnaround time of C
Round Robin
A B Time
C
turnaround time of A
turnaround time of B
turnaround time of C
FIFO
* 8
FIFO vs. Round Robin
■ Round Robin
+ Shorter response time
+ Fair sharing of CPU
- Not all jobs are preemptable
- Not good for jobs of the same length (longer turnaround time)
- More precisely, not good in terms of the turnaround time, because the
turnaround of job A (last graph for example) in Robin Round state is
longer than turnaround time of the same job in FIFO state.
* 9
Modified by: Ahmad S. Al-Majouk
* Instructor: Ahmad S. Al-Majouk
10
Shortest Job First (SJF)
⮚ Other name of this algorithm is Shortest-Process-Next (SPN).
Also known as STCF (shortest time to completion first).
⮚ Like FCFS, SJF is non preemptive discipline in which waiting job
(or process) with the smallest estimated run-time-to-completion is
run next.
In other words, when CPU is available, it is assigned to the process
that has smallest next CPU burst.
⮚ The SJF scheduling is especially appropriate for batch jobs for
which the run times are known in advance.
⮚ The SJF algorithm favors short jobs (or process) at the expense
of longer ones.
⮚ The obvious problem with SJF scheme is that it requires precise
knowledge of how long a job or process will run, and this information
is not usually available.
⮚ The best SJF algorithm can do is to rely on user estimates of run
times.
SJF Illustrated
A B Time
C
turnaround time of A
turnaround time of B
turnaround time of C
Shortest Job First
response time of A =
0
response time of
B
response time of
C
wait time of A =
0
wait time of
B
wait time of
C
* 11
Priority Scheduling (Multilevel Queues)
■ Priority scheduling: The process with the
highest priority runs first
■ Priority 0:
■ Priority 1:
■ Priority 2:
■ Assume that low numbers represent high priority
A
B
C
A B Ti
m
e
C
Priority
Scheduling
*
12
Multilevel Feedback Queues
• Multilevel feedback queues use multiple
queues with different priorities
– Round robin at each priority level
– Run highest priority jobs first
– Once those finish, run next highest priority, etc
– Jobs start in the highest priority queue
– If time slice expires, drop the job by one level
– If time slice does not expire, push the job up by one
level
* 13
Instructor: Ahmad S. Al-Majouk
Lottery Scheduling
■ Lottery scheduling is an adaptive scheduling
approach to address the fairness problem
❑ Each process owns some tickets
❑ On each time slice, a ticket is randomly picked
❑ On average, the allocated CPU time is proportional to
the number of tickets given to each job
* 14
Lottery Scheduling (Cont.)
■ To approximate SJF, short jobs get more tickets
■ To avoid starvation, each job gets at least one
ticket
* 15
Lottery Scheduling Example
• short jobs: 10 tickets each
• long jobs: 1 ticket each
# short jobs/#
long jobs
% of CPU for
each short job
% of CPU for
each long job
1/1 91% 9%
0/2 0% 50%
2/0 50% 0%
10/1 10% 1%
1/10 50% 5%
* 16
Instructor: Ahmad S. AL-Majouk

More Related Content

Similar to chapter03sec02_تحليل وتقييم.pptx

Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
sathish sak
 
exp 3.docx
exp 3.docxexp 3.docx
exp 3.docx
Ganesh Chavan
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
KeyreSebre
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptx
Revathi Kmp
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
Margrat C R
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
sammerkhan1
 
scheduling algorithm
scheduling algorithmscheduling algorithm
scheduling algorithm
nitish sandhawar
 
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
 
CPU scheduling algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
harini0810
 
Cpu Schedule Algorithm
Cpu Schedule AlgorithmCpu Schedule Algorithm
Cpu Schedule Algorithm
Archit Jain
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
tech2click
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdf
AkarshNag
 
What to do when detect deadlock
What to do when detect deadlockWhat to do when detect deadlock
What to do when detect deadlock
Syed Zaid Irshad
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
Prakash Sir
 
Program for FCFS CPU Scheduling.program docx
Program for FCFS CPU Scheduling.program docxProgram for FCFS CPU Scheduling.program docx
Program for FCFS CPU Scheduling.program docx
AbdulraufKhan29
 
Os..
Os..Os..
Os..
pri534
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
pri534
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
Chankey Pathak
 
OS ASSIGNMENT.pptx
OS ASSIGNMENT.pptxOS ASSIGNMENT.pptx
OS ASSIGNMENT.pptx
SrishtiManchanda5
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
M. Abdullah Wasif
 

Similar to chapter03sec02_تحليل وتقييم.pptx (20)

Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 
exp 3.docx
exp 3.docxexp 3.docx
exp 3.docx
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
Scheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptxScheduling Algorithms-Examples.pptx
Scheduling Algorithms-Examples.pptx
 
SCHEDULING ALGORITHMS
SCHEDULING ALGORITHMSSCHEDULING ALGORITHMS
SCHEDULING ALGORITHMS
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 
scheduling algorithm
scheduling algorithmscheduling algorithm
scheduling algorithm
 
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 algorithms in OS
CPU scheduling algorithms in OSCPU scheduling algorithms in OS
CPU scheduling algorithms in OS
 
Cpu Schedule Algorithm
Cpu Schedule AlgorithmCpu Schedule Algorithm
Cpu Schedule Algorithm
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
csc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdfcsc4320chapter5-2-101203002830-phpapp01.pdf
csc4320chapter5-2-101203002830-phpapp01.pdf
 
What to do when detect deadlock
What to do when detect deadlockWhat to do when detect deadlock
What to do when detect deadlock
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
Program for FCFS CPU Scheduling.program docx
Program for FCFS CPU Scheduling.program docxProgram for FCFS CPU Scheduling.program docx
Program for FCFS CPU Scheduling.program docx
 
Os..
Os..Os..
Os..
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
OS ASSIGNMENT.pptx
OS ASSIGNMENT.pptxOS ASSIGNMENT.pptx
OS ASSIGNMENT.pptx
 
CPU Scheduling
CPU SchedulingCPU Scheduling
CPU Scheduling
 

Recently uploaded

“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
AstuteBusiness
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
Fwdays
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
Jason Yip
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 

Recently uploaded (20)

“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |Astute Business Solutions | Oracle Cloud Partner |
Astute Business Solutions | Oracle Cloud Partner |
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk"Frontline Battles with DDoS: Best practices and Lessons Learned",  Igor Ivaniuk
"Frontline Battles with DDoS: Best practices and Lessons Learned", Igor Ivaniuk
 
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 

chapter03sec02_تحليل وتقييم.pptx

  • 1. Misurata University Faculty of Information Technology Analyzing and evaluation Networks Performance CN 422 Instructor : HAMZA ALI Autumn 2015-2016 Scheduling Policies 1 Modified by: Ahmad S. AL-Majouk
  • 2. Scheduling Policies ■ FIFO (first in, first out) ■ Round robin ■ SJF (shortest job first) ■ Priority Scheduling ■ Lottery scheduling ■ This is obviously an incomplete list * 2
  • 3. FIFO FIFO is an acronym for First In, First Out, a method for organizing and manipulating a data buffer, or data stack, where the oldest entry, or 'bottom' of the stack, is processed first. It is analogous to processing a queue with first-come, first-served (FCFS) behavior: where the people leave the queue in the order in which they arrive. * 3
  • 4. FIFO ■ FIFO: assigns the CPU based on the order of requests ❑ Nonpreemptive: A process keeps running on a CPU until it is blocked or terminated ❑ Also known as FCFS (first come, first serve) + Simple - Short jobs can get stuck behind long jobs * 4
  • 5. FIFO ■ Suppose we have three jobs of equal length A B Time C turnaround time of A turnaround time of B turnaround time of C FIFO * 5
  • 6. Round Robin ■ Round Robin (RR) periodically releases the CPU from long-running jobs ❑ Based on timer interrupts so short jobs can get a fair share of CPU time ❑ Preemptive : a process can be forced to leave its running state and replaced by another running process ❑ Time slice: interval between timer interrupts * 6
  • 7. Round Robin (Cont.) ■ If time slice is too long ❑ Scheduling degrades to FIFO ■ If time slice is too short ❑ Throughput suffers ❑ Context switching cost dominates * 7
  • 8. FIFO vs. Round Robin ■ Suppose we have three jobs of equal length A B C A B C Ti m e A B C turnaround time of A turnaround time of B turnaround time of C Round Robin A B Time C turnaround time of A turnaround time of B turnaround time of C FIFO * 8
  • 9. FIFO vs. Round Robin ■ Round Robin + Shorter response time + Fair sharing of CPU - Not all jobs are preemptable - Not good for jobs of the same length (longer turnaround time) - More precisely, not good in terms of the turnaround time, because the turnaround of job A (last graph for example) in Robin Round state is longer than turnaround time of the same job in FIFO state. * 9 Modified by: Ahmad S. Al-Majouk
  • 10. * Instructor: Ahmad S. Al-Majouk 10 Shortest Job First (SJF) ⮚ Other name of this algorithm is Shortest-Process-Next (SPN). Also known as STCF (shortest time to completion first). ⮚ Like FCFS, SJF is non preemptive discipline in which waiting job (or process) with the smallest estimated run-time-to-completion is run next. In other words, when CPU is available, it is assigned to the process that has smallest next CPU burst. ⮚ The SJF scheduling is especially appropriate for batch jobs for which the run times are known in advance. ⮚ The SJF algorithm favors short jobs (or process) at the expense of longer ones. ⮚ The obvious problem with SJF scheme is that it requires precise knowledge of how long a job or process will run, and this information is not usually available. ⮚ The best SJF algorithm can do is to rely on user estimates of run times.
  • 11. SJF Illustrated A B Time C turnaround time of A turnaround time of B turnaround time of C Shortest Job First response time of A = 0 response time of B response time of C wait time of A = 0 wait time of B wait time of C * 11
  • 12. Priority Scheduling (Multilevel Queues) ■ Priority scheduling: The process with the highest priority runs first ■ Priority 0: ■ Priority 1: ■ Priority 2: ■ Assume that low numbers represent high priority A B C A B Ti m e C Priority Scheduling * 12
  • 13. Multilevel Feedback Queues • Multilevel feedback queues use multiple queues with different priorities – Round robin at each priority level – Run highest priority jobs first – Once those finish, run next highest priority, etc – Jobs start in the highest priority queue – If time slice expires, drop the job by one level – If time slice does not expire, push the job up by one level * 13 Instructor: Ahmad S. Al-Majouk
  • 14. Lottery Scheduling ■ Lottery scheduling is an adaptive scheduling approach to address the fairness problem ❑ Each process owns some tickets ❑ On each time slice, a ticket is randomly picked ❑ On average, the allocated CPU time is proportional to the number of tickets given to each job * 14
  • 15. Lottery Scheduling (Cont.) ■ To approximate SJF, short jobs get more tickets ■ To avoid starvation, each job gets at least one ticket * 15
  • 16. Lottery Scheduling Example • short jobs: 10 tickets each • long jobs: 1 ticket each # short jobs/# long jobs % of CPU for each short job % of CPU for each long job 1/1 91% 9% 0/2 0% 50% 2/0 50% 0% 10/1 10% 1% 1/10 50% 5% * 16 Instructor: Ahmad S. AL-Majouk