|
Further to this topic,
There is a text book called "Database System Implementation" , which is written by some Stanford profressors. In that book, the author describe to manage locks on a hierarchy of database elements, a "warning protocol" is needed . That is , in addition to the "ordinary" lock ( S or X) , we also need "warning" lock ( IS or IX) .
( below is in page 509 )
<quote>
The rules of warning protocol are:
1. To place an ordinary S or X lock on any element, we must begin at the root of hierarchy.
2. If we are at the element that we want to lock, we need look no further. We request an S or X lock on that element.
3. If the element we wish to lock is further down the hierarchy , then we place a warning at this node; that is, if we want to get a shared lock on a subelement we request an IS lock at this node, and if we want an exclusive lock on a subelement, we request an IX lock on this node. When the lock on the current node is granted, we proceed to the appriopriate child ( the one whose subtree contains the node we wish to lock). we then repeat step (2) or step (3) , as appropriate , until we reach the desired node.
<endquote>
Basically this looks to me also what Oracle do with the TM lock (RS and RX) to handle the table and row hierarchy locking.
And to design the lock in such a way is basically to ensure that we have the maximum concurrency possible.
And to provide concurrency is the lock's job. |
|