This preview shows page 1. Sign up to view the full content.
Unformatted text preview: WITCH # load the return address Context
Context Switches: Voluntary and Involuntary
On a uniprocessor, the set of possible execution schedules
depend on when context switches can occur.
• Voluntary: one thread explicitly yields the CPU to another.
E.g. a thread can suspend itself with Yield
It may also block to wait for some event with Sleep
• Involuntary: the system scheduler suspends an active thread
and switches control to a different thread.
Thread scheduler tries to share CPU fairly by timeslicing. General
General Thread Operations
allocate memory for stack, perform bookkeeping
associate entry-point (called function)
parent thread creates child threads
release memory (or recycle), perform bookkeeping
When a thread blocks or yields or is de-scheduled by the
system, which one is picked to run next?
Preemptive scheduling: preempt a running thread
Non-preemptive: thread runs until it yields or blocks
View Full Document
This document was uploaded on 04/02/2014.
- Summer '14
- Operating Systems