week 3 Flashcards
scheduler
decides which job to allocate the CPU to
must make efficient use of the CPU because process switching is expensive
events to switch between processes
switch from user mode to kernel mode
state of current process saved
store registers in the process table
process selected by running scheduling algorithm
MMU reloaded with memory map of new process
start new process
behaviours of different processes
i/o bound processes have short bursts, frequent i/o waits
cpu bound processes have long bursts , infrequent i/o waits
two types of scheduling algorithms
pre-emptive - picks a process and lets it run for some quantum (amount of time)
non pre-emptive - picks a process and runs it until it blocks or voluntarily releases the CPU
three environments for scheduling algorithms
- batch - non pre-emptive or pre-emptive
- interactive - pre-emptive
- real time - non pre-emptive
scheduling algorithm goals
all systems
fairness - give each process fair share of CPU
policy enforcement - stated policy is carried out
balance - keep all parts of the system busy
batch
throughput - maximise number of jobs per hour
turnaround time - minimise time between submission and termination
CPU utilisation - keep the CPU busy at all times
interactive
response time - respond to requests quickly
proportionality - meet user expectations
real time systems
meeting deadlines - avoid losing data
predictability - avoid quality degradation in multimedia systems
scheduling algorithms for batch systems
fcfs (first come, first served)
- non pre-emptive
- processes assigned CPU in order they request it
- queue formed, head of queue runs, new processes added to the end of the queue
PROS: simple to program
CONS: i/o bound processes take a long time and slow down compute bound processes
shortest job first
- non pre-emptive
- job with shortest execution time runs first
PROS:
CONS: only works when all jobs are available simultaneously
shortest remaining time next
- pre-emptive
- scheduler choses job with shortest remaining run time
CONS: runtime must be known
schdeuling algorithms for interactive systems
round robin
- each process runs for specific quantum
- long quantum: less context switching, poor response times to short requests
- short quantum: too much context switching, short jobs benefit
priority scheduling
- each process assigned a priority, process with highest priority runs for quantum
- scheduler to decrease priority at each clock tick to avoid high priority processes from running indefinitely
multiple queues
shortest process next