CS 321 Spring 2013  >  Lecture Notes for Wednesday, February 20, 2013

# CS 321 Spring 2013 Lecture Notes for Wednesday, February 20, 2013

## Scheduling Methods

Actual scheduling algorithms are endlessly tweaked. Here are some of the major ideas used. An important idea is the quantum: the maximum amount of time a process is allowed to run before it is preempted. Making this too short leads to too much time spent doing context switches. Making it too long leads to poor response times. Note that a process can run for less time, if it blocks or terminates (or, in some systems, if it voluntarily relinquishes the processor).

• Batch
• First Come First Served. Non-preemptive. Queue of processes.
• Shortest Job First. Non-preemptive. Need info in advance.
• Shortest Time Remaining Next. Preemptive. Need info in advance, or can make estimates.
• Interactive
• Round-Robin. Arrange processes in circle; move to next when quantum ends or process blocks or terminates.
• Priority. Run the ready process with highest priority. Leads to priority inversion problems. Improvement: higher priority gets longer time.
• Lottery. Get tickets based on priority. Randomly choose a ticket. Processes can trade tickets.
• Round-robin with adjustable number of quanta.
• Fair share: each user gets a fraction of the processor, divide this up among the user’s processes.

Real-time scheduling is much simpler, but much less versatile. It makes strong guarantees; sometimes this is impossible. A set of processes and guarantees is schedulable is the processes can be scheduled in such a way that the guarantees are met.

CS 321 Spring 2013: Lecture Notes for Wednesday, February 20, 2013 / Updated: 6 May 2013 / Glenn G. Chappell / ggchappell@alaska.edu