Case 1: Deadlocks on File Request
- 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:
Case 2: Deadlocks in Database
-Deadlock can occur if 2 processes access & lock records in database.
Three 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 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.
Example:
P1 requests tape drive 1 and gets it.
P2 requests tape drive 2 and gets it.
P1 requests tape drive 2 but is blocked.
P2 requests tape drive 1 but is blocked.
Case 4. Deadlocks in Multiple Device Allocation
-Deadlocks can happen when several processes request, and hold on to, dedicated devices while other processes act in a similar manner.
Example:
Case 5: Deadlocks in Spooling
-Most systems have transformed dedicated devices such as a printer into a sharable device by installing a high-speed device, a disk, between it and the CPU. Disk accepts output from several users and acts as a temporary storage area for all output until printer is ready to accept it (spooling).
Example:
If printer needs all of a job's output before it will begin printing, but spooling system fills available disk space with only partially completed output, then a deadlock can occur.
Case 6: Deadlocks in Network
-a network that's congested or has filled a large percentage of it's I/O buffer space can become deadlocked if it doesn't have protocols to control the flow of messages through the network.
Example:
Case 7: Deadlocks in Disk Sharing
-Disks are designed to be shared, so it’s not uncommon for 2 processes access different areas of same disk. Without controls to regulate use of disk drive, competing processes could send conflicting commands and deadlock the system.
Example:
No comments:
Post a Comment