DB Locking

Lock Granularity:
It can be on rows, columns and table, also B+ tree page can be locked.

Read Lock (Shared Lock)
Locks the data for read for the current session
Other sessions can not update the locked data, but
Other sessions can read the locked data

Write Lock (Exclusive Lock)
Locks the data for writing/updating by current session
Other sessions unlike read lock, can not even read the locked data

Read about distributed locks.