Summary ch5
Last updated
Was this helpful?
Last updated
Was this helpful?
Race Condition:A situation where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place.
Critical Section:
Solution to Critical Section Problem:
(1)Mutual Exclusion - If process Pi is executing in its critical section, then no other processes can be executing in their critical sections
(2)Progress – When no process is in a critical section, any process that requests entry to its critical section must be permitted to enter without delay.
(3)Bounded Waiting - A bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted
Mutual Exclusion: Hardware Support
(1)Interrupt Disabling:
A process runs until it invokes an operating system service or until it is interrupted;
Disabling interrupts guarantees mutual exclusion
(2)Disadvantages:
Processor is limited in its ability to interleave programs;
Will not work in multiprocessor architecture.
Mutual Exclusion Machine-Instruction:
Advantages:
(1)Applicable to any number of processes on a single processor
(2)Processes on multiple processors(as long as processors share main memory)
(3)simple and therefore easy to verify
(4)It can be used to support multiple critical sections
Disadvantages:
(1)Busy-waiting consumes processor time
(2)Starvation is possible when a process leaves a critical section and more than one process is waiting
Semaphore is a variable that has an integer value
(1)May be initialized to a nonnegative number
(2)Wait operation decrements the semaphore value
(3)Signal operation increments semaphore value
Mutual Exclusion Using Semaphores: