Scheduling Flashcards
What metrics do we consider for scheduling policies?
Turnaround time = time of completion - time of arrival
Fairness
Response time = time first run - time of arrival
When might FIFO scheduling pose problems?
If job lengths are not all equal length, then we may have a very poor average turnaround time if a lengthy job arrives before some short jobs. This is the convoy effect.
When is shortest job first optimal?
If all the jobs arrive at exactly the same time, then shortest job first has the best turnaround.
True or false, shortest job first is a pre-emptive scheduler?
False, it does not interrupt jobs once they have started.
True or false, shortest time to completion is a pre-emptive scheduler?
True, jobs can be interrupted if there exists another job with a shorter completion time.
True or false, SJF scheduler has good performance for response time?
False, as it only switches between jobs when one completes.
When might response time be important for a scheduler?
If there is lots of user interaction, such as keyboard activity.
What is Round Robin scheduling?
In RR, instead of running jobs to completion, we run jobs for a time slice, before switching to the next job in the queue.
What must we make sure that the time slice is a multiple of, in Round Robin scheduling?
The time slice should be a multiple of the timer interrupt period.
True or false, Round Robin scheduling has good performance for turnaround time?
False, it has very poor performance.
What problems does a multi-level feedback queue attempt to solve?
Optimising turnaround time when we aren’t sure how long jobs will last, and being responsive and interactive to users.
What are the rules of the Multi-Level Feedback Queue?
1) Tasks on higher level priority queues should run.
2) If Tasks have the same priority, they run in Round Robin.
3) When a job is introduced, it starts at highest priority.
4a) When a job uses up an entire time slice while running, its priority is reduced.
4b) If a job gives up the CPU before the time slice is up, its priority stays the same.
4c) Once a job has used up its time at a given priority level, regardless of how many times it has given up the CPU, its priority is reduced.
5) After some time period, all jobs are moved to the highest priority queue.
Why might you want to vary the time slice length for different queues on the MLFQ?
So that the time slice is short for high priority jobs, and long for low priority jobs.
What is lottery scheduling?
We hold lotteries to see which process should run. Processes each hold a certain number of tickets, and if their ticket is chosen, then they run. For example, if A holds 75 tickets, and B holds 25 tickets, we would expect A to run 75% of the time. Tickets are chosen randomly.
When is the lottery scheduler fairest? What is difficult to decide in lottery scheduling?
When the length of each job is longer, it is fairer. It is hard to decide how many tickets each process should be given.