3925_n_15724 - Tutorial 10 Concurrency Deadlock SEG3460A/B...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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: Tutorial 10. Concurrency: Deadlock SEG3460A/B: Computer Processing Concepts November 18, 2002 Gao Wei Outline Principles of deadlock Summary of three approaches Overview of deadlock prevention Deadlock avoidance Process initiation denial Resource allocation denial(bankers algorithm) Deadlock detection Principles of deadlock Process P Get A Get B Release A Release B Process Q Get B Get A Release B Release A Principles of deadlock(contd) Progress of Q Deadlock inevitable 2 Get A Get B Release A Release B Get B Get A Release B Release A 1 P and Q want A 3 P and Q want B 5 4 6 Progress of P Principles of deadlock(contd) 1. Q acquires B then A and then release B and A. When P resumes execution, it will be able to acquire both resources. 2. Q acquires B and then A. P executes and blocks on a request for A. Q releases B and A. When P resumes execution, it will be able to acquire both resources. 3. Q acquires B and then P acquires A. Deadlock is inevitable, because as execution proceeds Q will block on A and P will block B. 4. P acquires A and then Q acquires B. Deadlock is inevitable, because as execution proceeds Q will block on A and P will block B. 5. P acquires A and then B. Q executes and blocks on a request for B. P releases A and B. When Q resumes execution, it will be able to acquire both resources. 6. P acquires A and then B and then release A and B. When Q resumes execution, it will be able to acquire both resources. Principles of deadlock(contd) The conditions for deadlock: 1. Mutual exclusion : Only one process may use a resource at a time. 2. Hold and wait : A process may hold allocated resources while waiting assignment of others. 3. No preemption : No resource can be forcibly removed from a process holding it. 4. Circular wait : A closed chain of processes exists such that each process holds at least on resource needed by the next process in the chain . z The first three are necessary but not sufficient for a deadlock. The last is a potential consequence of the first three. The four are necessary and sufficient conditions for a deadlock. Principles of deadlock(contd) Three deadlock handling approaches Inherent preemption losses Never delays process initiation Facilitates online handling Invoke periodically to test for deadlock Very liberal; requested...
View Full Document

{[ snackBarMessage ]}

Page1 / 20

3925_n_15724 - Tutorial 10 Concurrency Deadlock SEG3460A/B...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online