Quiz 3 Flashcards
What is a race condition?
A condition that occurs when two concurrent programs interfere with each other
What is a critical section?
A portion of code that shouldn’t be interrupted while its running.
What are the three requirements for a solution to the critical section problem?
Mutual Exclusion
Progress
Bounded Waiting
What is Mutual Exclusion?
A requirement that a solution for the critical section problem must have. If a process is in its critical section then no other processes can be executing their critical section.
What is Progress?
A requirement that a solution for the critical section problem must have. If no process is executing its critical section and another process wishes to enter their critical section then it cannot be postponed indefinitely.
What is Bounded Waiting?
A requirement that a solution for the critical section problem must have. A bound must exist on the number of times other process are allowed to enter their critical section.
What is the Interrupt based solution?
The entry section disables interrupts for the program while the exit section enables interrupts for the program.
What is Peterson’s Solution?
You have a variable called turn that indicates who turn it is to enter the critical section as well as a flag that indicates if a process is read to enter into the critical section.
Why is it that Peterson’s Solution may not work on modern hardware?
Modern Hardware may reorder operations to make thee program more efficient resulting in a skewed result.
What is a memory barrier?
Memory guarantees a computer architecture makes to application programs.
What is the difference between a strongly ordered memory model and a weakly ordered memory model?
A strongly ordered memory model is one where a memory modification of one processor is visible to all other processors. A weakly ordered memory model is where a modification of one processor may not be immediately visible to all other processors.
What are the two forms of hardware support for synchronization?
Hardware instructions
Atomic Variables
What are atomic variables?
Variables that are guaranteed to not be able to interrupted in their operations
What are the two Hardware Instructions that can be used to insure syncronization?
Test and Set and Compare and Swap
What does Test and Set do?
It takes in a Boolean target, sets a return value equal to target sets target to true and then returns the return value
It is executed atomically