wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

Concurrency and Deadlocks

profile
Akshat Gohil
Aug 12, 2024
0 Likes
0 Discussions
155 Reads

Concurrency:

Concurrency refers to the ability of the Operating Systems to execute multiple of processes or threads simultaneously for making efficient usage of CPU time/resources.

Processes are nothing but an instance of a program that is running with its own memory space.

 

OSes uses Context Switching mechanism to implement concurrency. It is the process of saving the current state of a currently executing process or thread and restoring other process or thread. This allows OS to switch between tasks giving an illusion of simultaneous execution.

Concurrency in OS leads to problems like Deadlock and Starvation.

 

Deadlock:

A deadlock is a situation when two are more processes are unable to proceed because each process is waiting for other to release a resource. This leads to a state where none of the processes can continue and they’re stuck indefinitely.

Deadlocks occur when several conditions are met simultaneously:

Mutual Exclusion: Resources are not shared and can be allocated to only one process at a time.

Hold and Wait: A process holding particular resources can request additional resources without releasing currently held.

No Preemption: Resources cannot be taken forcibly from resources and they must be freed simultaneously.

Circular Chain: A circular chain of process where processes wait for other to release resources held by them.

 

Deadlock Prevention:

Deadlock prevention ensures that at least one of the four conditions will not come true and will not lead to a deadlock from occurring.

Prevent Mutual Exclusion: Design systems where minimum number of resources are non-shareable, or convert non-shareable resources to shareable ones if possible reducing the probability of having deadlock.

Prevent Hold and Wait: Processes should request all the necessary resources before execution. If all resources not available it waits for them.

 

Prevent No Preemption: Allow pre-emption of resources where necessary to break deadlock conditions. If P2 needs a resource that P1 holds, P1 is forced to release its resource and wait until both resources are available. The system preempts P1, breaking the deadlock condition.

 

Prevent Circular Wait: Give each resource a unique priority. A process can only request resources in increasing order of their priority. This ensures there is always a linear dependency preventing circular wait.

 

Deadlock Avoidance:

Deadlock Avoidance dynamically decisions are made whether the granting the resource will potentially lead a deadlock.

A process is not granted a resource if it might lead to a deadlock.

Deadlock avoidance allows processes to request resources that prevents the system from entering a deadlock.

 

 

 

 

 

­­­­­­­

 


Comments ()


Sign in

Read Next

Threads in OS

Blog banner

Importance of business process documentation

Blog banner

Tea, Coffee, Red Wine, and Teeth: A Stain Survival Guide

Blog banner

RAID and It's Levels

Blog banner

Service Strategy In ITSM

Blog banner

File system

Blog banner

The Impact of Cyber Forensics on Corporate Governance and Compliance

Blog banner

(Input/Output) in os

Blog banner

1.1 basic elements

Blog banner

Capacity management in ITSM

Blog banner

From Canoeing to Camping: The Perfect Nature Escape Near Arcadia

Blog banner

Deadlock and Starvation

Blog banner

Starting Android Activity Using Intent

Blog banner

Boxing

Blog banner

Telegram and it's features

Blog banner

Cyber Security in Data Breaching

Blog banner

What is Virtual Memory

Blog banner

India Digital Personal Data Protection Act, 2023

Blog banner

Embracing the power of Modern Machine UNIX

Blog banner

What are Virtual Machines

Blog banner

Crypto tax evasion

Blog banner

Data Acquisition in Cyber Forensics

Blog banner

Image Steganalysis in Digital Forensics

Blog banner

The Everyday Parenting Dilemma: Safety Vs Independence

Blog banner

What's Better : Supervised or Unsupervised Learning

Blog banner

What Makes Traditional God Keri Aachar So Special?

Blog banner

Fun Christmas Activities For Toddlers & Kids

Blog banner

History of ITIL

Blog banner

Operating system evolution

Blog banner

Electronic Evidence in Cyber Forensics

Blog banner

Paid Email

Blog banner

ROLE OF THE COMPUTER FORENSICS TOOLS AND TECHNIQUES

Blog banner

Toothache at night? What does this mean, and how to cope with it?

Blog banner

Data Visualization in Decision-Making

Blog banner

10 Problems you face if you are an Otaku

Blog banner

Im Photographer

Blog banner

Pro-Tips On How To Keep your Foot Healthy

Blog banner

Kernel in Operating System

Blog banner

Best Time to Visit Arcadia, Florida & Why Oak Tree Hotel Is Always Ready

Blog banner

Multicore and Multithreading

Blog banner

Travel: Everything Everywhere!

Blog banner

Session Vulnerabilities

Blog banner