












Étudies grâce aux nombreuses ressources disponibles sur Docsity
Gagnz des points en aidant d'autres étudiants ou achete-les avec un plan Premium
Cette page n'est pas visible dans l'aperçu
Ne manques pas les parties importantes!













First-Come First-Served Shortest Job First Shortest Response Time First Predicting Burst Length Round Robin Static vs Dynamic Priority
Consider the average waiting time under different arrival orders , , : Waiting time , , Average waiting time: , , : Waiting time , , Average waiting time: Arriving in reverse order is three times as good! The first case is poor due to the convoy effect : later processes are held up behind a long-running first process FCFS is simple but not terribly robust to different arrival processes
Intuition from FCFS leads us to shortest job first (SJF) scheduling Associate with each process the length of its next CPU burst Use these lengths to schedule the process with the shortest time Use, e.g., FCFS to break ties
Simply a preemptive version of SJF: preempt the running process if a new process arrives with a CPU burst length less than the remaining time of the current executing process
As before: Process Arrival Time Burst Time Waiting time for , , , Average waiting time:
For both SJF and SRTF require the next "burst length" for each process means we must estimate it Can be done by using the length of previous CPU bursts, using exponential averaging:
If we expand the formula we get: where is some constant Choose value of according to our belief about the system, e.g., if we believe history irrelevant, choose and then get In general an exponential averaging scheme is a good predictor if the variance is small Since both and are less than or equal to one, each successive term has less weight than its predecessor NB. Need some consideration of load, else get (counter-intuitively) increased priorities when increased load
Round robin has some nice properties: Fair: given n processes in the ready queue and time quantum q, each process gets of the CPU Live: no process waits more than time units before receiving a CPU allocation Typically get higher average turnaround time than SRTF, but better average response time But tricky to choose the correct size quantum, : too large becomes FCFS/FIFO too small becomes context switch overhead too high
Associate an (integer) priority with each process, e.g., Prio Process type 0 system internal processes 1 interactive processes (staff) 2 interactive processes (students) 3 batch processes Simplest form might be just system vs user tasks
What do with ties? Round robin with time-slicing, allocating quantum to each process in turn Problem: biases towards CPU intensive jobs (Why?) Solution? Per-process quantum based on usage? Just ignore the problem?
Urban legend about IBM 7074 at MIT: when shut down in 1973 , low-priority processes were found which had been submitted in 1967 and had not yet been run... This is the biggest problem with static priority systems: a low priority process is not guaranteed to run — ever!
First used in Dijkstra's THE Timeslots: In each time slot , measure the CPU usage of process Priority for process in slot : E.g., Penalises CPU bound but supports IO bound Once considered impractical but now such computation considered acceptable
3 SUMMARY First-Come First-Served Shortest Job First Shortest Response Time First Predicting Burst Length Round Robin Static vs Dynamic Priority