Lecture 7 Flashcards
Does failed mutual exclusion cause deadlock?
No it causes bad data.
What was the flaw with attempt 1?
Each process is tied to the execution of the other, and failure will cause blockage
Basics of attempt 1
check turn var, proceed or busy waiting, then update turn
What is the flaw with attempt 2
If a process fails inside its critical section, or after setting its flag, the other process will be blocked
Basics of attempt 2
the process should have its own key to the critical section by adding a flag to check the other process
What is the flaw with attempt 3
A deadlock can be caused by both setting their flag at the same time, forever loop
Basics of attempt 3
Process will set its flag before checking other flag, flag,guarantees mutual exclusion.
What is the flaw with attempt 4?
Lock ups may occur for indefinite period of time “live Lock”
Basics of attempt 4
Each process checks the other first but is prepared to reset flag to defer to other process
5th attempt basics
process that finds other is in resource, will periodically check back to see if it can go. Process will pass back control when finished
What are the two types of semaphores?
Counting and integer,
What is a semaphore
A general sync tool
Wait (S)
Decrement S
Signal (S)
Increment S