Lecture 6 - Scheduling Flashcards
Why do processes require scheduling?
Bursts of CPU usage alternate with I/O wait
Some processes CPU-bound, others I/O bound
Prevent one program blocking others from executing
What is the Job queue?
Set of all the processes in the system
What is the ready queue?
Set of all processes in memory, ready to execute
What are device queues?
Sets of processes waiting for an I/O device
What are the goals of scheduling for all systems?
Fairness: give each process a fair share of the CPU
Enforcement: ensure the stated policy is carried out
Balance: keep all parts of the system busy
What are the goals of scheduling for batch systems?
Throughput - maximise jobs per unit time
Turnaround time: minimize wait time for jobs
CPU Utilisation: keep CPU as busy as possible
What are the goals of scheduling for interactive systems?
Response time: respond quickly to user’s requests
Proportionality: meet user’s expectations
What are the goals of scheduling for real time systems?
Meet deadlines - missing deadlines is a system failure
Predictability - same type of behaviour for each time slice
What is the difference between long term, medium term and short term schedulers?
Long term - selects which processes should be brought into ready queue, invoked infrequently (seconds or minutes), slow, controls degree of multiprogramming
Medium term scheduler - swaps out processes temporarily, controls number of jobs in memory, balances load for better throughput
Short term - selects which process should execute next and allocates CPU, fast
What is the difference between cooperative and pre-emptive scheduling?
Co-Operative: process runs until it drops or blocks
Pre-emptive: process interrupted by OS and moved to ready state
In a thread-aware operating system what does the scheduler schedule?
What must it realize to do this efficiently?
Threads - processes are just containers for threads
Context switch for threads from different processes is more expensive
Rescheduling threads onto a different CPU is more expensive - CPU cache might be taken by another thread’s cache
When does a scheduler make decisions?
When the current process changes state from running
Can be due to interrupt by timer
How does First Come First Served scheduling work?
Whats the problem with it?
Do jobs in the order they arrive
Very simple algorithm
BUT Some processes might have to wait if a very long job is busy executing
How does shortest job first scheduling work? How is it different to Shortest Time Remaining?
Do the shortest job first.
Shortest time remaining is a preemptive form, i.e. after interrupt check which shortest remaining job is
What is the problem with shortest job first scheduling?
How does the scheduler know how long a job has left?