Escolar Documentos
Profissional Documentos
Cultura Documentos
M Arslan Akram
M Musharaf Ali
[14-arid-4845]
[14-arid-4846]
[14-arid-4849]
[14-arid-4853]
CONCURRENCY CONTROL
Concurrency control is the activity of
coordinating concurrent accesses to a database in
a multiuser database management system
(DBMS).
Concurrency control is the problem of
synchronizing concurrent transactions (i.e., order
the operations of concurrent transactions) such
that the following two properties are achieved:
the
Optimistic
PESSIMISTIC CONCURRENCY
CONTROL
A system of locks prevents users from modifying
data in a way that affects other users. After a
user performs an action that causes a lock to be
applied, other users cannot perform actions that
would conflict with the lock until the owner
releases it.
This is called pessimistic control because it is
mainly used in environments where there is high
contention for data, where the cost of protecting
data with locks is less than the cost of rolling
back transactions if concurrency conflicts occur.
DISADVANTAGES OF LOCKING
Lock maintenance represents overhead
There are no general-purpose deadlock-free
locking protocols for DBs w/ high concurrency
Concurrency is significantly lowered whenever it
is necessary to leave some congested node locked
Locks cannot be released until the end of the
transaction
Locking may be necessary only in the worst case
OPTIMISTIC CONCURRENCY
CONTROL
Kung and Robinson proposes two families of
optimistic concurrency control which eliminate
the use of locking.
The approach hopes that conflicts do not occur
and transactions are allowed to proceed as
though there were no possibility of conflict
Objective is to minimize the time over which a
given resource would be unavailable for use by
other transactions
OPTIMISTIC CONCURRENCY
CONTROL
In optimistic concurrency control, users do not
lock data when they read it. When a user updates
data, the system checks to see if another user
changed the data after it was read. If another
user updated the data, an error is raised.
Typically, the user receiving the error rolls back
the transaction and starts over. This is called
optimistic because it is mainly used in
environments where there is low contention for
data, and where the cost of occasionally rolling
back a transaction is lower than the cost of
locking data when read.
TARGET SET
VALIDATION PHASE
VALIDATION PROCESS
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
T satisfies the following property: t(i)<t(j)
VALIDATION PROCESS
Working
Validation Update
T1
Earlier committed
transactions
T2
Figure 12.28
T3
Transaction
being validated
Tv
active
Later active
transactions
active
VALIDATION PROCESS
CONSIDERATIONS TO MODEL
SERIAL VALIDATION
PARALLEL VALIDATION
ADVANTAGES OF OPTIMISTIC
CONCURRENCY CONTROL
CHOOSING CONCURRENCY
CONTROL MECHANISM
CONCLUSION