Classic Synchronization Problems Flashcards
(38 cards)
What are the 3 classic synchronization problems?
- Producer-Consumer AKA bounded-buffers
- Readers-Writers
- Dining-Philosophers
The classic synchronization problems are ________ that can be used to model money ______ ________ problems
abstractions, resource, sharing
The classic synchronization problems can be used to _______ newly proposed synchronization problems
test
In the bounded-buffer problem, what do producers and consumers do, and where?
producers insert into a buffer, and consumers remove from buffer
In the bounded-buffer problem, it is possible to have _________ producers and consumers
multiple
In the bounded-buffer problem, what are 3 issues?
- Violation of buffer structure
- Producing when full
- Consuming when empty
In the bounded-buffer problem, the solution uses ______ semaphores
three
In the bounded-buffer problem, what are the 3 semaphores used in the solution called, and what are they initialized to?
- mutex: 1
- full: 0
- empty: N
In the bounded-buffer problem, the producer ________ full and _________ empty
increments, decrements
In the bounded-buffer problem, there is a _______ between producers and consumers
symmetry
In the readers-writers problem, _____ is shared among multiple processes
data
In the readers-writers problem, readers only _____ and do not perform any ________
read, updates
In the readers-writers problem, writers can _____ and ________
read, write
In the readers-writers problem, what are the 2 requirements for a solution?
- Allow multiple concurrent readers and no writer
- Allow one writer and no reader
In the readers-writers problem, a solution as provided by the OS and runtime libraries called __________ in Pthread
pthread_rw_lock*
In the readers-writers problem, a process can ask for ______________ lock either in read or write mode
readers-writes
In the readers-writers problem, when should you use reader-writer locks? (2 reasons)
- When it’s easy to identify readers and writers
- When there are more readers than writers
reader-writer locks are more ________ to implement than mutex
complex
reader-writer locks have more _________ because of coordination between readers and writers
overhead
Why do reader-writer locks have high concurrency?
They allow multiple readers
In the reader-writer lock struct, what 3 values are there, and what are they initialized to?
- read_count: 0
- rw_mutex: 1
- mutex: 1
In the reader-writer lock struct, what does read_count do?
tracks the number of reader holding the lock
In the reader-writer lock struct, the rw_mutex allows either many _______ or one _______
readers, writer
In the reader-writer lock struct, the mutex protects __________
read_count