What does an atomic swap instruction exchange?
Choose an option to check your answer.
An atomic swap can exchange a local value with a shared lock variable without interruption.
This indivisible exchange can be used to build mutual-exclusion locks.
Practice Operating System questions with answers and explanations.
Choose an option to check your answer.
An atomic swap can exchange a local value with a shared lock variable without interruption.
This indivisible exchange can be used to build mutual-exclusion locks.
Choose an option to check your answer.
A spinlock keeps a waiter active in a loop until the lock becomes available.
It is appropriate mainly when the expected wait is short and a processor is available.
Choose an option to check your answer.
Busy waiting repeatedly executes instructions while waiting for a state change.
Unlike blocking, it does not release the processor for other work during the wait.
Choose an option to check your answer.
Modern processors and compilers may reorder memory operations unless constrained.
A memory barrier ensures required reads and writes become visible in the intended order.
Choose an option to check your answer.
Atomic variables provide operations that other threads cannot observe halfway through.
They may store several data types and often support operations such as load, store, exchange, and compare-and-swap.
Choose an option to check your answer.
Bounded waiting provides a finite upper bound on overtaking after a request is made.
This fairness condition prevents indefinite starvation at the critical section.
Choose an option to check your answer.
The classic Peterson algorithm is designed for two processes using shared flags and a turn variable.
Extensions for more processes require different or generalized algorithms.
Choose an option to check your answer.
The turn variable gives preference to one process when both intent flags are set.
Together with the flags, it preserves mutual exclusion and progress.
Choose an option to check your answer.
Each flag records whether the corresponding process is interested in entering the critical section.
The other process checks this intent together with the turn value.
Choose an option to check your answer.
With interrupts disabled, the processor cannot switch to another interrupt-driven execution path on that CPU.
This approach is unsuitable for long user-level sections and does not by itself stop other processors.
Choose an option to check your answer.
The remainder section contains ordinary work outside the protected critical section.
It does not require the same mutual-exclusion restriction for that shared resource.
Choose an option to check your answer.
Mutual exclusion prevents conflicting processes from entering the critical section simultaneously.
It is the core safety property of critical-section solutions.