wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlocks in Operating Systems

profile
Mansi Barot
Aug 15, 2024
0 Likes
0 Discussions
148 Reads

In an operating system, a deadlock occurs when a set of processes get stuck because each process is waiting for a resource that another process in the set is holding. None of the processes can proceed because they are all waiting for resources that are currently being held by each other, creating a cycle of dependency.

 

  • Conditions for Deadlock: A deadlock happens when all of these four conditions occur simultaneously:
  1. Mutual Exclusion: At least one resource must be held in a non-shareable mode (i.e., only one process can use the resource at a time).
  2. Hold and Wait: Processes holding resources can request new ones without releasing what they already have.
  3. No Preemption: Resources cannot be forcibly taken away from a process; they must be released voluntarily.
  4. Circular Wait: A circular chain of processes exists where each process is waiting for a resource held by the next process in the chain.

 

  • Dealing with Deadlocks

Operating systems use various strategies to handle deadlocks:

  • Deadlock Prevention: Modify the system to prevent one of the four conditions from occurring.
  • Deadlock Avoidance: Use algorithms like Banker's Algorithm to avoid unsafe states.
  • Deadlock Detection and Recovery: Allow deadlocks to happen, but detect and resolve them by terminating or preempting processes.
  • Ignoring Deadlock: In some systems (e.g., UNIX), deadlocks are ignored under the assumption that they are rare.


In an easier way to understand, imagine you're playing a game with your friends, and you all want to use each other's toys at the same time. But no one is willing to share until they get the toy they want. Now, everyone is stuck waiting, and no one can keep playing. 

In an operating system, a deadlock is like that. It's when programs are waiting for resources (like memory or files) that another program is using. But since each program is waiting and won't give up what it already has, they all get stuck and can't continue.


Comments ()


Sign in

Read Next

evolution of operating system - Disha Parekh

Blog banner

Cross site scripting Attack

Blog banner

Big Data Architecture

Blog banner

PPT methodology

Blog banner

Why we fail after giving 100% ?

Blog banner

Why Oak Tree Hotel Is Arcadia’s Hidden Gem?

Blog banner

PERT Overview

Blog banner

A BLOG ON MYSQL

Blog banner

INTERNET

Blog banner

LEMON PICKLE (NIMBU KA ACHAR)

Blog banner

Coping with Diagnosis Shock

Blog banner

Vulnerabilities in OnePlus Devices

Blog banner

**THE MUJAWARR: Transforming the Logistics Industry**

Blog banner

?What Children Learn Between Activities: The Hidden Learning Moments in a Preschool Day

Blog banner

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

Blog banner

Linux Threads:

Blog banner

IT Service Continuity Management

Blog banner

File Systems in OS.

Blog banner

Street foods

Blog banner

OS Assignment 3 Deadlock

Blog banner

OPERATING SYSTEM

Blog banner

Video games

Blog banner

Krishna Rao SAP ID--53003230076

Blog banner

BEAUTY IS IN THE EYE OF THE BEHOLDER

Blog banner

Traveling

Blog banner

Getting into anime My anime suggestions

Blog banner

Top 5 Tech Innovations of 2018

Blog banner

IT service level agreement

Blog banner

AI & Data Science in Healthcare – Predicting diseases, medical imaging analysis

Blog banner

Deadlock and Starvation

Blog banner

Functions Of Operating Systems

Blog banner

Simple AI Symptom Diagnosis Using LISP – Rule-Based Expert System

Blog banner

The Memory Hierarchy

Blog banner

Cyber-crime Investigation and Future Directions

Blog banner

virtual memory

Blog banner

Evolution of Operating Systems

Blog banner

How to Manage Business Invoices and Payments Easily?

Blog banner

My First Trek - Sondai, Karjat - Shoaib Malik

Blog banner

Wrike

Blog banner

Types of E-Commerce

Blog banner

Mumbai Metro 3

Blog banner

THE DESIRE OF MANY

Blog banner