Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

Mahakal Institute Of Technology & Management Ujjain

Submitted to :
Submitted by :
prof. Balram Yadav
Pandey
(Lecturer)

Deadlock And Disk Scheduling


Anand

Contents :

Deadlock : Introduction
Deadlock : Conditions
Resource-Allocation Graph
Deadlock States
Deadlock Handling
Deadlock Prevention

Contents :

Deadlock Avoidance
Deadlock Detection
Disk Scheduling : Terminologies
Moving-head Disk Mechanism
Scheduling Algorithms
First Come First Served (FCFS)

Contents :

Shortest Seek Time First (SSTF)


SCAN
C-SCAN
C-LOOK

Deadlock : Introduction
A deadlock consists of a set of blocked processes,
each holding a resource and waiting to acquire a
resource held by another process in the set.
Processe
s:
P1 and
P2

Resource
s:
R1 and
R2

Deadlock : Conditions
Deadlock can arise if four conditions hold
simultaneously :

Mutual Exclusion
Hold and Wait
No Preemption
Circular Wait

Resource-Allocation Graph
If the resource
allocation
graph contains
no cycles no
deadlock.

Deadlock States
If a system
is in safe
state no
deadlock
exists

Deadlock Handling
Prevention
Ensure that the system will never enter a deadlock state
Avoidance
Ensure that the system will never enter an unsafe state
Detection
Allow the system to enter a deadlock state and then
recover.

Deadlock Prevention
Deadlock can be prevented by ensuring that at least
one of the conditions of deadlock cant hold, i.e.

Mutual Exclusion
Hold and wait
No Preemption
Circular Wait

Deadlock Avoidance
Deadlock avoidance requires additional information about
how the resources will be requested.

For a single instance of a resource type, we use a resourceallocation graph Algorithm.

For multiple instances of a resource type, we use the


Bankers algorithm.

Deadlock Detection
For deadlock detection, the system must provide :
An algorithm that examines the state of the system to detect
whether a deadlock has occurred.
And an algorithm to recover from the deadlock.

Disk Scheduling : Terminologies


Sector : It is the smallest block, that can be read or

written on a disk.
Track : It is the collection of sectors all on some
circumference on a single surface.
Cylinder : It is collection of all tracks of same radius on a
multiplatter disk.
Seek Time : It is the time for read/write head to find the
desired cylinder.
Latency Time : It is the time for disk rotate to the start of
the desired sector.

Moving-head Disk Mechanism

Scheduling Algorithms
Several algorithms exist to schedule the servicing
of

disk I/O requests :


First Come First Served (FCFS).
Shortest Seek Time First (SSTF).
SCAN
C-SCAN
C-LOOK

First Come First Served (FCFS)

Shortest Seek Time First (SSTF)

SCAN

C-SCAN

C-LOOK

References :
www.google.com
www.Wikipedia.com
Operating System Concepts : Siberschatz, Galvin
and Gagne

You might also like