{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

End switch load the return address context context

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: WITCH # load the return address Context Context Switches: Voluntary and Involuntary On a uniprocessor, the set of possible execution schedules depend 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 and switches control to a different thread. Thread scheduler tries to share CPU fairly by timeslicing. General General Thread Operations Create allocate memory for stack, perform bookkeeping associate entry-point (called function) parent parent thread creates child threads Destroy/Cancel Destroy/Cancel release memory (or recycle), perform bookkeeping Suspend/Resume/Yield/Sleep Thread Thread Scheduling 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 Priorities? Al...
View Full Document

{[ snackBarMessage ]}