SlideShare a Scribd company logo
1 of 22
 First-come First-served (FCFS) (FIFO)
 Jobs are scheduled in order of arrival
 Non-preemptive
 Problem:
 Average waiting time depends on arrival order
 Advantage: really simple!
time
P1 P2 P3
0 16 20 24
P1P2 P3
0 4 8 24
 A CPU bound job will hold CPU until done,
 or it causes an I/O burst
 rare occurrence, since the thread is CPU-bound
⇒ long periods where no I/O requests issued, and CPU held
 Result: poor I/O device utilization
 Example: one CPU bound job, many I/O bound
 CPU bound runs (I/O devices idle)
 CPU bound blocks
 I/O bound job(s) run, quickly block on I/O
 CPU bound runs again
 I/O completes
 CPU bound still runs while I/O devices idle (continues…)
 Simple hack: run process whose I/O completed?
 What is a potential problem?
 Last-In First-out (LIFO)
 Newly arrived jobs are placed at head of ready queue
 Improves response time for newly created threads
 Problem:
 May lead to starvation – early processes may never get CPU
 You work as a short-order cook
 Customers come in and specify which dish they want
 Each dish takes a different amount of time to prepare
 Your goal:
 minimize average time the customers wait for their food
 What strategy would you use ?
 Note: most restaurants use FCFS.
 Shortest Job First (SJF)
 Choose the job with the shortest next CPU burst
 Provably optimal for minimizing average waiting time
 Problem:
 Impossible to know the length of the next CPU burst
P1 P2P3
0 15 21 24
P1P2 P3
0 3 9 24
P2 P3
 SJF can be either preemptive or non-preemptive
 New, short job arrives; current process has long time to execute
 Preemptive SJF is called shortest remaining time first
P1
P2
P3
0 6 2110
P1P3 P1
P2
0 6 2410 13
• Approximate next CPU-burst duration
– from the durations of the previous bursts
• The past can be a good predictor of the future
• No need to remember entire past history
• Use exponential average:
 tnduration of the nth
CPU burst
 τn+1 predicted duration of the (n+1)st
CPU
burst
 τn+1 = α tn + (1- α) τn
 where 0 ≤ α ≤ 1
Shortest Job First Prediction
 Priority Scheduling
 Choose next job based on priority
 For SJF, priority = expected CPU burst
 Can be either preemptive or non-preemptive
 Problem:
 Starvation: jobs can wait indefinitely
 Solution to starvation
 Age processes: increase priority as a function of waiting time
 Round Robin (RR)
 Often used for timesharing
 Ready queue is treated as a circular queue (FIFO)
 Each process is given a time slice called a quantum
 It is run for the quantum or until it blocks
 RR allocates the CPU uniformly (fairly) across participants.
 If average queue length is n, each participant gets 1/n
Process Burst Time
P1 53
P2 17
P3 68
P4 24
 The Gantt chart is:
 Higher average turnaround than SJF,
 But better response time
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3
0 20 37 57 77 97 117 121 134 154 162
 Performance depends on length of the timeslice
 Context switching isn’t a free operation.
 If timeslice time is set too high
 attempting to amortize context switch cost, you get FCFS.
 i.e. processes will finish or block before their slice is up anyway
 If it’s set too low
 you’re spending all of your time context switching between threads.
 Timeslice frequently set to ~100 milliseconds
 Context switches typically cost < 1 millisecond
Moral:
Context switch is usually negligible (< 1% per timeslice)
unless you context switch too frequently and lose all
productivity
 Multi-level Queue Scheduling
 Implement multiple ready queues based on job “type”
 interactive processes
 CPU-bound processes
 batch jobs
 system processes
 student programs
 Different queues may be scheduled using different algos
 Intra-queue CPU allocation is either strict or proportional
 Problem: Classifying jobs into queues is difficult
 A process may have CPU-bound phases as well as interactive ones
System Processes
Interactive Processes
Batch Processes
Student Processes
Lowest priority
Highest priority
 Multi-level Feedback Queues
 Implement multiple ready queues
 Different queues may be scheduled using different algorithms
 Just like multilevel queue scheduling, but assignments are not static
 Jobs move from queue to queue based on feedback
 Feedback = The behavior of the job,
 e.g. does it require the full quantum for computation, or
 does it perform frequent I/O ?
 Very general algorithm
 Need to select parameters for:
 Number of queues
 Scheduling algorithm within each queue
 When to upgrade and downgrade a job
