0% found this document useful (0 votes)
11 views

GROUP 1 Assignment

This literature review discusses deadlocks in operating systems, outlining their causes, handling methods, prevention, detection, and recovery. Deadlocks occur when processes are blocked due to resource contention, and can be managed through prevention strategies, avoidance algorithms like the Banker’s algorithm, and detection mechanisms. Recovery from deadlocks can involve preempting resources or rolling back to a safe state to restore functionality.

Uploaded by

onyabukoizac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

GROUP 1 Assignment

This literature review discusses deadlocks in operating systems, outlining their causes, handling methods, prevention, detection, and recovery. Deadlocks occur when processes are blocked due to resource contention, and can be managed through prevention strategies, avoidance algorithms like the Banker’s algorithm, and detection mechanisms. Recovery from deadlocks can involve preempting resources or rolling back to a safe state to restore functionality.

Uploaded by

onyabukoizac
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

FACULTY OF TECHNOSCIENCE

DEPARTMENT OF COMPUTER AND INFORMATION SCIENCE

COURSE UNIT: OPERATING SYSTEMS


CSM 3131
GROUP 1.
ONYABUKO ISAAC - 2201200205
CALVIN DEUKE - 2201200214
OYARA WASHINGTON - 2201200210
A LITERATURE REVIEW ON DEADLOCKS IN OPERATING SYSTEMS

1. Introduction.
Deadlocks are a set of blocked processes each holding a resource and waiting to acquire a
resource held by another process in the set.(Operating System Concepts 9th Edition by
Abraham Silberschatz.Pdf - Google Drive, n.d.). It’s a very crucial issue in operating
systems since systems consist of a finite number of resources like CPU cycles, memory
space, I/O devices, files to be distributed among a number of competing threads.
This literature review aims at diving into exploring the causes, methods of handling,
prevention, detection of deadlocks and lastly recovery from deadlocks.

2. Causes of deadlocks.
Deadlock can arise if four conditions hold simultaneously.
 Mutual exclusion: only one process at a time can use a resource
 Hold and wait: a process holding at least one resource is waiting to acquire
additional resources held by other processes
 No preemption: a resource can be released only voluntarily by the process holding
it, after that process has completed its task
 Circular wait: there exists a set {P0, P1, …, Pn} of waiting processes such that P0 is
waiting for a resource that is held by P1, P1 is waiting for a resource that is held by P2,
…, Pn–1 is waiting for a resource that is held by Pn, and Pn is waiting for a resource
that is held by P0.
Deadlocks can be described more precisely in terms of a directed graph called a system
resource-allocation graph

3. Methods for Handling Deadlocks.


Deadlock handling can be done in three ways;
• We can ignore the problem altogether and pretend that deadlocks never occur in the
system. It’s used by most operating systems, including Linux and windows.
• We can use a protocol or algorithms to prevent or avoid deadlocks, ensuring that the
system will never enter a deadlocked state.
• We can allow the system to enter a deadlocked state, detect it, and recover.
To ensure that the system will never enter a deadlock state, the system can use either of
the following schemes.
 Deadlock prevention
 Deadlock avoidance
4. Deadlock Prevention.
It provides a set of methods to ensure that at least one of the necessary conditions (mutual
exclusion, hold & wait, no pre-emption, circular wait) cannot hold. These methods prevent
deadlocks by constraining how requests for resources can be made. This can be achieved
through the following ways.
Mutual Exclusion – ensure that sharable resources do not require mutually exclusive access
and thus cannot be involved in a deadlock. For example, a read-only file is a sharable
resource. If several threads attempt to open a read-only file at the same time, they can be
granted simultaneous access to the file thus no deadlock occurrence.
Hold and Wait – must guarantee that whenever a process requests a resource, it does not hold
any other resources. Require process to request and be allocated all its resources before it
begins execution, or allow process to request resources only when the process has none
allocated to it.
No Pre-emption – If a process that is holding some resources requests another resource that
cannot be immediately allocated to it, then all resources currently being held are released.
Pre-empted resources are added to the list of resources for which the process is waiting
Process will be restarted only when it can regain its old resources, as well as the new ones
that it is requesting.

Circular Wait – impose a total ordering of all resource types, and require that each process
requests resources in an increasing order of enumeration

