Sunday, November 25, 2007

IS215 - Concurrent Processes Exercises - 1

1. Give two examples of competing processes in an actual system. Do the same for cooperating processes.

2. Write a procedure (different from what was given in this book earlier) use_resource() illustrating the following mutual exclusion problems:

a) starvation
b) mutual exclusion violated
c) deadlock

3. What is a monitor as used for regulating concurrent access to shared resources? Give examples of problems that may be eliminated by the use of a monitor.

4. Describe an approach to process synchronization. Illustrate your answer by outlining an algorithm for a cyclic buffering system; show how your algorithm works by considering the progress of a consumer and a producer processes as they advance through critical regions, get delayed on queues, etc.

5. When, and why, do processes need to synchronize their activities. Describe an approach to process synchronization based upon semaphores. Show how these may be used to solve two typical synchronization problems.

6. Illustrate or argue the correctness of the Dekker's algorithm? Do the same for the Paterson's algorithm and the engineering solution.

7. In order for the engineering solution to execute correctly, the test&set() function must be executed in one CPU cycle. Why is this so? What happens if this is not executed in one CPU cycle?

8. The readers and writers problem models access to a database. Consider a big database with many competing processes wishing to read and write into it. It is acceptable to have multiple processes reading the database at the same time, but if one process is writing, no other process may have access to the database, not even readers. Write a program employing semaphores that ensure correct execution of this.

9. What does the initial value of the semaphore s stands for?

10. Show that counting semaphores can be implemented using binary semaphores.

No comments: