In: Computer Science
Question 4
Read the following scenario and address the following issues that are related to transaction and concurrency control. Assume that objects a1, a2, and a3 are managed by a server, which provides two operations to operate the objects. read(a): returns the value of object a write(a, v): assigns the value v to object a Assume that the following two concurrent transactions T and U are performed on these objects.
T: read(a2); read(a1); write(a2, a2-25); read(a3); write(a1, a1+52)
U: read(a3); read(a2); write(a2, a2+33); write(a3, a3-26)
Assume that the original values of a1, a2, and a3 are 111, 106 and 125 respectively. Answer the following questions based on the above scenario.
1. If there is no concurrency control, transactions T and U may perform the following interleaving operations on objects a1, a2 and a3. What problem can be caused by the operations? Justify your answer.
T: read(a2); U: read(a3); U: read(a2); T: read(a1); T: write(a2, a2-25); T: read (a3); U: write(a2, a2+33); T: write(a1, a1+52); U: write(a3, a3-26)
2. What requirement must be satisfied in order to avoid the problem?
3. When the above requirement in question (1) is satisfied, what would be the correct values of a1, a2 and a3 after T and U commit?
4. Give an example of possible interleaving operations that can produce the correct values of a1, a2 and a3.
1.). Interleaving operations of two transactions dependent on the same subject may be problematic for the integrity of the solution. In both the transaction T and U, there are read-write and write-write dependency existing which can result in erroneous read and write operations being performed by transactions t or u and may lead to inconsistent result.
2.). In order to avoid this problem the operations of transaction T and U must be serialised such that the transaction are performed in serial order as required. Conflict equivalent transactions is needed to be derived for such serial transactions.
The final value of A1 A2 and A3 after t and u commit it is 163 114 and 99 respectively as explained in the solution in the picture.