wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock

profile
Darshan Somaiya
Aug 16, 2024
1 Like
0 Discussions
152 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

What is Password Cracking ? and it's Techniques.

Blog banner

USES OF WHATSAPP

Blog banner

Ghee vs. Coconut Oil vs. Mustard Oil: Which Cooking Fat Wins for Indian Food?

Blog banner

Intrusion Detection System

Blog banner

How to Manage Employees and Tasks in One System (Without Excel)

Blog banner

Why Are So Many Adults Getting Diagnosed with ADHD?

Blog banner

Service Strategy principles

Blog banner

Palm Vein Biometric Technology; Contactless vein authentication

Blog banner

Hosting basics

Blog banner

Power of words

Blog banner

Bharat Maps

Blog banner

Buffers in Operating Systems

Blog banner

PERSONALITY DEVELOPMENT

Blog banner

Decision Tree: A Diagram Model

Blog banner

Game via listing method

Blog banner

Men’s Mental Health: Breaking the Silence and Building Emotional Well-being

Blog banner

E-mail security

Blog banner

Digital Footprints An Emerging Dimension of Digital Inequality

Blog banner

Cache memory

Blog banner

Evolution of the Microprocesor

Blog banner

Kafka - A Framework

Blog banner

What is Network Security?

Blog banner

Excel records

Blog banner

KAHAWA TEA

Blog banner

Blockchain uses and use cases

Blog banner

Importance of self defence for girls

Blog banner

Why Moms Are Choosing Customised School Accessories Over Generic Products?

Blog banner

What is online marketing and why do you need to know about it ?

Blog banner

The Power of Pretend Play: What Role-Playing Teaches Preschoolers

Blog banner

Record Blocking

Blog banner

ACHIEVEMENTS IN OPERATING SYSTEMS

Blog banner

Data-Driven Prediction of Virtual Item Prices in Online Games

Blog banner

Junk food vs healthy food

Blog banner

Can ChatGPT Answer All My Questions About Life?

Blog banner

Linker

Blog banner

MODERN OPERATING SYSTEM

Blog banner

Process in OS

Blog banner

Tiranga - Abbas Haveliwala

Blog banner

LiquidPlanner

Blog banner

Threats To Computer System

Blog banner

Blockchain

Blog banner

MORDERN UNIX SYSTEM

Blog banner