tailieunhanh - Lecture Operating system concepts - Lecture 25

This chapter examines two problems that plague all efforts to support concurrent processing: deadlock and starvation. We begin with a discussion of the underlying principles of deadlock and the related problem of starvation. Then we examine the three common approaches to dealing with deadlock: prevention, detection, and avoidance. | CSC 322 Operating Systems Concepts Lecture - 27: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-5) Silberschatz, Galvin and Gagne 2002, Operating System Concepts, Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 1 Chapter 5 Input/ Output Hardware Magnetic Disk CD/ CD-ROM /DVD Lecture-27 2 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Stable Storage RAIDS can protect against sectors going bad Can’t protect against write operations spitting out garbage or crashes during writes Stable storage: either correct data is laid down or old data remains in place Necessary for some apps-data can’t be lost or go bad Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Assumptions Can detect a bad write on subsequent reads via ECC (Error Correction Code) Probability of having bad data in sector on two different disks is negligible If CPU fails, it stops along with any write in progress at the time. Bad data can be detected . | CSC 322 Operating Systems Concepts Lecture - 27: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-5) Silberschatz, Galvin and Gagne 2002, Operating System Concepts, Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad 1 Chapter 5 Input/ Output Hardware Magnetic Disk CD/ CD-ROM /DVD Lecture-27 2 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Stable Storage RAIDS can protect against sectors going bad Can’t protect against write operations spitting out garbage or crashes during writes Stable storage: either correct data is laid down or old data remains in place Necessary for some apps-data can’t be lost or go bad Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad Assumptions Can detect a bad write on subsequent reads via ECC (Error Correction Code) Probability of having bad data in sector on two different disks is negligible If CPU fails, it stops along with any write in progress at the time. Bad data can be detected later via ECC during read operation Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad The idea and the operations Use 2 identical disks-do the same thing to both disks Use 3 operations Stable writ First write, then read back and compare. If they are the same write to second disk. If write fails, try up to n times to get it to succeed. After n failures keep using spare sectors until it succeeds. Then go to disk 2. Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad The idea and the OPS Stable read read from disk 1 n times until get a good ECC, otherwise read from disk 2 (assumption that probability of both sectors being bad is negligible) Crash recovery read both copies of blocks and compare them. If one block has an ECC error, overwrite it with the good block. If both pass the ECC test, then pick either Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad (a) Crash happens before write (b) Crash happens during write to 1 (c) Crash happens after 1 but before 2 (d) During 2, after 1 (e) Both are the .