wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock

profile
Jeet Ved
Aug 15, 2024
0 Likes
0 Discussions
68 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

Deadlock and Starvation

Blog banner

Deadlock

Blog banner

Process Description

Blog banner

Cyber-crime Investigation and Future Directions

Blog banner

Art and Culture of Rajasthan

Blog banner

MySQL

Blog banner

Memory Management

Blog banner

How to use open SSL for web server - browser communication

Blog banner

Zomato's Secret Digital Marketing Techniques!

Blog banner

Data Security must be your Priority!

Blog banner

FILE SHARING

Blog banner

Cloud Computing

Blog banner

Synchronization

Blog banner

Brilliant WhatsApp Features Upcoming in 2023

Blog banner

MUTUAL EXCLUSION

Blog banner

NETWORK SECURITY RISKS

Blog banner

RAID

Blog banner

Data Science in Predictive Analytics: Transforming Business Decision-Making

Blog banner

The Right way of cooking

Blog banner

The Essential Guide to Dynamic Arrays vs. Linked Lists: Which to Use and When ?

Blog banner

What is time ? The term which has astonished Scientists

Blog banner

Protect yourself from System Hacking with these Simple Steps

Blog banner

Things You Should Leave Behind In 2025, Whilst In 2026

Blog banner

Yahoo! mail

Blog banner

Bharat Maps

Blog banner

Distributed Denial of Service (DDoS) attack

Blog banner

Vulnerability Assessment

Blog banner

Smart Homes | Zigbee Alliance

Blog banner

Data Warehouse Bus Matrix

Blog banner

How Cyber Forensics help prevent Crimes

Blog banner

Windows Operating System

Blog banner

MODERN OPERATING SYSTEM

Blog banner

Education: Key to your Prosperity

Blog banner

Email Privacy

Blog banner

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

Blog banner

BUFFER OVERFLOW_142

Blog banner

Memory management

Blog banner

Networking 101: How to Build Meaningful Connections in College

Blog banner

CYBERPEACEKEEPING: NEW WAYS TO PREVENT AND MANAGE CYBERATTACKS

Blog banner

What do you mean by online marketing and why do you need to know about it

Blog banner

DISK SCHEDULING

Blog banner

Why am I never satisfied with my Life?

Blog banner