Quantum = 2
Quantum = 4
Quantum = 8
FCFS
Lowest priority
Highest priority
low
high
high
priority
timeslice
I/O bound jobs
CPU bound jobs
Since all threads share code & data segments
 Option 1: Ignore this fact
 Option 2: Gang scheduling
 run all threads belonging to a process together (multiprocessor only)
 if a thread needs to synchronize with another thread
 the other one is available and active
 Option 3: Two-level scheduling:
 Medium level scheduler
 schedule processes, and within each process, schedule threads
 reduce context switching overhead and improve cache hit ratio
 Option 4: Space-based affinity:
 assign threads to processors (multiprocessor only)
 improve cache hit ratio, but can bite under low-load condition
 Real-time processes have timing constraints
 Expressed as deadlines or rate requirements
 Common RT scheduling policies
 Rate monotonic
 Just one scalar priority related to the periodicity of the job
 Priority = 1/rate
 Static
 Earliest deadline first (EDF)
 Dynamic but more complex
 Priority = deadline
 Both require admission control to provide guarantees
 The best schemes are adaptive.
 To do absolutely best we’d have to predict the future.
 Most current algorithms give highest priority to those that need
the least!
 Scheduling become increasingly ad hoc over the years.
 1960s papers very math heavy, now mostly “tweak and see”
 What are metrics that schedulers should optimize for ?
 There are many, the right choice depends on the context
 Suppose:
 You own an airline, have one expensive plane, and passengers
waiting all around the globe
 You own a sweatshop, and need to evaluate workers
 You are at a restaurant, and are waiting for food
 You are an efficiency expert, and are evaluating government
procedures at the DMV
 You are trying to find a project partner or a co-author
 You own a software company that would like to deliver a
product by a deadline

More Related Content

What's hot

Os examples scheduling
Os examples schedulingOs examples scheduling
Os examples scheduling
Dana dia
 
Multiprocessor scheduling 2
Multiprocessor scheduling 2Multiprocessor scheduling 2
Multiprocessor scheduling 2
mrbourne
 
Mobicents Media Server theory, practice, cloud considerations, design discuss...
Mobicents Media Server theory, practice, cloud considerations, design discuss...Mobicents Media Server theory, practice, cloud considerations, design discuss...
Mobicents Media Server theory, practice, cloud considerations, design discuss...
telestax
 

What's hot (19)

5 Sol
5 Sol5 Sol
5 Sol
 
Real time Scheduling in Operating System for Msc CS
Real time Scheduling in Operating System for Msc CSReal time Scheduling in Operating System for Msc CS
Real time Scheduling in Operating System for Msc CS
 
Comparative analysis of the essential CPU scheduling algorithms
Comparative analysis of the essential CPU scheduling algorithmsComparative analysis of the essential CPU scheduling algorithms
Comparative analysis of the essential CPU scheduling algorithms
 
Cpu scheduling qusetions
Cpu scheduling qusetionsCpu scheduling qusetions
Cpu scheduling qusetions
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
 
Lecture1
Lecture1Lecture1
Lecture1
 
Fault tolerance review by tsegabrehan zerihun
Fault tolerance review by tsegabrehan zerihunFault tolerance review by tsegabrehan zerihun
Fault tolerance review by tsegabrehan zerihun
 
RTOS
RTOSRTOS
RTOS
 
Consistency protocols
Consistency protocolsConsistency protocols
Consistency protocols
 
Client Centric Consistency Model
Client Centric Consistency ModelClient Centric Consistency Model
Client Centric Consistency Model
 
Multi processor scheduling
Multi  processor schedulingMulti  processor scheduling
Multi processor scheduling
 
Ways to reduce misses
Ways to reduce missesWays to reduce misses
Ways to reduce misses
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
OS_Ch4
OS_Ch4OS_Ch4
OS_Ch4
 
Os examples scheduling
Os examples schedulingOs examples scheduling
Os examples scheduling
 
FreeRTOS
FreeRTOSFreeRTOS
FreeRTOS
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
 
Multiprocessor scheduling 2
Multiprocessor scheduling 2Multiprocessor scheduling 2
Multiprocessor scheduling 2
 
Mobicents Media Server theory, practice, cloud considerations, design discuss...
Mobicents Media Server theory, practice, cloud considerations, design discuss...Mobicents Media Server theory, practice, cloud considerations, design discuss...
Mobicents Media Server theory, practice, cloud considerations, design discuss...
 

Viewers also liked (7)

Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
 
Round Robin Scheduling Algorithm (Simulation)
Round Robin Scheduling Algorithm (Simulation)Round Robin Scheduling Algorithm (Simulation)
Round Robin Scheduling Algorithm (Simulation)
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Project Planning
Project PlanningProject Planning
Project Planning
 
Project planning and control
Project planning and controlProject planning and control
Project planning and control
 
