0% found this document useful (0 votes)
174 views

Serializability

This document discusses testing schedules for view serializability. It defines view serializability and explains that schedules must be equivalent to a serial schedule to guarantee isolation between concurrently executing transactions. It then describes how to construct a labeled precedence graph from a schedule to test if it is view serializable by adding edges between transactions based on certain rules.

Uploaded by

Arvind Soni
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
174 views

Serializability

This document discusses testing schedules for view serializability. It defines view serializability and explains that schedules must be equivalent to a serial schedule to guarantee isolation between concurrently executing transactions. It then describes how to construct a labeled precedence graph from a schedule to test if it is view serializable by adding edges between transactions based on certain rules.

Uploaded by

Arvind Soni
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Serializability Summary

As transactions execute concurrently, we must guarantee isolation, i.e., we only want to allow good schedules. Good schedules, or rather, schedules that guarantee isolation, means that the resulting schedules are equivalent to some serial schedule. Any schedule that is conict serializable is equivalent to some serial schedule. Any schedule that is view serializable is equivalent to some serial schedule. Schedules exist which are neither view nor conict serializable, but are equivalent to some serial schedule. Schedules exist which are view serializable but not conict serializable. Concurrency control schemes/algorithms are required that ensure either conict or view serializability.

Testing for View Serializability


Let S be a schedule consisting of transactions {T1, T2,..., Tn}. Construct a labeled precedence graph as follows. First, add two more dummy transactons Tb and Tf. - Tb issues write(Q) for each Q accessed in S. - Tf issues read(Q) for each Q accessed in S. - Tb is inserted at the beginning of S. - Tf is inserted at the end of S.

Testing for View Serializability, Cont.


1. Add an edge
0 if transaction Tj reads the value of data item Q written by transaction Ti. Ti T j

2. Remove all the edges incident on useless transactions. A transaction Ti is useless if there exists no path, in the precedence graph, from Ti to transaction Tf. 3. For each data item Q such that Tj reads the value of Q written by Ti, and Tk executes write(Q) and T k T b , do the following: a) If T i = T b and T j T f , then insert the edge
0 in the labeled precedence graph. T j Tk 0 in the labeled precedence graph. Tk Ti p p and in the labeled precedence graph Tk Ti T j Tk

b) If T i T b and T j = T f , then insert the edge

c) If T i T b and T j T f , then insert the pair of edges

where p is a unique integer larger than 0 that has not been used earlier for labeling edges.

Testing for View Serializability, Cont.


Meaning of rules 3a-3c:

- Rule 3a) ensures that if a transaction reads an initial value of Q in schedule S, then it also reads that same value in any view-equivalent schedule. - Rule 3b) ensures that if a transaction writes the nal value of Q in schedule S, then it also writes that same value in any view-equivalent schedule. - Rule 3c) ensures that if a transaction Ti writes a data item that Tj reads, then any transaction Tk that writes the same data item must either come before Ti or after Tj in any view-equivalent schedule.

Testing for View Serializability Example #1


Consider the following schedule:
T3 read(Q) write(Q) read(Q) write(Q) write(Q) T4 T7

T3 0 0 T4 0 0 T7 Tf 1 0 0

T3 0 T4 1 Tf 0 T7

Tb

Tb

Testing for View Serializability - Example #2


Consider the following schedule:
T3 read(Q) write(Q) read(Q) write(Q) write(Q) write(B) read(A) write(A) write(A) write(A) read(A) T4 T7 T8 T9 T10

Tb 0 T9 T8 T10 0 0 0 T7 0 1 T4 T3

Tb

T3

0 0 1 T8 2 0 2 0 T10 0 Tf 0

T9 0

T4 0 T7

Tf

You might also like