lecture07

lecture07 - CS140 - Winter 2008 - Handout #7 Today's big...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Mendel Rosenblum CS 140: Operating Systems Lecture 7: Adv. Scheduling Today’s big adventure ± Multi-level feedback in the real world Unix ± Lottery scheduling: Clever use of randomness to get simplicity ± Retro-perspectives on scheduling ± Reading: 6 th Ed. Chapter 6 7 th Ed. Chapter 5 The past ± FIFO: run in arrival order, until exit or block + simple - short jobs can get stuck behind long ones; poor I/O ± RR: run in cycle, until exit, block or time slice expires + better for short jobs - poor when jobs are the same length ± STCF: run shortest jobs first + optimal (ave. response time, ave. time-to-completion) - hard to predict the future. Unfair. add run run add Understanding scheduling ± You add the nth process to system when will it run at ~1/n of speed of CPU? < 1/n? > 1/n? ± Scheduling in real world Where RR used? FIFO? SJF? Hybrids? Why so much FIFO? When priorities? Time Slicing? What’s common cswitch overhead? Real world scheduling not covered by RR, FIFO, STCF? n Multi-level Unix (SysV, BSD) Priorities go from 0. .127 (0 = highest priority) 32 run queues, 4 priority levels each Run highest priority job always (even if just ran) Favor jobs that haven’t run recently 0..3 4..7 8..11 .... 124. .127 Multi-level in real world: Unix SVR3 ± Keep history of recent CPU usage for each process Give highest priority to process that has used the least CPU time “recently” ± Every process has two fields: p_cpu field to track usage usr_pri field to track priority ± Every clock tick increment current job’s p_cpu by 1 ± Every second recompute every job’s priority and usage p_cpu = p_cpu / 2 (escape tyranny of past!) p_priority = p_cpu / 4 + PUSER + 2 * nice
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/24/2008 for the course CS 140 taught by Professor Rosenblum during the Winter '08 term at Stanford.

Page1 / 3

lecture07 - CS140 - Winter 2008 - Handout #7 Today's big...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online