UMBC CMSC421 UMBC | CSEE | CMSC421 | Fall 1999 (Section 0101)

 

Homework #2: Synchronization & Deadlock

CMSC 421, Section 0101 (Fall 1999)

Assigned: 30 Sep 1999
Due: 7 Oct 1999 at 2:30 PM

Late homeworks will not be accepted.

Remember: your homework must be turned in online via submit.

  1. Problem 6.5 from the text.
  2. Problem 6.7 from the text.
  3. Problem 6.8 from the text.
  4. Consider the following snapshot of a system:
    Process Allocation Max
    A B C D A B C D
    P0 0 1 0 2 0 2 0 2
    P1 1 5 3 4 3 6 3 6
    P2 0 1 0 4 2 6 6 6
    P3 1 0 0 0 1 6 7 0
    P4 0 3 6 2 0 6 6 2

    Currently, the available resources are: 1-A, 3-B, 5-C, 0-D. Answer the following questions, assuming you're using the banker's algorithm to manage resources and avoid deadlock:
    1. What is the content of the Need matrix?
    2. Is the system currently in a safe state?
    3. If process P1 requests an additional (0,4,2,0) resources, can this request be granted immediately?
  5. Problem 7.5 from the text.
  6. Most modern computer systems don't use the banker's algorithm or similar methods to avoid deadlock. Why not? Can a modern system deadlock over limited resources? If so, how are deadlocks usually resolved?
  7. Many applications use multiple threads interacting via shared locks, and individual threads often require multiple locks to accomplish their tasks. Propose a set of programming guidelines for writing code that will guarantee that deadlocks never occur. What information must be shared between programmers using your guidelines working on the same program? How does your method prevent deadlock?


Syllabus | Schedule | News & Notes | Grades | Feedback
Submit | Homework: 1 2 3 4 5 6 | Project: 1 2 3 4


Last updated 3 Dec 1999 by Ethan Miller (elm@csee.umbc.edu)