Lec07_notes - CMPSCI 377 Operating Systems Fall 2008...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CMPSCI 377 Operating Systems Fall 2008 Lecture 7: February 9 Lecturer: Prashant Shenoy Scribe: Vimal Mathew & Tim Wood 7.1 Lottery Scheduling Lottery Scheduling is a probabilistic scheduling algorithm for processes in an operating system. Processes are each assigned some number of lottery tickets, and the scheduler draws a random ticket to select the next process. The distribution of tickets need not be uniform; granting a process more tickets provides it a relative higher chance of selection. This technique can be used to approximate other scheduling algorithms, such as Shortest job next and Fair-share scheduling. Allocating more tickets to a process gives it a higher priority since it has a greater chance of being scheduled at each scheduling decision. Lottery scheduling solves the problem of starvation. Giving each process at least one lottery ticket guarantees that it has a non-zero probability of being selected at each scheduling operation. On average, CPU time is proportional to the number of tickets given to each job. For approximating SJF, most tickets are assigned to short running jobs and fewer to longer runnning jobs. To avoid starvation, every job gets at least one ticket. 7.2 Synchronization As we already know, threads must ensure consistency; otherwise, race conditions (non-deterministic results) might happen. Now consider the “too much milk problem”: two people share the same fridge and must guarantee that there’s always milk, but not too much milk. If the two people do not coordinate, it is possible that both will go to buy milk at once and have too much milk. How can they solve this? First, we consider some importantgo to buy milk at once and have too much milk....
View Full Document

This note was uploaded on 09/30/2010 for the course CS 377 taught by Professor Corner during the Fall '08 term at UMass (Amherst).

Page1 / 4

Lec07_notes - CMPSCI 377 Operating Systems Fall 2008...

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