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

Cycling

Blog banner

Population

Blog banner

Exploring Human Factors in Cyber Forensics Investigations.

Blog banner

Synchronization

Blog banner

Challenges of Digital forensics in cloud computing environment

Blog banner

Evolution of Operating Sytems

Blog banner

Artical on FreshBooks

Blog banner

Process and Threading

Blog banner

Virtual Memory - Explaination, Working, Steps

Blog banner

Mumbai

Blog banner

Save Environment

Blog banner

Self-love: Being the reason of your own smile

Blog banner

What is metaverse?

Blog banner

Privacy LAWs in IT

Blog banner

Answer

Blog banner

The New Classic: Indo Western Patola Outfits for Today’s Woman

Blog banner

memory cache

Blog banner

Electronic Evidence in Cyber Forensics

Blog banner

Deadlock and starvation

Blog banner

The New Dr. Frankenstein who will perform first full head transplant

Blog banner

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

Blog banner

A-B-C of Networking: Part-3 (Topology [Ring, Tree, Mesh])

Blog banner

HUBSPOT

Blog banner

RACI model in IT services

Blog banner

Worms, viruses and Bots

Blog banner

RAID

Blog banner

Critical success factors

Blog banner

Direct Memory Access

Blog banner

gis substation

Blog banner

Modern operating system

Blog banner

Electronic Funds Transfer

Blog banner

What is a Dumpster Diving Attack?

Blog banner

The Role of Cyber Forensics in Addressing Cyber security Challenges in Smart Cities

Blog banner

Building a Simple Doctor Appointment System in Common Lisp

Blog banner

Is It Too Late to Straighten My Teeth as an Adult?

Blog banner

(Input/Output) in os

Blog banner

EVOLUTION OF MICROPROCESSOR

Blog banner

Modern Operating System

Blog banner

10 Unsolved Mysteries all over the world

Blog banner

The Power of Teamwork: Learning Collaboration Through Everyday Activities

Blog banner

File management

Blog banner

Steganography

Blog banner