Project Management Concepts (from PMBOK 5th Ed)
Project Management Concepts (from PMBOK 5th Ed)Project Management Concepts (from PMBOK 5th Ed)
Project Management Concepts (from PMBOK 5th Ed)
 
Project planning and project work plan
Project planning and project work planProject planning and project work plan
Project planning and project work plan
 

Similar to Sceduling

Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
pri534
 
Process management in os
Process management in osProcess management in os
Process management in os
Miong Lazaro
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
tech2click
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
Nagarajan
 

Similar to Sceduling (20)

Scheduling algo(by HJ)
Scheduling algo(by HJ)Scheduling algo(by HJ)
Scheduling algo(by HJ)
 
Csc4320 chapter 5 2
Csc4320 chapter 5 2Csc4320 chapter 5 2
Csc4320 chapter 5 2
 
Os..
Os..Os..
Os..
 
Scheduling algorithms
Scheduling algorithmsScheduling algorithms
Scheduling algorithms
 
Process management in os
Process management in osProcess management in os
Process management in os
 
Operating system
Operating systemOperating system
Operating system
 
Operating System 5
Operating System 5Operating System 5
Operating System 5
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
CPU scheduling
CPU schedulingCPU scheduling
CPU scheduling
 
chapter 5 CPU scheduling.ppt
chapter  5 CPU scheduling.pptchapter  5 CPU scheduling.ppt
chapter 5 CPU scheduling.ppt
 
May14ProcessScheduling.ppt
May14ProcessScheduling.pptMay14ProcessScheduling.ppt
May14ProcessScheduling.ppt
 
pscheduling.ppt
pscheduling.pptpscheduling.ppt
pscheduling.ppt
 
Process Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdfProcess Scheduling Algorithms.pdf
Process Scheduling Algorithms.pdf
 
LM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processesLM10,11,12 - CPU SCHEDULING algorithms and its processes
LM10,11,12 - CPU SCHEDULING algorithms and its processes
 
Cp usched 2
Cp usched  2Cp usched  2
Cp usched 2
 
Scheduling algorithm (chammu)
Scheduling algorithm (chammu)Scheduling algorithm (chammu)
Scheduling algorithm (chammu)
 
Cpu scheduling
Cpu schedulingCpu scheduling
Cpu scheduling
 
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 Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 

More from Ramasubbu .P (20)

radar
radarradar
radar
 
Press
PressPress
Press
 
Milling 2
Milling 2Milling 2
Milling 2
 
MIlling 1
MIlling 1MIlling 1
MIlling 1
 
Drillings
DrillingsDrillings
Drillings
 
Holding
HoldingHolding
Holding
 
Saftey
SafteySaftey
Saftey
 
Harvesting
HarvestingHarvesting
Harvesting
 
Plough
PloughPlough
Plough
 
Tractor PTO
Tractor PTOTractor PTO
Tractor PTO
 
Tractor Components
Tractor ComponentsTractor Components
Tractor Components
 
MSAT
MSATMSAT
MSAT
 
GPS
GPSGPS
GPS
 
RTOS
RTOSRTOS
RTOS
 
Virus
VirusVirus
Virus
 
Hacker
HackerHacker
Hacker
 
Denail of Service
Denail of ServiceDenail of Service
Denail of Service
 
RAID CONCEPT
RAID CONCEPTRAID CONCEPT
RAID CONCEPT
 
Network Security
Network SecurityNetwork Security
Network Security
 
