5 - Process Comms and Deadlock Flashcards
What is the Critical Section Problem?
processes all competing for the same shared data
Ensure that when one process is executing in its critical section, no other process is allowed to execute in its critical section
Necessary elements of a critical section solution
Mutual Exclusion
-at most one process can be in its critical section at any time
Progress
- all processes should eventually be permitted to do so
Fairness
- Scheduling needs to be fair (bounded waiting)
What is the producer consumer problem?
A producer process produces info that is consumed by a consumer process
Circular Array
buffer can be org as a circular array with in/out pointers:
- in: next free position in buffer
- out: first full pos in buffer
What is a “race condition”?
A situation where the order of execution affects data
Semaphore
An integer variable only modified by p and v operations
p operation
test a lock
enter if free
secure lock
or wait for lock to be free
v operation
free the lock
Deadlock
- When two processes wait for a resource held by another but that it cannot give up due to it waiting for another resource