wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock

profile
Jeet Ved
Aug 15, 2024
0 Likes
0 Discussions
67 Reads

Concurrency in operating systems involves multiple processes or threads executing simultaneously, which can lead to complex interactions. Two common problems that arise in this context are deadlock and starvation. Here’s an overview of both:


1. *Deadlock*


A deadlock occurs when a set of processes or threads become stuck in a situation where each one is waiting for a resource that the others in the set are holding. Since none of them can proceed, they remain in this waiting state indefinitely. Four conditions are necessary for a deadlock to occur:


- *Mutual Exclusion:* At least one resource must be held in a non-sharable mode; only one process can use the resource at any given time.


- *Hold and Wait:* A process holding at least one resource is waiting to acquire additional resources that are currently being held by other processes.


- *No Preemption:* Resources cannot be forcibly taken away from a process; they must be released voluntarily.


- *Circular Wait:* A closed chain of processes exists, where each process holds a resource that the next process in the chain is waiting for.


*Example:* Consider two processes, P1 and P2. P1 holds Resource A and is waiting for Resource B, while P2 holds Resource B and is waiting for Resource A. Neither process can proceed, leading to a deadlock.


 *Deadlock Prevention and Avoidance*


- *Deadlock Prevention:* Modify one of the necessary conditions to ensure that a deadlock cannot occur (e.g., imposing a strict order on resource allocation to prevent circular wait).


- *Deadlock Avoidance:* Use algorithms (e.g., Banker's algorithm) to allocate resources in a way that ensures the system remains in a safe state.


 2. *Starvation*


Starvation, also known as indefinite blocking, occurs when a process is perpetually denied necessary resources because other processes keep gaining access to them first. Unlike deadlock, where processes stop making progress due to being stuck in a cycle, starvation involves one or more processes making no progress because they are continually bypassed.


*Example:* Consider a scheduling system where high-priority processes keep getting resources, and a low-priority process is continually skipped over, leading to starvation.


 *Solutions to Starvation*


- *Aging:* Gradually increase the priority of a waiting process over time to ensure it eventually gets the resources it needs.


- *Fair Scheduling Algorithms:* Use algorithms like round-robin or fair share that ensure all processes eventually receive attention.






Name:Jeet Ved


SAP ID:53003230116


DIV:B


Comments ()


Sign in

Read Next

INTERNET

Blog banner

Palm Vein Biometric Technology; Contactless vein authentication

Blog banner

GOOGLE

Blog banner

Mumbaicha Dabbawalla

Blog banner

Random Forests

Blog banner

Real-Time Operating Systems (RTOS) Deep Explanation

Blog banner

Threads Concurrency: Mutual Exclusion and Synchronization

Blog banner

Life of a 2020-2021 student

Blog banner

Raising Emotionally Intelligent Students: The Classroom Beyond Academics

Blog banner

5 Stages of Digital Marketing

Blog banner

Cache Memory(142)

Blog banner

Session Vulnerabilities

Blog banner

MEMORY MANAGEMENT FILE

Blog banner

The Impact of Tolerances and Wall Thickness on Pipeline Integrity

Blog banner

Topic: Sessions in Operating system

Blog banner

" THE ANSWERS THAT LED INDIAN BEAUTIES TO THE MISS UNIVERSE HISTORIC WIN. "

Blog banner

Reconnaissance

Blog banner

K-means use cases

Blog banner

Instagram Features in 2023 That Will Leave You Stunned!

Blog banner

An Approach To Spyware Detection And Removal

Blog banner

Process, process creation and process termination

Blog banner

Deadlock and starvation

Blog banner

Studying Denial of service attack using DOSHTTP tool

Blog banner

Elements and Principles of Photography

Blog banner

Explain DBMS in Brief

Blog banner

Intrusion Detection System

Blog banner

Software Piracy & Online Data Protection in Digital World

Blog banner

CSI and Organizational Change

Blog banner

RSA (Rivest-Shamir-Adelman) Algorithm

Blog banner

How Puppet Shows and Role Play Teach Empathy to Preschoolers

Blog banner

Having passion in life

Blog banner

Caching windows

Blog banner

GraphQL

Blog banner

Phishing

Blog banner

Multiprocessor and Multicore Organization

Blog banner

GIS Bharat Maps

Blog banner

Paginng In OS

Blog banner

"Mahakali cave"

Blog banner

Zero Trust Security Model: Revolutionizing Cybersecurity in the Digital Age

Blog banner

AN EVENT-BASED DIGITAL FORENSIC INVESTIGATION

Blog banner

The Impact of Cyber Forensics on Corporate Governance and Compliance

Blog banner

Time Series Analysis

Blog banner