Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Deadlocks in operating systems

Rating
-
Sold
-
Pages
15
Uploaded on
30-12-2022
Written in
2021/2022

In these notes, Covered all the topics of operating systems briefly. COs - Analyze the structure of OS and basic architectural components involved in OS design. Compare and contrast various CPU scheduling algorithms. Evaluate the requirements for the process synchronization and co-ordination in the contemporary operating system. Analyze various algorithms for memory management, I/O management and security aspects of operating system. Write shell scripts in Unix/Linux O.S and write simple programs using kernel system calls. Also understand virtualization concept

Show more Read less
Institution
Course

Content preview

4 – Deadlocks

(1) What is Deadlock?
Deadlock
• A set of processes is deadlocked if each process in the set is waiting for an event that
only another process in the set can cause.
• Suppose process D holds resource T and process C holds resource U.
• Now process D requests resource U and process C requests resource T but none of
process will get this resource because these resources are already hold by other process
so both can be blocked, with neither one be able to proceed, this situation is called
deadlock.
Example:




Figure 4-1 Resource allocation graphs. (a) Holding a resource. (b) Requesting a
resource. (c) Deadlock.
• As shown in figure 4-1, resource T assigned to process D and resource U is assigned to
process C.
• Process D is requesting / waiting for resource U and process C is requesting / waiting for
resource T.
• Processes C and D are in deadlock over resources T and U.


(2) Explain preemptable and non-preemptable resource with example.
• Resources come in two types: preemptable and non-preemptable.
• A preemptable resource is one that can be taken away from the process holding it with
no ill effects.
• Consider, for example, a system with 32 MB of user memory, one printer, and two 32-

1

, 4 – Deadlocks
MB processes such that each process wants to print something.
• Process A requests and gets the printer, then starts to compute the values to print.
• Before it has finished with the computation, it exceeds its time quantum and is
swapped out.
• Process B now runs and tries, unsuccessfully, to acquire the printer.
• Potentially, we now have a deadlock situation, because A has the printer and B has the
memory, and neither can proceed without the resource held by the other.
• Fortunately, it is possible to preempt (take away) the memory from B by swapping it out
and swapping A in. Now A can run, do its printing, and then release the printer. No
deadlock occurs.
• A non-preemptable resource, in contrast, is one that cannot be taken away from its
current owner without causing the computation to fail.
• If a process has begun to burn a CD-ROM, suddenly taking the CD recorder away from it
and giving it to another process will result in a garbled CD, CD recorders are not
preemptable at an arbitrary moment.
• In general, deadlocks involve non-preemptable resources.


(3) List the conditions that lead to deadlock.
Conditions that lead to deadlock
• There are four conditions that must hold for deadlock:
1) Mutual exclusion condition
▪ Each resource is either currently assigned to exactly one process or is
available.
2) Hold and wait condition
▪ Process currently holding resources granted earlier can request more
resources.
3) No preemption condition
▪ Previously granted resources cannot be forcibly taken away from process.
4) Circular wait condition
▪ There must be a circular chain of 2 or more processes. Each process is waiting
for resource that is held by next member of the chain.
• All four of these conditions must be present for a deadlock to occur.

2

Written for

Institution
Course

Document information

Uploaded on
December 30, 2022
Number of pages
15
Written in
2021/2022
Type
Class notes
Professor(s)
Ymk sir
Contains
All classes

Subjects

$5.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
vaibhav51ppsv2020

Also available in package deal

Get to know the seller

Seller avatar
vaibhav51ppsv2020 C.K.Pithawala school of engineering and techonology
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
14
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions