Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPU Scheduling David Ferry CSCI 3500 – Operating Systems

Similar presentations


Presentation on theme: "CPU Scheduling David Ferry CSCI 3500 – Operating Systems"— Presentation transcript:

1 CPU Scheduling David Ferry CSCI 3500 – Operating Systems
Saint Louis University St. Louis, MO 63103

2 Recall Multiprogramming
CPU time is shared by rapidly switching between processes with context switching: Each time a context switch occurs the OS scheduler runs picks what process gets to run next. When picked, a process gets to run for one scheduling quantum, commonly 1ms. Process A Process B Process C CSCI Operating Systems

3 The Scheduling Question
Blocked Ready Scheduler swaps off Scheduled onto processor Running Given a collection of programs that are ready to run, how do we pick a winner? CSCI Operating Systems

4 Scheduling Considerations
Scheduling is an old field with a lot of alternatives. Some possible metrics: Resource fairness – ensure all processes get equal 1/N processor time. Perceived fairness – Perfect resource fairness might not yield desirable performance, so we prioritize some processes. CSCI Operating Systems

5 Scheduling Considerations
Response time – Minimize the amount of time it takes a program to respond to events such as key presses. Job completion – Maximize the number of processes retired from the system. No starvation – Make sure that all processes get to run eventually. CSCI Operating Systems

6 Implementation Considerations
The scheduler is perhaps the most performance-critical piece of code on the planet. Typically runs 1000 times per second on a desktop machine. If we have 30 computers in this classroom, that’s running at least 30,000 per second. The scheduler is entirely overhead- it only serves to manage the system, but is not an end in itself. CSCI Operating Systems

7 Two Program Archetypes
Compute-bound: Spends most of its time churning through instructions with the processor. Limited interaction between program and user, or program and other devices. E.g. simulation, video encoding, video decoding I/O Bound: Spends most of its time waiting for user or other device such as hard drive. Bursty workload behavior. E.g. text editor, web browser CSCI Operating Systems

8 CSCI 3500 - Operating Systems
Types of Systems Batch systems: Important that they run efficiently, but nobody is waiting Characterized by large computationally intensive workloads that take hours or days Tend to be compute-bound tasks Interactive systems: Must respond promptly to user input Heterogenous workloads: text editor, compiler, watch video, play a game, listen to music, maybe all simultaneously… Mixed I/O bound and compute-bound tasks CSCI Operating Systems

9 Batch Scheduling Algorithms
FIFO – first in, first out – executes programs in the order they are created in the system. Does not do multiprocessing. SJF – shortest job first – executes programs in order of shortest to longest. Does not do multiprocessing. Needs an estimate of process length, but this might be as simple as looking at program name. E.g. “ls” will probably always be quick. CSCI Operating Systems

10 Interactive Scheduling Algorithms
Round-Robin – Go through all processes in some arbitrary order, giving each a single quantum of processor time. CSCI Operating Systems


Download ppt "CPU Scheduling David Ferry CSCI 3500 – Operating Systems"

Similar presentations


Ads by Google