Danh mục

Bài giảng Thiết kế và quản trị cơ sở dữ liệu - Chương 5: Concurrency

Số trang: 11      Loại file: pdf      Dung lượng: 331.30 KB      Lượt xem: 3      Lượt tải: 0    
Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Nội dung chính được trình bày trong chương này gồm có: Transaction, automicity, consistency, isolation, durability, transaction states, transaction management interfaces, concurrency control, serializability,...
Nội dung trích xuất từ tài liệu:
Bài giảng Thiết kế và quản trị cơ sở dữ liệu - Chương 5: ConcurrencyConcurrencyVu Tuyet Trinhtrinhvt@it-hut.edu.vnDepartment of Information Systems, Faculty of Information TechnologyHanoi University of TechnologyExample500USDAccount AAccount Bread(A)If A > 500 thenB:=B+500A:=A-500CrashWhat happen???21TransactionA sequence of read and write operations on data itemsthat logically functions as one unit of workAssuring data integrity and correctionACID PropertiesConcurrencyControlAtomicityConsistencyIsolationDurabilityRecovery3Automicityguarantee that either all of the tasks of a transaction areperformed or none of them areExampleT: Read(A,t1);If t1 > 500 {Read(B,t2);t2:=t2+500;Write(B,t2);t1:=t1-500;Write(A,t1);}crash42Consistencyensures that the DB remains in a consistentstate before the start of the transaction and afterthe transaction is overExampleA+B = CT: Read(A,t1);If t1 > 500 {Read(B,t2);t2:=t2+500;Write(B,t2);t1:=t1-500;Write(A,t1);}A+B = C5Isolationability of the application to make operations in atransaction appear isolated from all other operations.Example A= 5000, B= 3000T: Read(A,t1);If t1 > 500 {Read(B,t2);t2:=t2+500;Write(B,t2);t1:=t1-500;Write(A,t1);}T’: A+B(= 5000+3500)(A+B = 4500+3500)63Durabilityguarantee that once the user has been notified ofsuccess, the transaction will persist, and not be undoneVí dụ: A= 5000, B= 3000T: Read(A,t1);If t1 > 500 {Read(B,t2);t2:=t2+500;Write(B,t2);t1:=t1-500;Write(A,t1);}crash7A= 4500, B=3500Transaction States84Transaction Management InterfacesBegin TransCommit ()Abort()Savepoint Save()Rollback (savepoint)(savepoint = 0 ==> Abort)9Concurrency ControlObjective:ensures that database transactions are performed concurrentlywithout the concurrency violating the data integrityguarantees that no effect of committed transactions is lost, andno effect of aborted (rolled back) transactions remains in therelated database.ExampleT0: read(A);A := A -50;write(A);read(B);B := B + 50;write(B);T1:read(A);temp := A *0.1;A := A -temp;write(A);read(B);B := B + temp;write(B);105

Tài liệu được xem nhiều: