Concurrent programming, exam 19.11.2010
Toisella puolella suomeksi
Write in each answer sheet course name, date, your name, signature and student id.
- [9 p] Critical section.
- What is the critical section problem?
Give a concrete example on a situation where critical section problem arises?
- When would it be reasonable to solve the critical section problem with busy wait loop and when not? Explain? How do you solve the problem with busy wait loop?
- When would it be reasonable to solve the critical section problem with semaphores and when not? Explain? How do you solve the problem with a semafore?
- [9 p] Deadlocks.
- What is the deadlock problem? Give a concrete example on deadlock, based on the Dining Philosophers problem.
- Which four conditions must be in effect for deadlock to occur? Show that they exist in your example.
- Explain the main principles of Dijktra's deadlock detection algorithm (DDA).
- How would you prevent deadlocks from occurring in the first place? Give one solution method and show how it works with Dining Philosophers problem.
- [9 p] Monitor.
- What is a monitor? How does a monitor solve critical section problem?
- Where in the monitor may the processes executing there need to wait for their execution turn? For each type, give an example which explains why/when a process ended up waiting and when/how they get to execute.
- What does the concept monitor signalling semantics mean? How do the monitor signalling semantics affect the implementation of the monitor? Give a concrete pseudo-instruction level example.
- [9 p] Producer Consumer problem. There are many producers and consumers, and buffer size (N) is finite. Describe the problem and give a semaphore based solution. What synchronization and/or communication problems are involved and how are they solved?