download

Matakuliah
Tahun
Versi
: M0184 / Pengolahan Data Distribusi
: 2005
:
Session – 11
CONCURRENCY CONTROL
USER ACCESS CONTROL
OBJECTIVE
• Basic Transaction Concept
• Transaction as the basic unit of work in
DBMS
• Transaction Types
TRANSACTION
• The concept of a transaction is used within the
database domain as a basic unit of consistent
and reliable computing
• A database in consistent state if it obey all of
consistency (integrity) constraint defined over it
• Transaction consistency refers to the action of
concurrent transaction.
• The module responsible for concurrency control
in DBMS known as a scheduler, since its job is
to schedule transactions correctly to avoid
interference
Transaction Model
DB in
consistent
state
Begin
transaction T
DB may
temporarily in an
inconsistent way
during execution
Execution of
transaction T
DB in
consistent
state
End transaction
T
Four basic properties of transaction
• Atomicity, the “all or nothing” property; a
transaction is an indivisible unit
• Consistency, transaction transform the DB from
one consistent state to another consistent state
• Independence, transaction execute
independently of one another
• Durability, the effects of a successfully
completed transaction are permanently recorded
in the DB and can not be undone
Transaction in Application Program
• The execution of an application program in
a database environment can be viewed as
a series of atomic transaction with nondatabase process taking place in between
Transaction in Application Program
Transaction
T1
Transaction
T2
Transaction
T3
Time
Program
Start
Non-Database
Program
End
Distributed Transaction
• Transaction may access data stored at
more than one site
• Each transaction is divided into a number
of sub-transactions
Distributed Transaction Example
Begin transaction T1
Begin Transaction T1(A)
read balance(x)
balance(x) = balance(x) – 100
if balance(x) < - then
print “No Fund”
abort T1(A)
end if
write balance(x)
commit T1(A)
Distributed Transaction Example
Begin Transaction T1(B)
read balance(y)
balance(y) = balance(y) + 100
write balance(y)
commit T1(B)
Commit T1