wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock

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

1 Dentist in Maroubra, Sydney and her 10 obsessions

Blog banner

Why Soft Skills Matter as Much as Grades?

Blog banner

10 Alien Encounters and Abduction Stories

Blog banner

Top 5 Post-Wedding Skin Care Tips

Blog banner

CYBERPEACEKEEPING: NEW WAYS TO PREVENT AND MANAGE CYBERATTACKS

Blog banner

Dudhasagar waterfall ?

Blog banner

Direct Memory Access

Blog banner

Power of words

Blog banner

Dental Problems That Start Small But Should Never Be Ignored

Blog banner

Memory Management

Blog banner

PROCESS CONTROL BLOCK IN OS

Blog banner

Virtual machine.

Blog banner

Music is life

Blog banner

WORKFRONT SOFTWARE

Blog banner

MENDELEY

Blog banner

Old age lifestyle

Blog banner

How to Manage Business Invoices and Payments Easily?

Blog banner

Concurrency:Deadlock and Starvation

Blog banner

Cherish the Craft — Essential Tips to Maintain Your Patola Collection

Blog banner

Data Analytics in Data Science

Blog banner

Expressing and Measuring Risk (Risk Management)

Blog banner

STARVATION

Blog banner

Cloud Security: Trends and Innovations

Blog banner

Sleep Matters: The Science Behind Toddler Naps

Blog banner

RACI model in IT services

Blog banner

Im Photographer

Blog banner

Networking 101: How to Build Meaningful Connections in College

Blog banner

Data Science & AI

Blog banner

File system implementation

Blog banner

Deadlock in Operating System

Blog banner

Working with Sniffers for monitoring network communication

Blog banner

The Lunchbox That Came Back Untouched — How to Handle a Fussy Eater at Preschool Age

Blog banner

Business Intelligence v/s Big Data

Blog banner

ITIL Version 3 and 4 differenciation?

Blog banner

Blog on Smartsheet.

Blog banner

USPS mail

Blog banner

What is time ? The term which has astonished Scientists

Blog banner

The Future of Patola Weaving in a Sustainable Fashion World

Blog banner

21ST CENTURY PATRIARCHY

Blog banner

Travelling blog

Blog banner

Memory management

Blog banner

Some facts about Technology

Blog banner