wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock

profile
Darshan Somaiya
Aug 16, 2024
1 Like
0 Discussions
149 Reads

DEADLOCK


Deadlock is a situation in an operating system where a set of processes become stuck because each process in the set is waiting for another process to release resources. This leads to a cascade of dependencies where nothing can really progress, thus halting everything.


Four Conditions for Deadlock 

A deadlock can only occur when the following four conditions are met simultaneously:


1. Mutual Exclusion: At least one resource must be held in a non-sharable mode, and only one process can use the resource at a time.


2. Hold and Wait: A process holding at least one resource is waiting to acquire additional resources that are currently held by other processes.


3. No Preemption: Resources cannot be preempted from the process holding them; they can only be released voluntarily by the process.


4. Circular Wait: There is a set of processes such that each process in the chain is waiting for another which is ahead, forming a circle.


Example Scenario:

Suppose there are two processes and two resources. P1 process requests R1, and P2 requests R1 & holds R2. Neither process will release the resources it currently holds, and neither can proceed until it is able to acquire a resource that both processes are waiting on for completion. Therefore, both stall simultaneously, giving rise to deadlock.


Deadlock Prevention and Avoidance 

Operating systems employ various strategies to prevent or avoid deadlock:


- Deadlock Prevention: This is a set of methods for ensuring that at least one of the necessary conditions cannot hold. It can be done by requiring all processes to ask for resources at once or by preventing circular wait, etc.


- Deadlock Avoidance: It employs algorithms like the Banker’s Algorithm, which dynamically check the state of resource allocation to make sure a system will never enter an unsafe state where deadlock can happen.


Some systems may allow deadlocks to occur but have standby algorithms in place for detection and recovery, such as terminating one or more processes involved to free up resources.


Comments ()


Sign in

Read Next

internet email and it's applications

Blog banner

Strengthening Active Directory Security

Blog banner

Cybersecurity Standards for Automotive

Blog banner

Animal’s have my heart

Blog banner

Process, process creation and process termination

Blog banner

Product Discount Calculator

Blog banner

Deadlock

Blog banner

GIS in Mapping and landslide alert in Bangladesh

Blog banner

Blockchain Transactions

Blog banner

Deadlock and Starvation

Blog banner

DBMS and various career options related to it.

Blog banner

Riddhi Miyani 53003220140

Blog banner

IP ADDRESS

Blog banner

What is Segmentation?

Blog banner

EID UL FITR

Blog banner

Modern Operating Systems

Blog banner

Proof-of-Stake (PoS)

Blog banner

A Journey By Train

Blog banner

Satellite Based Positioning

Blog banner

MAHAKAL LOK UJJAIN

Blog banner

Memory Management

Blog banner

I/O Management and Disk Scheduling

Blog banner

Virtual Machine

Blog banner

This Windows 11 encryption bug may cause data damage

Blog banner

How to grow followers on Instagram business account?

Blog banner

DEVELOPMENTS LEADING TO MODERN OPERATING SYSTEMS

Blog banner

Microsoft Word

Blog banner

How Reading Books Shape a Child’s Imagination and Thinking?

Blog banner

Safeguarding Your Data: The Importance of Wireless Encryption

Blog banner

The Power of Teamwork: Learning Collaboration Through Everyday Activities

Blog banner

Jira Software

Blog banner

Tracking Emails & Email Crimes

Blog banner

Jio .....A Revolution ?? ??

Blog banner

Full Disk Encryption on Digital Forensics

Blog banner

RAID_142

Blog banner

Footprinting

Blog banner

Big Data

Blog banner

Sweet Mango Murabba

Blog banner

First-Order Logic (FOL): The Foundation of Modern Logic

Blog banner

Deadlock and Starvation

Blog banner

Memory managment

Blog banner

GIS REMOTE SENSING

Blog banner