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

New Horizon Europe project ‘EvoLand’ sets off to develop new prototype services.

Blog banner

"Audit" In Data Science

Blog banner

Modern operating system

Blog banner

Jamming Attacks in Network Security: Disrupting Communication Signals

Blog banner

Bots and Cyber Security

Blog banner

Predictive Analysis - Ek Overview

Blog banner

Office Lunch Problems in Mumbai and How Tiffin Services Solve Them

Blog banner

Blog name

Blog banner

ahh wait a min

Blog banner

Memory management

Blog banner

INTERNET SECURITY

Blog banner

Install Ubuntu in Vmware

Blog banner

THE ROLE OF CYBER FORENSICS IN CRIMINOLOGY

Blog banner

Rain bow

Blog banner

Components of GIS

Blog banner

Deadlock in operating system

Blog banner

Principles of Service Operation

Blog banner

Evolution of Operating System

Blog banner

De-Coding Love

Blog banner

Service Design Principles

Blog banner

Article on Team Work

Blog banner

How Harshad Valia International School is nurturing India’s Young Minds?

Blog banner

Simple Ways of Avoiding Basic Mistakes in Smart Phone Security

Blog banner

Junk food vs healthy food

Blog banner

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

Blog banner

Life of an army person

Blog banner

Key to success in Sports

Blog banner

Hey Aryan here

Blog banner

Latest Email Marketing Techniques

Blog banner

OS Assignment 3

Blog banner

Indian Culture and Tradition

Blog banner

OPERATING SYSTEM OBJECTIVES AND FUNCTIONS

Blog banner

Embaded operating system

Blog banner

Cache Memory(142)

Blog banner

HOW CAN SOCIAL MEDIA MAKE YOU HAPPIER?

Blog banner

OS Assignment-3

Blog banner

Drawing tips for a beginner

Blog banner

Data Security and Data Privacy in Data Science

Blog banner

Linux

Blog banner

Memory management and virtual memory

Blog banner

MAILFENCE

Blog banner

Everything You Need for a Perfect Stay in Arcadia, Florida, USA.

Blog banner