Module 2 Flashcards
What is the purpose with synchronization?
That access to shared data must be controlled to avoid erroneous behavior and corruption of data
What are some mechanisms to control access to shared resources?
Locks, mutexes, semaphores, monitors, condition variables.
Why do we use mutual exclusion?
So that only one thread is allowed to be in its critical region at a certain time.
How is mutual exclusion programmed?
By using locks.
How does condition synchronization work?
Signal a condition, a process sets a shared variable.
Implemented by having one thread wait for a signal from another thread.
What is busy waiting?
When a thread waits for a condition and process repeatedly tests a variable until it becomes true.
What is the critical section?
A segment of code where processes access shared resources, such as common variables and files, and perform operations on them. Only one thread should have access to this part of the code at a time.
What is an atomic action?
A sequence of one or more statements that need to be executed as a single indivisible action, or not at all.
What is a fine-grained atomic action?
A action that can be implemented in a single step, i.e. by a single instruction.
What is a coarse-grained action?
An action that can be implemented in several steps as a critical section.