For the schedules below, assume that each transaction takes a lock on each datab
ID: 3822187 • Letter: F
Question
For the schedules below, assume that each transaction takes a lock on each database element immediately before it reads or writes the element, and that each transaction releases its locks immedi ately after the last time it accesses an element. Tell what the locking scheduler would do with each of these schedules; i.e., what requests would get delayed, and when would they be allowed to resume?
1. r1(A); w1(B); r2(B): w2(C); r3(C); w3(A);
2. r1(A); r2(A); w1(B); w2(B); r1(B); r2(B); w2(C); w1(D);
Explanation / Answer
1. r1(A); w1(B); r2(B): w2(C); r3(C); w3(A);
In this read operation is being performed on A so that ead lock is acquired on this, then on B write operation is being performed therefore it is holding a lock.
so that the instruction r2(B) will get delayed it must wait untill the lock on it releases , then scheduler acquires lock on C with write operation so that r3(C) is not possible untill the w2(C) completes. then w3(A) is also get's wait utill the lock releases.
2. r1(A); r2(A); w1(B); w2(B); r1(B); r2(B); w2(C); w1(D);
In this r1(A); r2(A); doesn't get any problem as they both are read operations. then w1(B) will hold the lock, and w2(B) must wait untill lock releases then r1(B); r2(B) also must wait untill the write lock releases then w2(c) can put lock on C and then w1(D) also can put lock on D.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.