GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Contents
  • Current events
  • Random article
  • About Wikipedia
  • Contact us
  • Help
  • Learn to edit
  • Community portal
  • Recent changes
  • Upload file
  • Special pages
  • Search
  • Donate

This view

  • Original page
  • New address

GeezerVison is showing en.wikipedia.org — Multiple granularity locking - Wikipedia

icon
This article needs more citations. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Multiple granularity locking" – news · newspapers · books · scholar · JSTOR
(January 2021) (Learn how and when to remove this message)

In computer science, multiple granularity locking (MGL) is a locking method used in database management systems (DBMS) and relational databases.

In multiple granularity locking, locks are set on objects that contain other objects. MGL exploits the hierarchical nature of the contains relationship. For example, a database may have files, which contain pages, which contain records. This can be thought of as a tree of objects, where each node contains its children. A lock on this structure (such as a shared or exclusive lock) locks the targeted node as well as all of its descendants.[1]

Multiple granularity locking is usually used with non-strict two-phase locking to guarantee serializability.

Lock modes

In addition to shared (S) locks and exclusive (X) locks from other locking schemes, like strict two-phase locking, MGL also uses intentional "locks", which do not directly lock a node, but instead denote the existence, or intent to add, a lock of the specified type lower in the node hierarchy. Intentional locks include "intention shared" (IS), "intention exclusive" (IX), and the combined "shared and intention exclusive" (SIX) locks. IS locks conflict with X locks, while IX locks conflict with S and X locks. The null lock (NL) is compatible with everything.

To lock a node in S (or X), MGL has the transaction lock on all of its ancestors with IS (or IX), so if a transaction locks a node in S (or X), no other transaction can access its ancestors in X (or S and X). This protocol is shown in the following table:

To GetMust have on all ancestors
IS or SIS or IX
IX, SIX or XIX or SIX

Determining what level of granularity to use for locking is done by locking the finest level possible (i.e., at the lowest leaf), and then escalating these locks to higher levels in the file hierarchy to cover more records or file elements as needed in a process known as "lock escalation". MGL locking modes are compatible with each other as defined in the following matrix.

ModeNLISIXSSIXX
NL YesYesYesYesYesYes
IS YesYesYesYesYesNo
IX YesYesYesNoNoNo
S YesYesNoYesNoNo
SIX YesYesNoNoNoNo
X YesNoNoNoNoNo

Following the locking protocol and the compatibility matrix, if one transaction holds a node in S mode, no other transactions can have locked any ancestor in X mode.

See also

  • Atomicity (programming)
  • Concurrency control
  • Lock (computer science)

References

  1. ↑ Jim Gray; Raymond A. Lorie; G. R. Putzolu; Iriving L. Traiger (1976). "Granularity of locks and degrees of consistency in a shared data base". IBM Technical Report. IBM.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Multiple_granularity_locking&oldid=1382499090"
Category:
  • Concurrency control
Hidden categories:
  • Articles with short description
  • Short description matches Wikidata
  • Articles needing additional references from January 2021
  • All articles needing additional references
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.