110 likes | 336 Views
CS444/CS544 Operating Systems. Atomic Transactions 3/26/2007 Prof. Searleman jets@clarkson.edu. Outline. Return & discuss Exam#2 Deadlock Atomic Transactions NOTE: Read: Chapter 8 HW#9 posted, Friday, 3/30. Recap: Banker’s Algorithm. If a process requests some resources, determine
E N D
CS444/CS544Operating Systems Atomic Transactions 3/26/2007 Prof. Searleman jets@clarkson.edu
Outline • Return & discuss Exam#2 • Deadlock • Atomic Transactions NOTE: • Read: Chapter 8 • HW#9 posted, Friday, 3/30
Recap:Banker’s Algorithm • If a process requests some resources, determine • are there enough resources currently available? • if so, does it leave the system in a “safe state”?
Recap: Banker’s Algorithm • Note: “unsafe state” ≠ “deadlocked state” p0 can still run, and it might release some resources. Or it might never ask for its maximum demand. But you can’t guarantee that deadlock won’t occur. => Banker’s Algorithm is conservative
Recap: Deadlock detection & recovery • How often to run the detection algorithm? • How often is deadlock likely to occur? • How many processes will be affected? • When CPU utilization drops below X%? • If system detects deadlock, what can it do to break the deadlock? • What do people do after manual detection? • Kill a process (es) • Pi s.t. canFinish[i] == FALSE • Reboot the system
Real life? • Most used prevention technique is resource ordering – reasonable for programmers to attempt • Avoidance and Detection too expensive • Most systems use manual detection and recovery • My process is hung – kill process • My machine is locked up – reboot • Write code that deadlocks and run it on Linux and on Windows – what happens?
Recap: Atomic Transactions • A transaction is a collection of instructions (or operations) that perform a single logical function. • Introduce concept of commit (or save) at the end of a transaction • Until commit, all the individual operations that make up the transaction are pending • At any point before the transaction is committed, it might also be aborted • If a transaction is aborted, the system will undo or rollback the effects of any individual operations which have completed
ACID properties of Transactions • (A)tomicity • Happen as a unit – all of nothing • (C)onsistency • Integrity constraints on data are maintained • (I)solation • Other transactions cannot see or interfere with the intermediate stages of a transaction • (D)urability • Committed changes are reflected in the data permanently even in the face of failures in the system • Atomicity, consistency and isolation are all the result of synchronization among transactions like the synchronization we have been studying between processes
Durability? • How can we guarantee that committed changes are remembered even in the face of failures? • Remembering = saving the data to some kind of storage device
Types of Storage • Volatile Storage • DRAM memory loses its contents when the power is removed • Non-Volatile Storage • Hard disks, floppy disks, CDs, tape drives are all examples of storage that does not lose its contents when power is removed • Stable Storage • Still non-volatile storage can lose its contents (magnets, microwave ovens, sledge hammers,..) • “Stable storage” implies that the data has been backed up to multiple locations such that it is never lost