Optimistic Concurrency Control - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Optimistic Concurrency Control

Description:

If little interference, T's validated successfully and optimistic protocol works ... If any 1 of the previous holds, no interference. Ti validated successfully, ... – PowerPoint PPT presentation

Number of Views:64
Avg rating:3.0/5.0
Slides: 10
Provided by: susanv5
Category:

less

Transcript and Presenter's Notes

Title: Optimistic Concurrency Control


1
  • Optimistic Concurrency Control

2
Optimistic
  • Updates are applied to local copies of the data
    (transaction workspace)
  • If serializability is not violated, transactions
    are committed
  • The DB is updated from local copies
  • Otherwise T is aborted and restarted

3
Validation Concurrency Control Techniques (or
certification)
  • Optimistic (validation) Concurrency Control
    Techniques (or certification)
  • In other concurrency control techniques, checking
    is done to the DB before operations are executed
  • e.g. TO, 2PL
  • In optimistic, checking is done after

4
Optimistic
  • 3 phases
  • R phase - Read items from DB, updates to local
    copies
  • validation phase - check for serializability
  • W phase
  • if validation successful, update DB     else,
    restart transaction

5
Optimistic
  • If little interference, T's validated
    successfully and optimistic protocol works
    well     else lots of interference, so
    optimistic
  • doesnt work well
  • This protocol (there are others) uses TS's and
    W-sets and R-sets
  • R, W sets different from R, W phase

6
Optimistic
  • Validation phase
  • For each Ti ready to commit and in validation
    phase,
  • check for each Tj, committed or in validation
    phase 1)  Tj completes W-phase before Ti starts
    to read 2)  Ti starts W-phase after Tj
    completes W-phase and R-set of Ti has no items in
    common with W-set of Tj 3)  Both R-set and
    W-set of Ti, have no items in common with W-set
    of Tj and Tj completes R-phase before Ti
    completes R-phase

7
Optimistic
  • If any 1 of the previous holds, no interference
  •      Ti validated successfully,      Else Ti
    aborted and restarted later. 
  • Interference may have occurred.

8
Examples
  • Apply optimistic to these schedules
  • R1(X)R2(X)R1(Y)W1(X)R2(Z)C1W2(Y)C2
  • R1(X)R2(X)W1(Y)C1R3(Y)R4(W)W2(Z)C2W3(Z)R4(Y)W4(X)C
    3C4

9
Is Concurrency Control relevant?
  • Check out the Data Concurrency and Consistency
    link for Oracle
  • http//download-west.oracle.com/docs/cd/B10501_01/
    server.920/a96524/c21cnsis.htm2570
Write a Comment
User Comments (0)
About PowerShow.com