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 5tech2click
 
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
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2pri534
 
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

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Ransomware Mallox [EN].pdf
Ransomware         Mallox       [EN].pdfRansomware         Mallox       [EN].pdf
Ransomware Mallox [EN].pdf
Overkill Security
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
UiPath New York Community Day in-person event
UiPath New York Community Day in-person eventUiPath New York Community Day in-person event
UiPath New York Community Day in-person event
DianaGray10
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
QADay
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Ransomware Mallox [EN].pdf
Ransomware         Mallox       [EN].pdfRansomware         Mallox       [EN].pdf
Ransomware Mallox [EN].pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
UiPath New York Community Day in-person event
UiPath New York Community Day in-person eventUiPath New York Community Day in-person event
UiPath New York Community Day in-person event
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»НАДІЯ ФЕДЮШКО БАЦ  «Професійне зростання QA спеціаліста»
НАДІЯ ФЕДЮШКО БАЦ «Професійне зростання QA спеціаліста»
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

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