5. Deadlock Avoidance
A deadlock avoidance policy grants a resource request only if it can establish that granting
the request cannot lead to a deadlock either immediately or in the future.(Deadlock
Prevention And Avoidance - GeeksforGeeks, n.d.)
The kernel lacks detailed knowledge about future behaviour of processes, so it cannot
accurately predict deadlocks. Therefore, this requires that the operating system be given
additional information in advance concerning which resources a thread will request and use
during its lifetime. With this additional knowledge, the operating system can decide for each
request whether or not the thread should wait.
Simplest and most useful model requires that each process declare the maximum number of
resources of each type that it may need before they are allocated. This is achieved using
Banker’s algorithm.
The Banker’s Algorithm is a resource allocation and deadlock avoidance algorithm that tests
for safety by simulating the allocation for the predetermined maximum possible amounts of
all resources, then makes an “s-state” check to test for possible activities, before deciding
whether allocation should be allowed to continue.(Banker’s Algorithm in Operating System -
GeeksforGeeks, n.d.)
6. Deadlock Detection.
Deadlock detection is a process in computing where the system checks if there are any sets of
processes that are stuck waiting for each other indefinitely, preventing them from moving
forward. (Introduction of Deadlock in Operating System - GeeksforGeeks, n.d.)
Deadlock Detection and Recovery is the mechanism of detecting and resolving deadlocks in
an operating system (Deadlock Prevention And Avoidance - GeeksforGeeks, n.d.)
Detection methods help identify when deadlocks happen, and recovery techniques are used to
resolve these issues and restore system functionality. This ensures that computers and devices
can continue working without interruptions caused by deadlock situations.
The OS periodically checks the system for any deadlock. In case, it finds any of the deadlock
then the OS will recover the system using some recovery techniques.
The main task of the OS is detecting the deadlocks. The OS can detect the deadlocks with the
help of Resource allocation graph. In single instanced resource types, if a cycle is being
formed in the system, then there will definitely be a deadlock. On the other hand, in multiple
instanced resource type graph, detecting a cycle is not just enough. We have to apply the
safety algorithm on the system by converting the resource allocation graph into the allocation
matrix and request matrix.
Wait-For Graph Algorithm
The Wait-For Graph Algorithm is a deadlock detection algorithm used to detect deadlocks in
a system where resources can have multiple instances. The algorithm works by constructing a
Wait-For Graph, which is a directed graph that represents the dependencies between
processes and resources.

7. Recovery from Deadlock


When a detection algorithm determines that a deadlock exists, several alternatives are
available. One possibility is to inform the operator that a deadlock has occurred and to let the
operator deal with the deadlock manually. Another possibility is to let the system recover
from the deadlock automatically.
In order to recover the system from deadlocks, either OS considers resources or processes.
For resources:
 Pre-empt the resource
We can snatch one of the resources from the owner of the resource (process) and give
it to the other process with the expectation that it will complete the execution and will
release this resource sooner. Well, choosing a resource which will be snatched is
going to be a bit difficult.
 Rollback to a safe state
System passes through various states to get into the deadlock state. The operating
system can rollback the system to the previous safe state. For this purpose, OS needs
to implement check pointing at every state.
8. Conclusion.
In conclusion, deadlocks result when two processes are requesting for resources that are
being held other processes causing each of them to go to wait state. Deadlocks occur when the
conditions (mutual exclusion, hold and wait, circular wait and no pre-emption) are held
simultaneously.

To ensure the system never enters a deadlock state, we employ deadlock prevention and
deadlock avoidance. Occasional the system checks for any deadlocks. If found, the
system can either pre-empt the resource or rollback to the safe state.

9. REFERENCES
Banker’s Algorithm in Operating System - GeeksforGeeks. (n.d.). Retrieved October 19,
2024, from https://www.geeksforgeeks.org/bankers-algorithm-in-operating-system-2/
Deadlock Prevention And Avoidance - GeeksforGeeks. (n.d.). Retrieved October 19, 2024,
from https://www.geeksforgeeks.org/deadlock-prevention/
Introduction of Deadlock in Operating System - GeeksforGeeks. (n.d.). Retrieved October 5,
2024, from https://www.geeksforgeeks.org/introduction-of-deadlock-in-operating-
system/
Operating System Concepts 9th Edition by Abraham Silberschatz.pdf - Google Drive. (n.d.).
Retrieved October 5, 2024, from https://drive.google.com/file/d/0B_YRww-
7bRxjMVZibkZ5N01wcE0/preview?resourcekey=0-eMirl5uoYyVldescnTN2AQ

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy