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

Technological Advancement

Blog banner

Assignment-3

Blog banner

How Schools Can Reduce Exam Stress in Students?

Blog banner

How to use open SSL for web server - browser communication

Blog banner

Importance of modern technology era

Blog banner

Linker

Blog banner

Women empowerment

Blog banner

Telegram and it's features

Blog banner

The Evolution of Operating Systems

Blog banner

Evolution of Operating system.

Blog banner

Security in Cloud Computing

Blog banner

Pro-Tips On How To Keep your Foot Healthy

Blog banner

Exploring Virtual Machines and Computer Forensic Validation Tools

Blog banner

Google

Blog banner

OPERATING SYSTEM

Blog banner

MEMORY MANAGEMENT REQUIREMENT

Blog banner

Uniprocessor scheduling

Blog banner

About myself

Blog banner

What is metaverse?

Blog banner

Cyber Forensics

Blog banner

memory managment

Blog banner

Explain Kernel in OS

Blog banner

Compromising Mobile Platforms

Blog banner

Virtual memory in windows

Blog banner

virtual machine

Blog banner

Pooja Silver

Blog banner

Why Are So Many Adults Getting Diagnosed with ADHD?

Blog banner

Linux -V Server Virtual Machine

Blog banner

E-BUSINESS RISK MANAGEMENT

Blog banner

Virtual memory in Operating System

Blog banner

MAHAKAL LOK UJJAIN

Blog banner

How Laughing Gas Makes Your Dental Visit So Much Easier

Blog banner

Computer security techniques

Blog banner

Virtual memory

Blog banner

Jamming Attacks in Network Security: Disrupting Communication Signals

Blog banner

Paralysis/Paralysis Stroke

Blog banner

How to lose belly fat

Blog banner

A True Friendship

Blog banner

Data Mapping

Blog banner

Autonomy Vehicles: Future Ki Gadiya

Blog banner

R Programming

Blog banner

Southern Turkey Earthquake: Causes and Consequences of a Tragic Natural Disaster

Blog banner