I am having a problem with one of my exam review question:

For the two transactions:
T1: read(A)
read(B)
if A=0 then B=B+1
write(B)

T2: read(B)
read(A)
if B=0 then A=A+1
write(A)

How can I add locks and unlocks to T1 and T2 so that it will produce a non-serial and deadlock-free schedule...if we follow the two-phase locking protocol?