Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS444/CS544 Operating Systems Atomic Transactions 3/26/2007 Prof. Searleman

Similar presentations


Presentation on theme: "CS444/CS544 Operating Systems Atomic Transactions 3/26/2007 Prof. Searleman"— Presentation transcript:

1 CS444/CS544 Operating Systems Atomic Transactions 3/26/2007 Prof. Searleman jets@clarkson.edu

2 Outline Return & discuss Exam#2 Deadlock Atomic Transactions NOTE: Read: Chapter 8 HW#9 posted, Friday, 3/30 HW#9

3 Recap: Banker’s Algorithm ResourceABC Total #1057 Available332 Current Allocation ABC p0010 p1200 p2302 p3211 p4002 Still Needs ABC p0743 p1122 p2600 p3011 p4431 Maximum Demand ABC 753 322 902 222 433 If a process requests some resources, determine 1. are there enough resources currently available? 2. if so, does it leave the system in a “safe state”?

4 P1 requests (1, 0, 2). Available (3, 3, 2) AVAILABLEALLOCATION p4 runs & requests (4, 3, 1)(3, 1, 2)p4 has (4, 3, 3) p3 completes & releases all(7, 4, 3) p1 granted (1,0,2)(2, 3, 0)p1 has (1, 1, 2) p1 runs & requests (0,2,0)(2, 1, 0)p1 has (3, 2, 2) p1 completes & releases all(5, 3, 2) p3 runs & requests (0,1,1)(5, 2, 1)p3 has (2, 2, 2)) p4 completes & releases all(7, 4, 5) p0 runs & requests (7, 4, 3)(0, 0, 2)p0 has (7, 5, 3) p0 completes & releases all(7, 5, 5) p2 runs & requests (6, 0, 0)(1, 5, 5)p2 has (9, 0, 2) p2 completes & releases all(10, 5, 7)

5 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

6 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

7 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?

8 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

9 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

10 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

11 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


Download ppt "CS444/CS544 Operating Systems Atomic Transactions 3/26/2007 Prof. Searleman"

Similar presentations


Ads by Google