The contents of this chapter include all of the following: Discuss the principal requirements for memory management, understand the reason for memory partitioning and explain the various techniques that are used, understand and explain the concept of paging,. | CSC 322 Operating Systems Concepts Lecture - 28: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-6) Silberschatz, Galvin and Gagne 2002, Operating System Concepts, Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 1 Chapter 6 Deadlock Lecture-28 2 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad What is Deadlock? Process Deadlock A process is deadlocked when it is waiting on an event which will never happen System Deadlock A system is deadlocked when one or more processes are deadlocked Lecture-28 3 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 4 The Deadlock: How it happens? A Computing example: Scanned document to be Recorded on CD System has 1 scanner and 1 CD Recorder 2 processes each need both devices. P0 acquires scanner and waits for CD P1 acquires CD and waits for scanner P0 will not release scanner until catch hold the CD P1 will not release CD | CSC 322 Operating Systems Concepts Lecture - 28: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-6) Silberschatz, Galvin and Gagne 2002, Operating System Concepts, Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 1 Chapter 6 Deadlock Lecture-28 2 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad What is Deadlock? Process Deadlock A process is deadlocked when it is waiting on an event which will never happen System Deadlock A system is deadlocked when one or more processes are deadlocked Lecture-28 3 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 4 The Deadlock: How it happens? A Computing example: Scanned document to be Recorded on CD System has 1 scanner and 1 CD Recorder 2 processes each need both devices. P0 acquires scanner and waits for CD P1 acquires CD and waits for scanner P0 will not release scanner until catch hold the CD P1 will not release CD until catch hold the scanner Result: Deadlock Lecture-28 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 04-Jul-13 cs431-cotter 4 How can this happen? Process A Down x Gets x Down y Blocks Process B Down y Gets y Down x Blocks Both are blocked forever! Lecture-28 5 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Preemptable and Non Preemptable Resources Things for which we request exclusive access. Examples: Databases, files, shared memory, printer, cd/dvd writer, tape drive, etc. Types Preemptable – can be taken away w/out ill effects Non preemptable – cannot be take away w/out causing a failure! Lecture-28 6 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Resource examples Memory – preemptable CPU – preemptable CD writing – non preemptable Printing – non preemptable We will only consider non preemptable (the harder problem). Lecture-28 7 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Deadlock caused by Nonpreemptable Resources Sequence of events required to use a resource: Request the .