[Java concurrent programming] 8. Various lock concepts, java concurrent programming
Updating...
Shared lock (S lock ):If transaction T adds A shared lock to data A, other transactions can only add A shared lock to data A, but cannot apply an exclusive lock until all shared locks are released. Transactions authorized to share locks can only read data and cannot modify data.
Exclusive lock (X lock ):If transaction T adds an exclusive lock to data a, other transactions cannot add any type of lock to auntil the lock on the resource is released at the end of the transaction. Transactions authorized to exclusive locks can read and modify data.
Linux spin lock:
When a process enters the CPU operation, it locks its code to prevent other CPU processes from modifying the code (it does not rule out the situation where the CPU locks other CPUs, will be discussed later .). The so-called sub-spin lock is such A lock: process A enters the CPU, locks the door to run, process B comes to the CPU, and finds that the door is locked, so wait for process A to come out and hand over the unlock key.