Friday, February 5, 2010

Examples of the seven Cases od Deadlocks

1.Case 1:  Deadlocks on file requests

Two programs (P1, P2) and two files (F1, F2)

Deadlock sequence:

P1 has access to F1 and also requires F2

P2 has access to F2 and also requires F1


2.  Case 2: Deadlocks in databases

Transaction A might hold a lock on some rows in the Accounts table and needs to update some rows in the Orders table to finish. Transaction B holds locks on those very rows in the Orders table but needs to update the rows in the Accounts table held by Transaction A. Transaction A cannot complete its transaction because of the lock on Orders. Transaction B cannot complete its transaction because of the lock on Accounts. All activity comes to a halt and remains at a standstill forever unless the DBMS detects the deadlock and aborts one of the transactions.



3. Case 3:  Deadlocks in dedicated device allocation

Two programs (P1, P2)

Need two tape drives each
Only two tape drives in system
Deadlock sequence
P1 requests tape drive 1 and gets it
P2 requests tape drive 2 and gets it
P1 requests tape drive 2 but blocked
P2 requests tape drive 1 but blocked

4.  Case 4: Deadlocks in multiple device allocation

Three programs (P1, P2, P3)

Three dedicated devices (tape drive, printer, plotter)

Deadlock sequence

P1 requests and gets tape drive

P2 requests and gets printer

P3 requests and gets the plotter

P1 requests printer but blocked

P2 requests plotter but blocked

P3 requests tape drive but blocked


5. Case 5: Deadlocks in spooling

Printer needs all job output before printing begins

Spooling system fills disk space area

No one job has entire print output in spool area

Results in partially completed output for all jobs


6. Case 6: Deadlocks in disk sharing

Two processes

Each process waiting for I/O request

One at cylinder 20 and one at cylinder 310

Deadlock sequence

Neither I/O request satisfied

Device puts request on hold while attempting to fulfill other request for each request


7.  Case 7: Deadlocks in a network

Seven computers on network

Each on different node

Direction of arrows

Indicates message flow

Deadlock sequence

All available buffer space fills


4 comments:

  1. I love this, it is very easy to understand, nice work from you, keep it!

    ReplyDelete
  2. that is simple to understand it thank you

    ReplyDelete
  3. You made my work very easy! Thanx :)

    ReplyDelete