Concurrency-Control

Concurrency-Control - Concurrency Control Transactions and...

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

View Full Document Right Arrow Icon
Concurrency Control Transactions and Distributed Transactions
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements 1) Exam Thursday 2) Exam review session 3) Homework 1 back 4) dga,vrv out until Thursday
Background image of page 2
Last time: RAID Trade capacity for reliability Throughput growing…delay not
Background image of page 3

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

View Full DocumentRight Arrow Icon
Today: Concurrency control Local concurrency control Transactions Two-phase locking Distributed concurrency control Two-phase commit
Background image of page 4
Transactions Fundamental abstraction to group operations into a single unit of work begin : begins the transaction commit : attempts to complete the transaction rollback / abort : aborts the transaction
Background image of page 5

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

View Full DocumentRight Arrow Icon
ACID properties Atomicity: all or nothing Consistency: guarantee basic properties Isolation: each transaction runs as if alone Durability: cannot be undone
Background image of page 6
The classic debit/credit example bool xfer(Account src, Account dest, long x) { if (src.getBalance() >= x) { src.setBalance(src.getBalance() – x); dest.setBalance(dest.getBalance() + x); return TRUE; } return FALSE; } If not isolated and atomic: might overdraw the src account might “create” or “destroy” money
Background image of page 7

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

View Full DocumentRight Arrow Icon
The classic debit/credit example bool xfer(Account src, Account dest, long x) { Transaction t = begin(); if (src.getBalance() >= x) { src.setBalance(src.getBalance() – x); dest.setBalance(dest.getBalance() + x); return t.commit(); } t.abort(); return FALSE; } Note: the system is allowed to unilaterally abort the transaction itself, when you try to commit!
Background image of page 8
Lost updates Another transaction overwrites your change based on a previous value of some data Inconsistent retrievals You read data that can never occur in a
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/02/2011 for the course CS 440 taught by Professor Anderson during the Spring '11 term at Carnegie Mellon.

Page1 / 28

Concurrency-Control - Concurrency Control Transactions and...

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

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