reset password
Author Message
alomo
Posts: 70
Posted 11:44 Aug 27, 2009 |

From the database point of view, operation of obtaining a lock is just another thread. Does it mean that the actual order of scheduled operations could differ from what we expect (based on the schedule)?

For example, in Ex 14.25 we have a place when S-lock is undated to X-lock, so that part of the schedule could be the following:

..., S1(b3), R1(b3), X1(b3), W1(b3), ...

However, the following actual order ("order of threads") could be possible:

..., S1(b3), X1(b3), R1(b3), W1(b3), ...

As result, the operation R1(b3) will perform reading from the block that is currently X-locked.

And because the X-lock is obtained, even worth sequence would be possible:

..., S1(b3), X1(b3), W1(b3), R1(b3), ...

In this case, R1(b3) will read updated value of that block.

Are these situations all possible or I missed something?

cysun
Posts: 2935
Posted 14:50 Aug 27, 2009 |
alomo wrote:

From the database point of view, operation of obtaining a lock is just another thread. [...]

That's incorrect. Each transaction - not each operation, is run by one thread. All the operations of a transaction, i.e. read, write, lock, unlock etc., are performed in order. The operations from different transactions may interleave.