The difference between shared lock and exclusive lock

Shared lock (S lock):
also known as read lock.
If transaction T adds S lock to data object A, it can read A but cannot modify A. Other transactions can only add S lock to A, but cannot add X lock. This ensures that other transactions can read A, but cannot make any changes to A before transaction T releases the S lock on object A.

Exclusive lock (X lock):
also becomes a write lock.
Transaction T adds X lock to data object A. Transaction T can read A or modify A. Other transactions cannot add any locks to A until T releases the lock on A, which ensures that other transactions release A on T. You cannot read and modify A before locking.

Guess you like

Origin blog.csdn.net/m0_46551861/article/details/115001751
Recommended