8.1 Scheduling Flashcards
Scheduling
An OS must allocate resources among competing processes
The resource provided by a processor is execution time
- The resource is allocated by means of a schedule
Aim of scheduling
To assign processes to be executed by the processor over time
- In a way that meets system objectives, such as response time, throughput and processor efficiency
Objectives of Scheduling
Share time fairly among processes Prevent starvation of a process Use the processor efficiently Have low overhead Prioritise processes when necessary
Long term scheduling
Determines which programs are admitted to the system for processing
-May be first come first served
-Or according to priority
Controls degree of multiprogramming
More processes, smaller percentage of time each process is executed
Medium term scheduling
Part of swapping function
Swapping in decisions are based on the need to manage the degree of multiprogramming
Short term scheduling
Known as the dispatcher Executes most frequently Invoked when an event occurs -Clock interrupts -I/O interrupts -OS calls -Signals
Aim of short term scheduling
To allocate processor time to optimise certain aspects of system behaviour.
A set of criteria is needed to evaluate the scheduling policy.
Short term scheduling criteria USER V SYSTEM
User oriented
-Response time
–Elapsed time between request submission until there is an output
System Oriented
-Effective and efficient utilisation of the processor
Short term scheduling criteria PERFORMANCE
Performance related - Quantitive, easily measured -EG Response time & throughput Non performance related -Qualitative -Hard to measure
FORMULAS
Turn around time = Finish Time - Arrival Time
Waiting Time = Start Time - Arrival Time
Throughput = Processes Number / Total Time
Priorities
Scheduler will always choose a process of higher priority over one of lower priority
Have multiple ready queues to represent each level of priority
Starvation
Problem
-Lower priority may suffer starvation if there is a steady supply of high priority processes
Solution
-Allow a process to change its priority based on its age or execution history
Selection Function
Determines which process is selected for execution
If based on execution characteristics then important quantities are
-W = time spent in system so far, Waiting
-E = time spent in Execution so far
-S = total Service time required by the process, including E
Decision Mode
Specifies the instants in time at which the selection function is exercised
Two categories
-Non-Preemptive
-Preemptive
Nonpreemptive vs Preemptive
Nonpreemptive
-Once a process is in the running state, it will continue until it terminates or blocks itself for I/O
Preemptive
-Currently running process may be interrupted and moved to ready state by the OS
-Preemption may occur when new process arrives, on an interrupt, or periodically