Lec15 - 3/27/08 Concurrency Control Goal: Allow several...

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

View Full Document Right Arrow Icon
3/27/08 1 Computer Science Lecture 15, page 1 CS677: Distributed OS Concurrency Control Goal: Allow several transactions to be executing simultaneously such that Collection of manipulated data item is left in a consistent state Achieve consistency by ensuring data items are accessed in an specific order Final result should be same as if each transaction ran sequentially Concurrency control can implemented in a layered fashion Computer Science Lecture 15, page 2 CS677: Distributed OS Optimistic Concurrency Control Transaction does what it wants and validates changes prior to commit Check if files/objects have been changed by committed transactions since they were opened Insight: conflicts are rare, so works well most of the time Works well with private workspaces Advantage: Deadlock free Maximum parallelism Disadvantage: Rerun transaction if aborts Probability of conflict rises substantially at high loads Not used widely
Background image of page 1

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

View Full DocumentRight Arrow Icon
3/27/08 2 Computer Science Lecture 15, page 3 CS677: Distributed OS Two-phase Locking Widely used concurrency control technique Scheduler acquires all necessary locks in growing phase, releases locks in shrinking phase Check if operation on data item x conflicts with existing locks If so, delay transaction. If not, grant a lock on x Never release a lock until data manager finishes operation on x One a lock is released, no further locks can be granted Problem: deadlock possible Example: acquiring two locks in different order Distributed 2PL versus centralized 2PL Computer Science Lecture 15, page 4 CS677: Distributed OS Two-Phase Locking Two-phase locking.
Background image of page 2
3/27/08 3 Computer Science Lecture 15, page 5 CS677: Distributed OS Strict Two-Phase Locking Strict two-phase locking. Computer Science Lecture 15, page 6 CS677: Distributed OS Timestamp-based Concurrency Control Each transaction Ti is given timestamp ts(Ti) If Ti wants to do an operation that conflicts with Tj Abort Ti if ts(Ti) < ts(Tj) When a transaction aborts, it must restart with a new (larger) time stamp Two values for each data item x Max-rts(x): max time stamp of a transaction that read x Max-wts(x): max time stamp of a transaction that wrote x
Background image of page 3

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

View Full DocumentRight Arrow Icon
3/27/08 4 Computer Science Lecture 15, page 7 CS677: Distributed OS Reads and Writes using Timestamps Read i (x) If ts(T i ) < max-wts(x) then Abort T i Else Perform R i (x) Max-rts(x) = max( max-rts(x), ts(T i )) Write i (x) If ts(T i )<max-rts(x) or ts(T i )<max-wts(x) then Abort T i Else Perform W i (x) Max-wts(x) = ts(T i ) Computer Science Lecture 15, page 8 CS677: Distributed OS Pessimistic Timestamp Ordering Concurrency control using timestamps.
Background image of page 4
3/27/08 5 Computer Science Lecture 15, page 9 CS677: Distributed OS Consistency and Replication Today: Consistency models Data-centric consistency models Client-centric consistency models Computer Science
Background image of page 5

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

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

Page1 / 14

Lec15 - 3/27/08 Concurrency Control Goal: Allow several...

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

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