Process Synchronization Flashcards
(75 cards)
What is the initial value of the counter in the motivating scenario?
5
What are the possible outcomes for the value of the counter after concurrent execution?
4, 5, or 6
Define race conditions.
A situation where several processes access and manipulate the same data (critical section) and the outcome depends on the order of access.
How can race conditions be prevented?
By synchronization, ensuring only one process manipulates the critical data at a time.
What is the critical section problem?
To design a protocol that ensures when one process is in its critical section, no other may be in its critical section.
What are the three main conditions to solve the critical section problem?
- Mutual Exclusion
- Progress
- Bounded Waiting
What does mutual exclusion ensure?
If process P_i is executing in its critical section, no other processes can be executing in their critical sections.
What does progress mean in the context of the critical section problem?
If no process is executing in its critical section and some processes wish to enter, the selection of the next process cannot be postponed indefinitely.
What is bounded waiting?
A bound must exist on the number of times other processes can enter their critical sections after a request is made.
What does Dekker’s algorithm use to indicate if a process is ready to enter the critical section?
The turn variable.
What is the purpose of the flag array in Peterson’s solution?
To indicate if a process is ready to enter the critical section.
What does the test_and_set instruction do?
Writes to a memory location and returns its old value.
What is an atomic operation?
An operation that is performed without the possibility of interruption.
What is the role of hardware support in synchronization?
To implement critical section code efficiently using atomic hardware instructions.
True or False: The usage of interrupts is suitable for multicore systems.
False
What is the function of the compare_and_swap instruction?
It sets a variable to a new value only if it equals an expected value, executed atomically.
How does the compare_and_swap instruction guarantee mutual exclusion?
It ensures that only one process can change the value of a shared variable at a time.
Fill in the blank: The critical section must be executed by _______.
only one process at a time
What does the term ‘critical section’ refer to?
A segment of code where a process accesses shared resources.
What happens if multiple processes enter their critical sections simultaneously?
It can lead to data inconsistency.
What is the significance of disabling interrupts in uniprocessor systems?
It allows currently running code to execute without preemption.
What is the main drawback of disabling interrupts in multiprocessor systems?
It is generally too inefficient.
What is the expected behavior of a process that has made a request to enter its critical section?
It should not be indefinitely postponed from entering.
How does hardware support improve synchronization mechanisms?
By providing atomic operations that prevent race conditions.