Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Two-phase locking
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Read and write locks== Locks are used to guarantee [[serializability]]. A transaction is ''holding'' a [[Lock (computer science)|lock]] on an object if that transaction has acquired a lock on that object which has not yet been released. For 2PL, the only used data-access locks are '''read-locks''' ('''shared locks''') and '''write-locks''' ('''exclusive locks'''). Below are the rules for ''read-locks'' and ''write-locks'': * A transaction is allowed to read an object if and only if it is holding a ''read-lock'' or ''write-lock'' on that object. * A transaction is allowed to write an object if and only if it is holding a ''write-lock'' on that object. * A [[Database transaction schedule|schedule]] (i.e., a set of transactions) is allowed to hold multiple locks on the same object simultaneously if and only if none of those locks are write-locks. If a disallowed lock attempts on being held simultaneously, it will be blocked. {| class="wikitable" style="text-align:center;" |+Lock compatibility table |- ! Lock type !! read-lock !! write-lock |- ! read-lock | '''β''' || '''X''' |- ! write-lock | '''X''' || '''X''' |}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)