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

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
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
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
 
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
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
"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
 
Ransomware Mallox [EN].pdf
Ransomware         Mallox       [EN].pdfRansomware         Mallox       [EN].pdf
Ransomware Mallox [EN].pdf
Overkill Security
 
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
 
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
 
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
 

Recently uploaded (20)

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
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
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...
 
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
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
"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
 
Ransomware Mallox [EN].pdf
Ransomware         Mallox       [EN].pdfRansomware         Mallox       [EN].pdf
Ransomware Mallox [EN].pdf
 
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...
 
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
 
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...
 

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