Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

ON OPTIMISTIC METHODS

FOR CONCURRENCY
CONTROL
Authors: H.T. KUNG and JOHN T. ROBINSON

Presented by : JOHN REI PESIGAN


INTRODUCTION

 What is Concurrency Control?


 There are two general approaches to concurrency control: locking and backup.
 This paper investigates solutions to concurrency control relying almost entirely on a
backup mechanism
 The authors identified a number of inherent disadvantages of locking and proposes an
optimistic approach
FOCUS OF THIS PAPER

TRANSACTION
LOCKING BACKUP

IDENTIFY AN “OPTIMISTIC”
DISADVANTAGES METHODOLOGY

AVOIDS PITFALLS
OF LOCKING
INHERENT TRADE-OFFS OF LOCKING

 Lock maintenance represents overhead


 Impact on concurrency
 Locks cannot be released until the end of the transaction
 Deadlocks can occur
 Locking may be necessary only in the worst case
PRINCIPLE OF OPTIMISM

“methods used are optimistic in the sense that they rely mainly on transaction backup ;
hoping that conflicts between transactions will not occur”

General Cases:

 Very high total number of resources compared to those being accessed


 Probability of modifying a congested resource is less
 Access conflicts will not happen among transactions
TRANSACTIONS : THREE PHASES

READ Unrestricted – not a “modify” and cannot affect database integrity

VALIDATION Determines if transactions cause any loss of integrity

WRITE Write on database happens only if validation succeeds


TRANSACTIONS : THREE PHASES

READ WRITE
• Create local copies • Make local copies global

VALIDATION
• Ensure database consistency
SERIAL EQUIVALENCE

 n transactions concurrently access a database resource


 Two instances of transaction interleaving

 Same effect on database as if all transactions ran after the other


VALIDATION OF SERIAL EQUIVALENCE
 Explicitly assigns each transaction a Transaction Number , t(i), at the end of the read
phase
 Transaction numbers are assigned in order, If the transaction is validated and
completes successfully, it retains this number
 If it fails the validation checks and is aborted, or if the transaction is read-only, the
number is released for reassignment
 Transaction numbers are integers assigned in ascending sequence
 The number of a transaction defines its position in time
 Tid satisfies the following property: t(i)<t(j)
THREE VALIDATION CONDITIONS

 Reading phase
 Validation phase
 Write Phase
VALIDATION CONDITION 1

 Two transaction A,B are consistent


- Assume A starts earlier than B
 If A completes its write before B starts

A
VALIDATION CONDITION 2

 If the write of the A didn’t influence the read of B.


 And the B won’t overwrite the result of the A before A finishes.

A
VALIDATION CONDITION 3

 The write of A won’t influence the read and write of B.


 And A finishes read before B finishes read

A
SERIAL VALIDATION

 First of the two families of concurrency controls proposed by Kung and Robinson

 This model implements validation conditions (1) and (2) of serial equivalence

 When no two transactions may overlap in the write phase, condition 3 is satisfied
(Implies write phase is serial execution)

 Implementation consists of placing the assignment of Tid, validation, and


subsequent write phase all in a critical section
PARALLEL VALIDATION

 Concurrency control that uses all three of the validation conditions

 Extends validation to allow multiple transactions to be in the validation phase at the


same time

 Condition 3 must be satisfied as well as condition 2. The write set of the transaction
being validated must be checked for overlaps with the write set of earlier
overlapping transactions
PARALLEL VALIDATION - Implementation

 Save active transactions –finished READ

 Validate against conditions 1 and 2

 Validate against 3 for all transactions in “active” set

 If no conflicts, remove self from active and assign T(id)

 Else, abort
OPTIMISTIC METHOD - Advantages

 Locking overhead is avoided

 Conflicts are assessed pretty early

 Maximized parallelism

 Cost of roll backs is lesser than deadlock resolution cost

 Negligible concurrency control overhead if more READs


OPTIMISTIC METHOD - Disadvantages

 Relies solely on the belief that the likelihood of two transactions conflicting is low

 Conflicting transactions need to be aborted and restarted

 Too much redundancy if many transactions are aborted

 Starvation happens when a transaction is repeatedly aborted


QUESTIONS?
References

 www.cse.scu.edu/~jholliday/COEN317S05/RamirezSlides.ppt
 https://pdfs.semanticscholar.org/e67a/c429a8f8c90d1d527fd11e5866df7a8e4192.pdf

You might also like