9 - Dining Philosophers, Locks, Mutexes Flashcards
What is Deadlock?
A state in which each member of a group is waiting for another member, including itself, to take action, such as sending a message or more commonly releasing a lock.
What is Livelock?
States of the processes involved in the livelock constantly change with regard to one another, none progressing.
What is the Arbitrator Solution?
One thread gets to go at a time.
Non-optimal use of resources
What is the Random Timeout Solution?
If resources are not availible, thread takes a short RANDOM sleep. A small (likely non-permanent) chance of starvation.
What is the Resource Hierarchy Solution?
Establishes a partial order on resources
What is a Mutex?
Mutex = Mutual Exclusion
A synchronization mechanism used for ensuring exclusive access to a resource in concurrent programs.
What is Unfairness?
Not all processes get equal opportunity to progress
Name/explain two general approaches for cancelling a thread.
Asynchronous - pthread_kill() Deferred / Synchronous - Setting some shared global flag - pthread_cancel()
Are signals handled per thread or per process?
Per process
Race Conditions are not a problem among processes, only threads.
True or False?
False
A mutex has only two states: Locked and unlocked.
True or False?
True