CSE 131 Lecture Notes - Lecture 10: Freebsd, Context Switch, Timeshare
Document Summary
Scheduler is based on multi-level feedback queues. Thread priority is set by pri = min+[estcpu/4] + 2xnice. Values above max are set to max. Nice is set by the user to manually lower thread priority. Estcpu is an estimate of the number of ready processes. Selects next runnable thread from the run queues. Uses bitmask to quickly find first non-empty queue. High level scheduler: runs a few times per second. Prioritize interactive processes: use calculated interactivity score. Kernel picks a process to run next. Run-time system (at user level) schedules threads. Run each thread for less than process quantum. Example schedule: a1, a2, a3, a1, b1, b3, b2, b3. Not possible: a1, a2, b1, b2, a3, b3, a2, b1. May be more difficult for each process to specify priorities. Producer empty. down() reserves one place in the buffer and only successful is empty is > 0.