wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Concurrency:Deadlock and Starvation

profile
Nihar Kotadia
Aug 13, 2024
0 Likes
0 Discussions
161 Reads

In Operating Systems, concurrency refers to the ability of multiple processes to execute simultaneously, sharing common resources such as CPU time, memory, and I/O devices. However, this concurrency can lead to two major problems: Deadlock and Starvation.

Deadlock:

A deadlock is a situation where two or more processes are blocked indefinitely, each waiting for the other to release a resource. This occurs when the following four conditions are met:

  1. Mutual Exclusion: Two or more processes require exclusive access to a common resource.
  2. Hold and Wait: A process holds a resource and waits for another resource, which is held by another process.
  3. No Preemption: The operating system cannot preempt a process holding a resource.
  4. Circular Wait: A circular chain of processes exists, where each process waits for a resource held by the next process in the chain.

Starvation:

Starvation is a situation where a process is unable to gain access to a shared resource and is indefinitely postponed. This occurs when a process is waiting for a resource that is being held by another process, and the waiting process is not given a chance to execute.

Causes of Starvation:

  1. Priority Scheduling: A process with a lower priority may be starved of CPU time if a higher-priority process is always running.
  2. Resource Constraints: A process may be starved of a resource if another process is holding onto it for an extended period.
  3. Scheduling Algorithms: Certain scheduling algorithms, such as First-Come-First-Served (FCFS), can lead to starvation.

Prevention of Deadlock and Starvation:

To prevent deadlock and starvation, operating systems use various techniques, including:

  1. Resource Ordering: Ordering resources to prevent circular waits.
  2. Banker's Algorithm: A resource allocation algorithm that prevents deadlock.
  3. Priority Ceiling Protocol: A protocol that prevents starvation by assigning a priority ceiling to each resource.
  4. Scheduling Algorithms: Using scheduling algorithms that prevent starvation, such as Round Robin (RR) and Multilevel Feedback Queue (MFQ).

Comments ()


Sign in

Read Next

Threat management

Blog banner

What is 'Multi-core and Multi-threading' ?

Blog banner

TAILS OS

Blog banner

The most common internet security threats

Blog banner

Malware Defense

Blog banner

How Much Protein Do You Really Need Every Day?

Blog banner

Monday. com App

Blog banner

Disk Management

Blog banner

Virtual Memory - Explaination, Working, Steps

Blog banner

computer security

Blog banner

Starting Android Activity Using Intent

Blog banner

Demystifying Cryptography: A Beginner's Guide

Blog banner

A book review

Blog banner

Getting into Anime

Blog banner

I/O Management and Disk Scheduling

Blog banner

Multicore CPUs

Blog banner

Uniprocessor Scheduling

Blog banner

What are the different types of E-mail crime and process of email forensic?

Blog banner

"Audit" In Data Science

Blog banner

BEAUTY IS IN THE EYE OF THE BEHOLDER

Blog banner

undefined

Blog banner

Cyber Attacks -- Trends Patterns and Security Countermeasures

Blog banner

CYBER SECURITY CHALLENGES

Blog banner

Virtualisation

Blog banner

Top 4 Places To Stay In Copenhagen

Blog banner

Linker

Blog banner

BUFFER OVERFLOW_142

Blog banner

Business-to-Business

Blog banner

Linux Threads:

Blog banner

Virtual memory in Operating System

Blog banner

Introduction to GIS

Blog banner

Have You Explored India Yet?

Blog banner

LIFEHACKER

Blog banner

Data Visualization in Decision-Making

Blog banner

Concurrency and memory

Blog banner

Internet of Things and cyber security

Blog banner

From Websites To Super Apps For Digital User Experience

Blog banner

Mendeley (management software)

Blog banner

Service transition principles

Blog banner

Not anti-social, but pro-solitude

Blog banner

You Get Everyone, But No One Gets You: The Lonely Side of High Emotional Intelligence

Blog banner

GUIDE TO GIS

Blog banner