Reference no: EM133191499
Questions
1. Explain why the solution of the Dining Philosophers problem with semaphores suffers from a potential starvation problem (a deadlock). Provide a detailed stepby-step example that leads to a deadlock.
2. Define what a monitor is.Explain what problems related to semaphores led to the introduction of monitors?Why is using monitors safer than using semaphores?
3. Explain why the implementation of semaphores constitutes a critical section problem itself?Why using spinlocks is not a big problem in this implementation?
4. Explain with details how a barrier can be used to synchronize threads.How is this synchronization mechanism different from thread joining?
5. Provide a proof that the two-process Peterson's solution satisfies all requirements for a correct solution to the critical section problem.
HINT: Analyze all possible scheduling cases for two processes.
6. Provide a formal proof that blocking interrupts can be used as a solution for the critical section problem on a single-processor computer. Would it work on a multiprocessor machine? Justify your answer.
7. Define what a spinlock is.Under what conditions using spinlocks is acceptable.
8. What is a semaphore? Does it suffer from the busy-waiting problem? Is it possible to implement it so that it does not?Explain how a semaphore can be used to solve the critical section problem.
HINT: Note that that requires a proof that using a semaphore is the basis for a proper solution to the critical section problem.
9. What requirements does a solution to the critical section problem need to satisfy? Provide a commentary for each.
10. Analyze step-by-step two potential scenarios for executing at least two processesthat utilize an atomic operation of comparing and swapping two variables forentering their critical sections. Show all the steps in your analysis of the scenarios.
11. Analyze two potential scenarios for executing at least two processes that utilize the atomic operation of testing and setting variables for entering their criticalsections. Show all the steps in your analysis of the scenarios.
12. Explain with details what a critical section is.Provide two real-life examples of problems that are similar to the critical section problem and explain why do you think they fall to the same category.
13. Explain what a race condition is.Provide two examples with a detailed step-by-step justification for including them.