Since 3 pretend to allocate requested resources to pi

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: nd to allocate requested resources to Pi by modifying the Pretend state as follows: state Available = Available – Request; Allocationi = Allocationi + Requesti; Allocation Request Needi = Needi – Requesti; Request q q Deadlocks If safe ⇒ the resources are allocated to Pi. If If unsafe ⇒ Pi must wait, and the old resource-allocation state is If restored restored Example of Banker’s Algorithm Deadlocks 5 processes P0 through P4; processes 3 resource types: resource A (10 instances), B (5instances), and C (7 instances). Snapshot at time T0: Snapshot Allocation Max Available ABC ABC ABC P0 0 1 0 753 332 P1 2 0 0 322 P2 3 0 2 902 P3 2 1 1 222 P4 0 0 2 433 Example (Cont.) The content of the matrix Need is defined to be The Need Max – Allocation. Max Allocation P0 P1 P2 P3 P4 Deadlocks Need ABC 743 122 600 011 431 The system is in a safe state since the sequence The < P1, P3, P4, P2, P0> satisfies safety criteria. satisfies Example: P1 Request (1,0,2) Example: Deadlocks Check that Request ≤ Available (that is, (1,0,2) ≤ (3,3,2) Check ⇒ true. Alloc...
View Full Document

This document was uploaded on 10/07/2013.

Ask a homework question - tutors are online