Schedules
Schedules
Serial Schedule:
Example:
Transaction-1 Transaction-2
R(a)
W(a)
R(b)
W(b)
R(b)
R(a)
W(b)
W(a)
Testing of Serializability:
If there is a cycle present in the serialized graph then the schedule is non-
serializable because the cycle resembles that one transaction is
dependent on the other transaction and vice versa. It also means that
there are one or more conflicting pairs of operations in the transactions.
On the other hand, no-cycle means that the non-serial schedule is
serializable.
Two operations inside a schedule are called conflicting if they meet these
three conditions:
To conclude, let’s take two operations on data: "a". The conflicting pairs
are:
1. READ(a) - WRITE(a)
2. WRITE(a) - WRITE(a)
3. WRITE(a) - READ(a)
Note:
R(x)
R(z)
W(z)
R(y)
R(y)
W(y)
W(x)
W(z)
W(x)
Non-serializable schedule:
For checking, we will use the same Precedence Graph technique discussed
above. First, we will check conflicting pairs operations(read-write, write-
read, and write-write) and then form directed edges between those
conflicting pair transactions. If we can find a loop in the graph, then the
schedule is non-conflicting serializable otherwise it is surely a conflicting
serializable schedule.
Example:
We have a schedule "S" having three transactions t1, t2, and t3 working
simultaneously. Let's form is precedence graph.
t1 t2 t3
R(x)
R(y)
R(y)
W(y)
W(x)
W(x)
R(x)
W(x)
S:
t1 t2
R(x)
W(x)
R(x)
W(x)
R(y)
W(y)
R(y)
W(y)
R(x)
W(x)
R(y)
W(y)
R(x)
W(x)
R(y)
W(y)
Actual process for checking view serializability:
Example:
We have a schedule "S" having two transactions t1, t2, and t3 working
simultaneously.
S:
t1 t2 t3
R(x)
W(x)
W(x)
W(x)
R(x)
W(x)
W(x)
W(x)