Science Fair Projects Ideas - Strict two-phase locking

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Strict two-phase locking

In computer science, strict two-phase locking (Strict 2PL) is a locking method used in database management systems.

The two rules of Strict 2PL are:

  1. If a transaction T wants to read/write an object, it must request a shared/exclusive lock on the object.
  2. All locks held by transaction T are released when T commits (and not before).

Here is an example of Strict 2PL in action with interleaved actions.

D = \begin{bmatrix} T1 & T2 \\ S(A) &   \\ R(A) & \\   & S(A)  \\  & R(A) \\  & X(B)\\  & R(B) \\  & W(B)\\   & Com. \\ X(C) & \\ R(C) & \\ W(C) & \\ Com. &\end{bmatrix}

or in text form:

T1: S(A), R(A); T2: S(A), R(A), X(B), R(B), W(B), Commit; T1: X(C), R(C), W(C), Commit

where

  • S() is a shared lock action on an object
  • X() is an exclusive lock action on an object
  • R() is a read action on an object
  • W() is a write action on an object


Strict 2PL prevents transactions reading uncommitted data, overwriting uncommitted data, and unrepeatable reads. It does not guarantee that deadlocks cannot occur, which can be important in real time systems, and may additionally be difficult to enforce in distributed data bases, or fault tolerant systems with multiple redundancy.


A deadlocked schedule supposedly allowed in Strict 2PL:

G = \begin{bmatrix} T1 & T2\\ X(A) &  \\   & X(B) &  \\ X(B) & \\  & X(A) \end{bmatrix}

Text: T1: X(A) T2:X(B) T1:X(B) T2: X(A)

T1 is waiting for T2's lock on B to be released, while T2 is waiting for T1's lock on A to be released. These transactions cannot proceed and both are deadlocked.

If a user wishes to guarantee that no deadlocks occur, non-strict 2PL would be one option. Assigning timestamps would be another.

10-26-2009 08:16:03
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice