wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Deadlock and Starvation

profile
tannie undefined
Aug 13, 2024
0 Likes
0 Discussions
99 Reads

Deadlock and Starvation

 

Introduction:

Deadlock and starvation are the situations where processes are unable to proceed, but they occur in different condition. Deadlock and Starvation are the critical issues related to the process of synchronization in the operating system. Let’s study more about Deadlock and Starvation.

Deadlock:-

A deadlock is the situation in the operating system where the processes become stuck because each process is waiting for resources held by the other process in the same set, which leads to none of the processes can proceed, and they are indefinitely blocked. Deadlock only happens when 4 conditions which are known as coffman’s conditions, are met simultaneously.

1.Mutual Exclusion: Resources cannot be shared by the processes. Only one process can use the resource at the time.

2.Hold and wait : Processes that are already holding resource can request additional resources that are held by other processes.

3. No premmption : Resources cannot be forcefully take away from the process. Resources must be released voluntarily by the process holding them.

4. Circular wait : There is circular chain of the processes where each process is waiting for a resource held by the next process in the chain.

Example: consider there are two processes, p1 and p2 and two resources, r1 and r2 . If p1 holds r1 and p2 requests r2 while p2 holds r2 and requests r1, neither process can proceed, leading to circular chain and deadlock.

Deadlock Handling:

1.    Prevention: By altering the system's resource allocation policy to ensure that at least one of Coffman’s conditions cannot hold.

2.     Avoidance: One can use algorithms like Banker’s algorithm to dynamically examine the allocation of resources to ensure that a deadlock state will not occur.

3.    Detection and Recovery:   By allowing the system to enter a deadlock state and then detecting and recovering from it, often by terminating one or more processes or forcibly taking resources from a process.

4.    Ignoring: Often Referred as the "ostrich algorithm," where the system assumes that deadlock will not occur or occur rarely, and no action is taken.

Starvation :

Starvation is also known as indefinite blocking that occurs when a process is perpetually denied access to the resources it needs to process. Unlike the deadlock, where processes are completely stuck , starvation occurs when a process continuously waits while other processes re repeatedly given preference.

Example: In a system where a high-priority process continuously pre-empts resources, lower-priority might never get resources that they need leading to starvation.

Starvation handling:

1.    Priority Inheritance : By temporarily raising the priority of the process holding the resources needed by a higer-priority process.

2.    Aging: Gradually increasing the priority of waiting process to ensure they eventually acquire the necessary resources.

3.    Fair scheduling: by ensuring all the processes get the chance to execute by using algorithms like round-robin scheduling.


Comments ()


Sign in

Read Next

What is a geographic information system (GIS)?

Blog banner

Session Hijacking Techniques

Blog banner

How to Encrypt and Decrypt Using GNU PGP

Blog banner

Remote Work in 2026

Blog banner

Junk food vs healthy food

Blog banner

How Music Helps Children Develop Memory, Rhythm, and Language

Blog banner

Tomato Butter Sauce with Bucatini

Blog banner

How Laughing Gas Makes Your Dental Visit So Much Easier

Blog banner

Benefits and drawback of web security.

Blog banner

Deadlock

Blog banner

LISP - Library Management System

Blog banner

How Does Preschool Help Children Become Better Decision Makers?

Blog banner

Navigation With Indian Constellation(NavIC) by ISRO in Geographic Information Systems

Blog banner

From Model Mistakes to Metrics

Blog banner

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

Blog banner

MailChimp

Blog banner

Objectives and Functions of Operating System

Blog banner

Ransomware

Blog banner

Deadlock and starvation

Blog banner

Studying Denial of service attack using DOSHTTP tool

Blog banner

Webmail

Blog banner

child Labour

Blog banner

Google

Blog banner

10 Alien Encounters and Abduction Stories

Blog banner

Different Types of Data

Blog banner

Steps to create an Ubuntu EC2 Instance with GUI in AWS

Blog banner

Top 5 Post-Wedding Skin Care Tips

Blog banner

OS PROCESS DESCRIPTION AND CONTROL-SARVAGYA JALAN

Blog banner

What your Favorite colour says about You?

Blog banner

Pioneer Park Zolfo Springs — A Hidden Gem for Nature Lovers Near Arcadia

Blog banner

?What Your Dentist Notices The Moment You Sit In The Chair

Blog banner

Uniprocessor scheduling

Blog banner

A small world of Sockets

Blog banner

The End of “Aaj Khane Mein Kya Banega?”: How a Daily Tiffin Service Simplifies Your Life

Blog banner

Virtual Machine

Blog banner

Digital black market or dark net poses a national security threat?

Blog banner

Policies for Service Transition

Blog banner

MODERN OPERATING SYSTEM

Blog banner

Patola Outfits for the Modern Wardrobe: Reviving Indian Handloom in Style

Blog banner

The seven-step improvement process

Blog banner

(Input/Output) in os

Blog banner

A Weekend at Oak Tree Hotel: The Best Hotel Experience in Arcadia, Florida

Blog banner