wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock

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

Fitness

Blog banner

The Rise of Evil Twin Attacks: A New Kind Of Spoofing Cyberattack

Blog banner

Procedure For Corporate High-Tech Investigations

Blog banner

All you need to know about “Off-page SEO”

Blog banner

Salt, Sand, and Smiles: Does the Maroubra Lifestyle Affect Your Enamel?

Blog banner

Modern Operating System - Khush Bagaria

Blog banner

What is Spyware?

Blog banner

Uniprocessor Scheduling

Blog banner

Race Condition

Blog banner

Revolutionary AI Tool: ChatGPT

Blog banner

Workplace mental health: A Psychological Perspective on Employee Well-being and Organizational Growth

Blog banner

TRAIN TRAVELING

Blog banner

Improving defences Proxy Device(defense in depth)

Blog banner

A small world of Sockets

Blog banner

Evolution of Operating System

Blog banner

Operating Systems

Blog banner

The Rich Heritage Of Patola Sarees: Gujarat’s Timeless Weaving Art

Blog banner

To-Do List In LISP

Blog banner

Real time scheduling

Blog banner

Decoding Confusion Matrix

Blog banner

Article on IT development trends

Blog banner

Gamer life

Blog banner

Yahoo! mail

Blog banner

Study of Sniffing Tools

Blog banner

Philadelphia Experiment : Was it real?

Blog banner

Why Users Leave Your Website in 5 Seconds (And How UI/UX Fixes It)

Blog banner

Dr. Venkadavarahan

Blog banner

The launch of UniMap by HERE

Blog banner

My First Dream Bike

Blog banner

Buffering

Blog banner

Whatsapp Messenger

Blog banner

How to setup a professional looking business account on Instagram?

Blog banner

Beyond the Track: Why the Best Hotel in Arcadia, Florida, Completes Your IMSA Sebring Getaway

Blog banner

Boxing

Blog banner

Modern OS

Blog banner

Toothache at night? What does this mean, and how to cope with it?

Blog banner

Jira service Management

Blog banner

Compromising Mobile Platforms

Blog banner

OS Assignment 3

Blog banner

Indian Food

Blog banner

The most common internet security threats

Blog banner

Record Blocking

Blog banner