Timer
TimerTimer
Timer
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Sceduling

  • 1.
  • 2.  First-come First-served (FCFS) (FIFO)  Jobs are scheduled in order of arrival  Non-preemptive  Problem:  Average waiting time depends on arrival order  Advantage: really simple! time P1 P2 P3 0 16 20 24 P1P2 P3 0 4 8 24
  • 3.  A CPU bound job will hold CPU until done,  or it causes an I/O burst  rare occurrence, since the thread is CPU-bound ⇒ long periods where no I/O requests issued, and CPU held  Result: poor I/O device utilization  Example: one CPU bound job, many I/O bound  CPU bound runs (I/O devices idle)  CPU bound blocks  I/O bound job(s) run, quickly block on I/O  CPU bound runs again  I/O completes  CPU bound still runs while I/O devices idle (continues…)  Simple hack: run process whose I/O completed?  What is a potential problem?
  • 4.  Last-In First-out (LIFO)  Newly arrived jobs are placed at head of ready queue  Improves response time for newly created threads  Problem:  May lead to starvation – early processes may never get CPU
  • 5.  You work as a short-order cook  Customers come in and specify which dish they want  Each dish takes a different amount of time to prepare  Your goal:  minimize average time the customers wait for their food  What strategy would you use ?  Note: most restaurants use FCFS.
  • 6.  Shortest Job First (SJF)  Choose the job with the shortest next CPU burst  Provably optimal for minimizing average waiting time  Problem:  Impossible to know the length of the next CPU burst P1 P2P3 0 15 21 24 P1P2 P3 0 3 9 24 P2 P3
  • 7.  SJF can be either preemptive or non-preemptive  New, short job arrives; current process has long time to execute  Preemptive SJF is called shortest remaining time first P1 P2 P3 0 6 2110 P1P3 P1 P2 0 6 2410 13
  • 8. • Approximate next CPU-burst duration – from the durations of the previous bursts • The past can be a good predictor of the future • No need to remember entire past history • Use exponential average:  tnduration of the nth CPU burst  τn+1 predicted duration of the (n+1)st CPU burst  τn+1 = α tn + (1- α) τn  where 0 ≤ α ≤ 1 Shortest Job First Prediction
  • 9.  Priority Scheduling  Choose next job based on priority  For SJF, priority = expected CPU burst  Can be either preemptive or non-preemptive  Problem:  Starvation: jobs can wait indefinitely  Solution to starvation  Age processes: increase priority as a function of waiting time
  • 10.  Round Robin (RR)  Often used for timesharing  Ready queue is treated as a circular queue (FIFO)  Each process is given a time slice called a quantum  It is run for the quantum or until it blocks  RR allocates the CPU uniformly (fairly) across participants.  If average queue length is n, each participant gets 1/n
  • 11. Process Burst Time P1 53 P2 17 P3 68 P4 24  The Gantt chart is:  Higher average turnaround than SJF,  But better response time P1 P2 P3 P4 P1 P3 P4 P1 P3 P3 0 20 37 57 77 97 117 121 134 154 162
  • 12.
  • 13.  Performance depends on length of the timeslice  Context switching isn’t a free operation.  If timeslice time is set too high  attempting to amortize context switch cost, you get FCFS.  i.e. processes will finish or block before their slice is up anyway  If it’s set too low  you’re spending all of your time context switching between threads.  Timeslice frequently set to ~100 milliseconds  Context switches typically cost < 1 millisecond Moral: Context switch is usually negligible (< 1% per timeslice) unless you context switch too frequently and lose all productivity
  • 14.  Multi-level Queue Scheduling  Implement multiple ready queues based on job “type”  interactive processes  CPU-bound processes  batch jobs  system processes  student programs  Different queues may be scheduled using different algos  Intra-queue CPU allocation is either strict or proportional  Problem: Classifying jobs into queues is difficult  A process may have CPU-bound phases as well as interactive ones
  • 15. System Processes Interactive Processes Batch Processes Student Processes Lowest priority Highest priority
  • 16.  Multi-level Feedback Queues  Implement multiple ready queues  Different queues may be scheduled using different algorithms  Just like multilevel queue scheduling, but assignments are not static  Jobs move from queue to queue based on feedback  Feedback = The behavior of the job,  e.g. does it require the full quantum for computation, or  does it perform frequent I/O ?  Very general algorithm  Need to select parameters for:  Number of queues  Scheduling algorithm within each queue  When to upgrade and downgrade a job
  • 17. Quantum = 2 Quantum = 4 Quantum = 8 FCFS Lowest priority Highest priority
  • 19. Since all threads share code & data segments  Option 1: Ignore this fact  Option 2: Gang scheduling  run all threads belonging to a process together (multiprocessor only)  if a thread needs to synchronize with another thread  the other one is available and active  Option 3: Two-level scheduling:  Medium level scheduler  schedule processes, and within each process, schedule threads  reduce context switching overhead and improve cache hit ratio  Option 4: Space-based affinity:  assign threads to processors (multiprocessor only)  improve cache hit ratio, but can bite under low-load condition
  • 20.  Real-time processes have timing constraints  Expressed as deadlines or rate requirements  Common RT scheduling policies  Rate monotonic  Just one scalar priority related to the periodicity of the job  Priority = 1/rate  Static  Earliest deadline first (EDF)  Dynamic but more complex  Priority = deadline  Both require admission control to provide guarantees
  • 21.  The best schemes are adaptive.  To do absolutely best we’d have to predict the future.  Most current algorithms give highest priority to those that need the least!  Scheduling become increasingly ad hoc over the years.  1960s papers very math heavy, now mostly “tweak and see”
  • 22.  What are metrics that schedulers should optimize for ?  There are many, the right choice depends on the context  Suppose:  You own an airline, have one expensive plane, and passengers waiting all around the globe  You own a sweatshop, and need to evaluate workers  You are at a restaurant, and are waiting for food  You are an efficiency expert, and are evaluating government procedures at the DMV  You are trying to find a project partner or a co-author  You own a software company that would like to deliver a product by a deadline