• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • Tutorial- C/C++
    • Tutorial- Django
    • Tutorial- Git
    • Tutorial- HTML & CSS
    • Tutorial- Java
    • Tutorial- MySQL
    • Tutorial- Python
    • Competitive Coding Challenges
  • CSE Subject
    • (CD) Compiler Design
    • (CN) Computer Network
    • (COA) Computer Organization & Architecture
    • (DBMS) Database Management System
    • (DS) Data Structure
    • (OS) Operating System
    • (ToA) Theory of Automata
    • (WT) Web Technology
  • Interview Questions
    • Interview Questions- Company Wise
    • Interview Questions- Coding Round
    • Interview Questions- Python
    • Interview Questions- REST API
    • Interview Questions- Web Scraping
    • Interview Questions- HR Round
    • Aptitude Preparation Guide
  • GATE 2022
  • Linux
  • Trend
    • Full Stack Development
    • Artificial Intelligence (AI)
    • BigData
    • Cloud Computing
    • Machine Learning (ML)
  • Write for Us
    • Submit Article
    • Submit Source Code or Program
    • Share Your Interview Experience
  • Tools
    • IDE
    • CV Builder
    • Other Tools …
  • Jobs

Difference between Deadlock Prevention and Deadlock Avoidance | OS

Aniruddha Chaudhari/5832/0
CSE SubjectOperating System

The operating system is nothing but the system program which loads into the memory first and then provides the environment for other users program to run their own program.

In this post, we talk about the deadlock in the operating system.

Deadlock prevention in the Operating system is more preventive and conservative.

Let’s atrt with the basics.

What is Deadlock Prevention?

We take care of eliminating any deadlock causing condition:

  1. Circular wait
    Processes form the cycle of waiting for relationships.
  2. Hold and wait
    Processes hold up resources which they have and w8 on resources they want.
  3. No Preemption
    Once, a process is in execution it is not preempted.
  4. Mutual Exclusion
    When a process is executing on a variable no other process can access that variable.

Now for deadlock prevention what we do is don’t let our system to do anyone of this.

What is Deadlock Avoidance?

In this, we look at every single resource request and decide whether to allow that request to process. The action will be taken before occurring deadlock.

Deadlock can be avoided by the Bankers Algorithm. It is a resource allocation algorithm developed and designed by Edsger Dijkstra.

Difference between Deadlock Prevention and Deadlock Avoidance

This is one of the very common deadlock interview questions that has been asked in many interviews.

Many get confused over Deadlock prevention Vs Deadlock Avoidance in the Operating system.

Let’s try to understand it by considering the analogy. It will be easy.

Now take an example of protection from viral through the water. In a scenario like a deadlock prevention, we would not let one drink water. In the scenario of deadlock avoidance, we would first filter out water.

So in clear-cut words, deadlock prevention is more preventive and conservative. Conservative in the way that, it would decrease the power of the system by not allowing mutual exclusion, etc…


Editors’ Note: This article is written and shared by Madhav Purohit. He is alumni of IIT, Kanpur.

deadlock
Aniruddha Chaudhari
I am complete Python Nut, love Linux and vim as an editor. I hold a Master of Computer Science from NIT Trichy. I dabble in C/C++, Java too. I keep sharing my coding knowledge and my own experience on CSEstack.org portal.

Your name can also be listed here. Got a tip? Submit it here to become an CSEstack author.

Leave a Reply Cancel reply

Operating System

OS- Process vs Thread

OS- Deadlock

OS- Deadlock Prevention vs Avoidance

© 2022 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard