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

Jamming Attacks in Network Security: Disrupting Communication Signals

Blog banner

PYTHON

Blog banner

Cross site scripting Attack

Blog banner

Objectives and Functions of Operating System

Blog banner

Buffering

Blog banner

Theads

Blog banner

Rock, Paper, Scissors Game in Common Lisp

Blog banner

Uniprocessor scheduling

Blog banner

evolution of operating system - Disha Parekh

Blog banner

Health and fitness

Blog banner

Service Design Model

Blog banner

1.1 basic elements

Blog banner

IT RISK

Blog banner

AI and Data Science: Revolutionizing Industries

Blog banner

Big Data

Blog banner

Virtual machine

Blog banner

Zero-Day Attack

Blog banner

Sleep Matters: The Science Behind Toddler Naps

Blog banner

Process and Threading

Blog banner

Why Friendship at Work is Important

Blog banner

DEVELOPMENTS LEADING TO MODERN OPERATING SYSTEMS

Blog banner

**THE MUJAWARR: Transforming the Logistics Industry**

Blog banner

A-B-C of Networking: Part-3 (Topology [Ring, Tree, Mesh])

Blog banner

What Is Experiential Learning and Why Does It Work Better Than Rote Learning?

Blog banner

LIMITED EDITION

Blog banner

Data Security and Data Privacy in Data Science

Blog banner

Social Engineering Attacks

Blog banner

TRELLO

Blog banner

Zero-Click Searches: How To Stay Visible In Google’s New Era

Blog banner

Memory management

Blog banner

gis substation

Blog banner

TRAIN TRAVELING

Blog banner

Models of Information Security.

Blog banner

Personalized Movie Recommendations with Data Science

Blog banner

Explain website hacking issues

Blog banner

Jira Software

Blog banner

Rules and Regulations of Networking: "Standards and Protocols" - Part 1

Blog banner

VIRTUAL MACHINE

Blog banner

BITCOIN WALLET

Blog banner

Data Lake

Blog banner

Modern Operating System

Blog banner

FIREWALL

Blog banner