next up previous
Next: Two-Phase Locking Up: No Title Previous: Serializability

Locking

We could try and use locking to ensure serializability as shown in Figure 2.

Before accessing a resource, a process locks it, and after accessing it, the process unlocks it. A transaction blocks another one only if the latter concurrently accesses the same resource.

This approach works in the example shown in Figure 2 because both transactions access the shared objects in the same order. When this is not the case, it does not work. Consider the scenario of Figure 3.

This execution is allowed by the naive locking approach, but is not serializable.

Thus, a more complicated approach, described below, is necessary.



Prasun Dewan
Tue Mar 20 13:49:53 EST 2001