Download presentation
Presentation is loading. Please wait.
Published byGeorge Small Modified over 9 years ago
1
Session – 12 CONCURRENCY CONTROL USER ACCESS CONTROL Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:
2
OBJECTIVES The problem around user access control (concurrency transaction) User access control – schedules and serialization
3
Problem in Concurrent transaction Lost Update problem Violation of integrity constraint Inconsistent retrieval problem
4
Lost Update problem Begin transaction T1 read balance(x) balance(x) = balance(x)-100 if balance(x) < 0 then print “No Fund!” abort T1 end if write balance(x) write balance(y) balance(y) = balance(y)+100 write balance(y) Commit T1 Begin transaction T2 read balance(x) balance(x) = balance(x) + 100 write balance(x) Commit T2 Time Note : X = 100 The increase of X to 200 by T2 will be overwritten by the decrement to ) by T1, thereby losing 100
5
Violation by Integrity Constraint When two transaction are allowed to execute concurrently without being synchronized. SNameOperationDate MaryTonsillectomy04.04.200 5 ……..……………………. SNameOperation MaryTonsillectomy TomTonsillectomy MaryAppendectomy SCHEDULE SURGEON
6
Violation by Integrity Constraint Begin transaction T3 read SCHEDULE where date= 04.04.2005 read SURGEON where SURGEON.SName = SCHEDULE.SName and SURGEON.Operation = “Appendectomy” if not found then abort T3 SCHEDULE.operation = “Appendectomy” Commit T3 Begin transaction T4 read SCHEDULE where date= 04.04.2005 read SURGEON where SURGEON.SName = “Tom” And SURGEON.Operation = SCHEDULE.Operation if not found then abort T4 SCHEDULE.SName = “Tom” Commit T4 Note :T3 changes the operation schedule on 04.04.2005 from a tonsillectomy to an appendectomy. T4 changes the surgeon assigned to 04.04.2005 to Tom. The effect of these two transaction is to produce database state which is inconsistent. Tom now is qualified to operate on 04.04.2005 and perform appendectomy, which is not qualified to do so, as shown in tables before.
7
Inconsistent Retrieval Problem Begin transaction T1 read balance(x) balance(x) = balance(x)-100 if balance(x) < 0 then print “No Fund!” abort T1 end if write balance(x) write balance(y) balance(y) = balance(y)+100 write balance(y) Commit T1 Begin Transaction T5 sum = 0 do while not end of relation read balance(a) sum = sum + balance(a) :::: read balance(x) sum = sum + balance(x) :::: read balance(y) sum = sum + balance(y) :: Commit T5
8
Schedule and Serialization A transaction consists pf a sequence of Reads and Writes to the database. The entire sequence of reads and writes by all concurrent transactions in database taken together is known as Schedule. A schedule S is generally written : S = [O1, O2, O3,O4,……,On] O : indicate Read or Write operation
9
Schedule and Serialization Cont’d A Serial Schedule is one in which all read and write of each transaction are grouped together so that the transaction are run sequentially one after the other.
10
EXAMPLE T6 Begin Transaction T6 read Y Y = Y + 1 write Y Commit T6 T7 Begin Transaction T7 Read X Read Y Y = Y + 1 Write Y Commit T7 T8 Begin transaction T8 read X X = X + 1 write X Commit T8 Time
11
EXAMPLE Cont’d The Schedule S for that example : S = [R7(X),R8(X),W8(X),R6(Y),W6(Y),R7(Y),W7(Y)] Serial Schedule SR : SR = [R6(Y),W6(Y),R7(X),R7(Y),W7(Y),R8(X),W8(X)]
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.