Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A server manages the objects a1, a2, ... an. The server provides two operations

ID: 3825765 • Letter: A

Question

A server manages the objects a1, a2, ... an. The server provides two operations for its clients:

    read(i) returns the value of ai

    write(i, Value) assigns Value to ai

The transactions T and U are defined as follows:

T:     x = read(i); write(j, 44);
U:     write(i, 55); write(j, 66);


(a) Describe an interleaving of the transactions T and U in which locks are released early with the effect that the interleaving is not serialized.

(b) Describe an interleaving of the transactions T and U which is serialized and could occur with two-phase locking.

Explanation / Answer

a) Because the ordering of different pairs of conflicting operations of two transactions must be the same.

For an example where locks are released early:

T T’s locks U U’s locks

lock i

x:= read (i);

unlock I

lock i

write(i, 55);

lock j

write(j, 66);

commit unlock i, j

b) serially equivalent and with two-phase locking

T: x= read (i); write(j, 44); U: write(i, 55);write(j, 66); Initial values of ai and aj are 10 and 20

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote