-
Shared Lock 共享锁/S锁
If a transaction T has obtained a S-lock on item Q, then T can read, but cannot write Q. S-lock is requested using lock-S instruction
-
Exclusive Lock 排他锁/X锁
If a transaction T has obtained an X-lock on item Q, then T can both read and write Q. X-lock is requested using lock-X instruction
Each transaction issue lock and unlock requests in two phases:
-
Growing Phase 扩张阶段
A transaction may obtain locks, but may not release locks
-
Shrinking Phase 收缩阶段
A transaction may release locks, but may not obtain locks
-
Each transaction gets a timestamp when it enters the system
-
If a transaction X enters the system before Y does,
then TS(X) < TS(Y)
-
即:按照事务进入系统的顺序来分配时间戳,
先进的时间戳较小,后进的时间戳较大
-
Use the value of the system clock as the timestamp
-
Use a logical counter
If TS(X) < TS(Y) , then the produced schedule is equivalent to a serial schedule in which X appears before Y
并发执行的结果,就好像事务是按照时间戳从小到大的顺序串行执行的一样



