Read Locks and Write Locks

前端 未结 3 1238
梦谈多话
梦谈多话 2021-02-01 03:23

I am a little unsure about read and write locks and just need someone to check if these facts about read/write locks are correct.

This is in reference to databases in ge

3条回答
  •  暖寄归人
    2021-02-01 04:08

    In database management theory, locking is used to implement isolation among multiple database users. This is the "I" in the acronym ACID (Atomicity, Consistency, Isolation, Durability). Locks are applied by a TX (transaction) to data, which may block other TXs from accessing the same data during the TX's life.

    Simple Locking: Two main types of locks can be requested:

    • Shared lock: Read lock i.e. Any other TX can read but not write
    • Exclusive lock: Write lock i.e. No other TX can read or write

    Multiple Locking: Two Phase Locking (2PL) is a concurrency control method that guarantees serializability.

    • A Growing/Expanding/First Phase: locks are acquired and no locks are released.
    • A Shrinking/Contracting/Second Phase: locks are released and no locks are acquired.

提交回复
热议问题