[Java concurrent programming] 8. Various lock concepts, java concurrent programming

Source: Internet
Author: User

[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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.