Deadlock Detection Algorithm1 - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Deadlock Detection Algorithm1

Description:

10/13/09. PSD Deadlock_ Avoidance. 1. Deadlock Detection Algorithm-1. Inputs : ... Main Memory Prevention by Preemption ( Handled by Virtual Memory ) ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 7
Provided by: parthasa
Category:

less

Transcript and Presenter's Notes

Title: Deadlock Detection Algorithm1


1
Deadlock Detection Algorithm-1
  • Inputs
  • N Number of Processes
  • M Number of Resource Classes
  • Blocked Set of Processes
  • READY Set of Processes
  • unsigned int Free_Resources M // Each
    Integer ? Number of Instances / Resource
  • unsigned int Allocation N M // Current
    Allocation Status
  • unsigned int Requested_Resources N,M
  • Finished Set of Processes

2
Deadlock Detection Algorithm-2
  • 1. repeat until Set Running is Empty
  • (a) Select a Process Pj from the Set READY
  • (b) Delete Pj from Set READY and add it to
    Set Finished
  • ( c) for (k 1 k lt M k)
  • Free_Resources k ? Free_Resources k

  • Allocation j ,k
  • (d) while Blocked contains a Process Pl
    such that
  • for (k 1 k lt M k)
  • Requested_Resources l ,k lt
    Free_Resources k

3
Deadlock Detection Algorithm-3
  • (i) for (k 1 k lt M k)
  • Free_Resources k ? Free_Resources k
  • - Requested_Resources l,
    k
  • Allocation l, k ? Allocation l , k
  • Requested_ Resources I ,
    k
  • (ii) Delete Pl from the Set Blocked and Add it
    to Set READY
  • 2. if Set Blocked is NOT Empty then
  • Declare Processes in the Set Blocked
    to be Deadlocked.

4
Recovery from Deadlock situation - 1
  • Abort all processes. Extreme Case.
  • Back up all deadlocked processes up to certain
    predefined checkpoint restart
  • Involves too much overhead.
  • Successively preempt occupied resources
    forcibly. Not always possible.

5
Recovery from Deadlock situation - 2
  • Successively abort deadlocked processes based on
    any of the following criteria Mostly used.
  • Lowest Priority.
  • Least number of resources used.
  • Least CPU time consumed.
  • Least Output generated.
  • Most estimated time left.

6
Deadlock Handling Techniques Practical usage
  • Resource Type Technique Used
  • Disk Swap Space Prevention
    / Avoidance
  • --------------------------------------------------
    ------------------------------
  • Main Memory Prevention
    by Preemption
  • (
    Handled by Virtual Memory )
  • --------------------------------------------------
    ---------------------------
  • Peripherals
    Prevention by Ordering
  • --------------------------------------------------
    ---------------------------
  • Consumable Detect
    Recover by

  • successively aborting

  • processes
Write a Comment
User Comments (0)
About PowerShow.com