• A network that’s congested (or filled large % of its I/O buffer space) can become deadlocked if it doesn’t have protocols to control flow of messages through network.
O.S Instructor
jorgegraveyard
Friday, February 5, 2010
Case 6 : Deadlocks in Disk Sharing
Case 6 : Deadlocks in Disk Sharing
Case 5 : Deadlocks in Spooling
Case 5 : Deadlocks in Spooling
Case 4 : Deadlocks in Multiple Device Allocation
Device Allocation
Case 3: Deadlocks in Dedicated Device Allocation
Case 3: Deadlocks in Dedicated Device Allocation
• Deadlock can occur when there is a limited number of dedicated devices.
• E.g., printers, plotters or tape drives.
1. P1 requests tape drive 1 and gets it.
2. P2 requests tape drive 2 and gets it.
3. P1 requests tape drive 2 but is blocked.
4. P2 requests tape drive 1 but is blocked.
Case 2 : Deadlocks in Databases
Case 2 : Deadlocks in Databases
• Deadlock can occur if 2 processes access & lock records in database.
• 3 different levels of locking :
– entire database for duration of request
– a subsection of the database
– individual record until process is completed.
• If don’t use locks, can lead to a race condition.
Example:
1. P1 accesses R1 and locks it.
2. P2 accesses R2 and locks it.
3. P1 requests R2, which is locked by P2.
4. P2 requests R1, which is locked by P1.
Case 1 : Deadlocks on File Requests
Case 1 : Deadlocks on File Requests
• If jobs can request and hold files for duration of their execution, deadlock can occur.
• Any other programs that require F1 or F2 are put on hold as long as this situation continues.
• Deadlock remains until a programs is withdrawn or forcibly removed and its file is released.
Example: