Concurrency Flashcards
Atomic Operation
A function or action that cannot be interrupted under any circumstances
Critical Section
A section of code with shared resources that cannot be executed when another process is using the shared resources
Deadlock
When 2 or more processes cannot run as they are waiting for each other to run
Livelock
When 2 or more processes continuously change their state in response to the other processes, without doing any meaningful work
Mutual Exclusion
The requirement that only one process can have access to shared resources at at time
Race Condition
Multiple processes access a shared data file and the final result depends on the timing of the process
Starvation
A process is overlooked indefinitely by the scheduler, it is ready to run but is never run
How to prevent race conditions?
Create critical sections with mutual exclusion. Processes can only access shared resources after another process has finished accessing the same resources
Problem with mutual exclusion?
Enforcing mutual exclusions creates deadlocks and starvation
Solutions to critical section problem?
Software Solution - shared lock variables, busy waiting
Hardware Solution - disabling interrupts, special instructions
Higher Level OS Constructs - semaphores, monitors, message passing
Shared lock problem
The lock itself is a shared variable so it is possible 2 processes could have a race condition on it