A thread contains much less state than does a process, which makes threads cheaper and easier to manipulate than processes. Threads execute within a process, using the process state - such as open files and the address space - to suppliment their own state. Because all threads within a process share the process state, they may use the shared state to communicate among themselves.
Mutual exclusion is a form of resource access that ensures that a resource shared among several executing entities (processes or threads) is accessed by only one entity at a time. A critical region is a finite section of an entity's code within which the entity is guaranteed to have mutually exclusive access to a shared resource.
global semaphore mutex = 1 /* other code */ down(mutex) /* enter critical region */ /* access shared resource */ up(mutex) /* leave critical region */
Yes you do. Even if a process only releases the CPU when it terminates, the operating system still needs to figure out which process gets the CPU next, and that is what a scheduler does.
This page last modified on 6 March 2000.