Chapter 24 Flashcards
What are 3 classical problems of synchronization
1- Bounded-buffer problem
2- Readers and writers problem
3- Dining philosophers problem
What mutex stands for
mutual exclusion
What is reader and writers problems
There is a shared object in multiple readers and writers. Multiple processes can read. That is fine but if something is writing on shared object then read should not be allowed. If write operation is on the go, and we allow multiple readers to read it then every reader might get different value. And there should not be multiple write operations at a time.
What are 2 solutions of readers and writers problem
- First readers and writers problem
2. Second readers and writers problem
What is First readers and writers problem
No reader will be kept waiting unless a writer has already obtained permission to use the shared object.
What is second readers and writers problem
It a writer is ready, it waits for the minimum amount of time.
What are dining philosophers problem
There are 5 philosophers and their life is thinking and eating. They have only 2 chopstick and they agreed first they will carry right chopstick and then left chopstick. But one sad day all 5 become hungry at the same time and all of them picked right chopstick. They halted and all died because of hunger. It is problem of starvation.