wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlocks

profile
Heer Bhatt
Aug 14, 2024
0 Likes
0 Discussions
97 Reads

Deadlock refers to a situation where multiple processes are waiting indefinitely for an event to occur. It arises when each process holds resources needed by another process, creating a circular dependency.

Deadlock Conditions


Deadlock occurs when four necessary conditions are met:


1. Mutual Exclusion: Resources are allocated exclusively to one process at a time.

2. No Pre-emption: Once a process acquires a resource, it cannot be forcibly taken away.

3. Hold and Wait: Processes hold onto resources while waiting for additional resources.

4. Circular Wait: A circular dependency exists, where each process waits for a resource held by the next process in the sequence.

Deadlock Examples

Bank Account Example:

- Customer requests account opening but must first deposit funds.

- Bank requires deposit before opening account.

- Both parties are waiting for the other's action, leading to a deadlock.

Vehicle Example:

- Two cars approach from opposite directions, each assuming the path is clear.

- Both cars become deadlocked, unable to proceed until one reverses direction

in a defined order to avoid circular dependencies.


Necessary and Sufficient Conditions

The four conditions mentioned above are both necessary and sufficient for deadlock to occur. If any of these conditions are not met, deadlock cannot occur. However, if all four conditions are met, deadlock is inevitable.


Deadlock Handling Methods


- Four important methods are used to handle deadlocks:

1.Deadlock Ignorance

- This method, also known as the Ostrich method, involves ignoring deadlocks.

- This is a widely used strategy, especially in operating systems like Windows and Linux.

- The method is based on the belief that deadlocks occur rarely, and it is more efficient to ignore them and restart the system if they do occur.

- This method does not address the underlying causes of deadlocks and can lead to system instability if deadlocks occur frequently

2. Deadlock Prevention:

. This method aims to prevent deadlocks from occurring in the first place.

- It involves removing or disabling one or more of the necessary conditions for a deadlock to occur.

- By ensuring that at least one of these conditions is not met, deadlocks can be prevented.

- This method requires careful analysis of the system and may involve modifying the way resources are allocated or processes are scheduled.

- It can be more complex and resource-intensive than other methods but provides strong guarantees against deadlocks.

3.Deadlock Avoidance:

•This method involves dynamically checking for potential deadlocks before they occur.

- It uses algorithms to predict the resource needs of processes and avoid allocating resources that could lead to a deadlock.

- Deadlock avoidance requires accurate knowledge of the resource requirements of processes, which can be difficult to obtain in complex systems.

- It can lead to lower system utilization compared to other methods as resources may be held unnecessarily to avoid deadlocks.

4. Deadlock Detection and Recovery:

•This method involves detecting deadlocks when they occur and taking steps to recover the system.

- It uses algorithms to identify processes involved in deadlocks and can involve forcibly terminating processes or preempting resources to break the deadlock.

- Deadlock detection and recovery can be complex and time-consuming.

- It can lead to data loss or system instability if not implemented carefully.

- This method is typically used as a last resort when other prevention or avoidance methods are not feasible or effective.


Comments ()


Sign in

Read Next

Multiprocessor and Multicore Organization

Blog banner

Rapido

Blog banner

Web browser forensics:Tools,Evidence collection and analysis

Blog banner

File Management

Blog banner

Deadlock

Blog banner

Mendeley (management software)

Blog banner

Smartsheet

Blog banner

Palm Vein Biometric Technology; Contactless vein authentication

Blog banner

How India made the GIS its Own, and its Use in Infrastructural Developments

Blog banner

Preparing Students for Higher Education: How International Schools Shape Future Success

Blog banner

virtual machine

Blog banner

Ethical Issues in Data Science and Role of Data Science in Smart Cities

Blog banner

File management

Blog banner

Which Smartphone Company Has the Largest Market Share in India?

Blog banner

Emotional Intelligence in Children: Why It Is as Important as Academics

Blog banner

EFT

Blog banner

IO Buffers

Blog banner

semaphores

Blog banner

What is a geographic information system (GIS)?

Blog banner

PHISHING

Blog banner

Wrike

Blog banner

OS PROCESS DESCRIPTION AND CONTROL-SARVAGYA JALAN

Blog banner

Importance of Network Security Risk

Blog banner

RAID and It's Levels

Blog banner

COMMUNICATION

Blog banner

Review on Cyber Forensics and its Analysis Tools

Blog banner

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

Blog banner

Time Series Analysis

Blog banner

MySQL

Blog banner

TOP 5 GAMING GADGETS (2024)

Blog banner

Evolution of Operating System

Blog banner

Security in Cloud Computing Environment using cryptography - Rushabh Modi

Blog banner

TOGETHER WE CAN CONQUER #team

Blog banner

Data Mapping

Blog banner

From Model Mistakes to Metrics

Blog banner

Ethical Hacking

Blog banner

Cherish the Craft — Essential Tips to Maintain Your Patola Collection

Blog banner

Functions Of Operating Systems

Blog banner

Wiretapping

Blog banner

Improving defences Proxy Device(defense in depth)

Blog banner

Importance of Morning Routines for Students During the Festive Season

Blog banner

Uniprocessor scheduling

Blog banner