Download Operating system, Scheduling Criteria and Scheduling Algorithms and more Lab Reports Operating Systems in PDF only on Docsity!
Operating Systems
Session 5:
(^) Processor scheduling
Operating Systems
Introduction
(^) Processor scheduling policy
(^) Decides which process runs at given time
(^) Different schedulers will have different
goals
(^) Maximize throughput
(^) Minimize latency
(^) Prevent indefinite postponement
(^) Complete process by given deadline
(^) Maximize processor utilization
Process Lifecycle
Scheduling Criteria
(^) Consider run-time behavior of process
(^) Compute vs. I/O wait
(^) Process categories:
(^) Processor-bound
(^) Uses all available processor time
(^) I/O-bound
(^) Generates an I/O request quickly & relinquishes processor
(^) Batch processes
(^) no user interaction
(^) Interactive processes
(^) frequent user interaction
Histogram of CPU-burst
Times
Preemptive vs. Nonpreemptive
Scheduling
(^) Preemptive processes
(^) Can be removed from their current processor
(^) Can lead to improved response times
(^) Important for interactive environments
(^) Preempted processes remain in memory
(^) Nonpreemptive processes
(^) Run until completion or until they yield control
of a processor
(^) Unimportant processes can block important
ones indefinitely
Scheduling Objectives
(^) Different objectives depending on system
(^) Maximize throughput
(^) Maximize number of interactive processes receiving acceptable response times
(^) Maximize resource utilization
(^) Avoid indefinite postponement
(^) Enforce priorities
(^) Minimize overhead
(^) Ensure predictability
Scheduling Objectives
Summary
(^) Several goals common to most schedulers - (^) Fairness - (^) Predictability - (^) Scalability
(^) Simplest scheme
(^) Processes dispatched according to arrival time
(^) Non-preemptive
(^) Rarely used as primary scheduling algorithm
First-In-First-Out
Scheduling
Round-Robin Scheduling
(^) Based on FIFO
(^) Processes run only for a limited time slice or quantum - (^) Must be preemptible - (^) Context switch overhead must be minimized
(^) Often used as part of more complex algorithms
Shortest-Process-First (SPF)
Scheduling
(^) process with smallest time to finish goes first - (^) Lower average wait time than FIFO - (^) Reduces the number of waiting processes - (^) Potentially large variance in wait times - (^) Non-preemptive - (^) Results in slow response times to new processes - (^) Relies on estimates of time-to-completion - (^) Can be inaccurate or falsified - (^) Unsuitable for use in modern interactive systems
(^) Improves upon SPF scheduling
(^) also considers priority
(^) Considers how long process has been waiting
(^) Prevents indefinite postponement
(^) Still non-preemptive Highest-Response-Ratio-Next (HRRN) Scheduling
waiting-time + service-
time service-time
priority =
Scheduling Realities
(^) Different processes have different needs - (^) Short I/O-bound interactive processes should generally run before processor- bound batch processes - (^) Behavior patterns not immediately obvious to the scheduler
Example: Selfish RR
Scheduling
(^) older process has priority
(^) 2 queues:
(^) Holding vs. Active
(^) process enters into holding queue
(^) Increases priority as process ages
(^) moves to active queue when it reaches priority of other processes in active queue