
|
CSCI 4500 SPRING 2005 TEST 3 STUDY GUIDE
CHAPTER 6: PROCESS SYNCHRONIZATION
1. Suppose that a producer and a consumer process are executing concurrently and that the producer is executing counter++, and the consumer is executing counter--. If counter initially has the value 5, explain how the execution of these two processes could result in counter having a value other than 5.
2. Define:
a. race condition
b. deadlock.
c. semaphore
d. wait and signal.
2. Describe the critical-section problem. What are the 3 requirements for any solution to this problem?
3. Give Peterson’s solution to the two-process critical section problem. Explain why it works.
4. Suppose process P1 has statement S1 and process P2 has statement S2. Furthermore, assume S1 must be executed before S2. Explain how a semaphore can be used to synchronize these processes.
5. Given Figure 6.9, explain why this solves the critical section problem.
6. Given the statements on page 204, explain why this causes a deadlock.
7. Describe the Bounded-Buffer Problem.
8. Describe the Readers-Writers Problem.
9. Describe the Dining Philosophers Problem.
CHAPTER 7: DEADLOCKS
1. List and describe the 4 necessary conditions for the existence of a deadlock.
2. Be able to draw a resource-allocation graph such as in Figures 7.2 and 7.3 and explain why there is or isn't a deadlock.
3. Describe the three different methods for dealing with a deadlock.
4. What is the difference between deadlock prevention and deadlock avoidance?
5. What does mutual exclusion have to do with the type of resource?
6. What protocols can be used to make sure that "hold and wait" never occurs? What are the disadvantages of these protocols?
7. What protocols can be used to make sure that "no preemption" does not hold? What is the problem with these?
8. What protocols can be used to make sure that "circular wait" does not hold? What problems are associated with this?
9. What is a safe state? What does this have to do with deadlock avoidance?
10. Given the Banker's Algorithm, be able to apply it to a particular set of processes and resources.
11. When should a deadlock detection algorithm be invoked?
12. List and explain the two main alternatives for breaking a deadlock.
|