Throughput

Throughput: refers to the total amount of data transmitted on the network during a performance test .


When looking at the AQS source code, there are two inner classes of fair lock and unfair lock in the inner class of ReentrantLock.

These two inner classes are the basis for implementing the lock method. Among the two, the throughput of unfair locks is relatively large, and the performance will be relatively dominant.


Think about the reasons for the higher throughput:

It is the unfair lock that CAS acquires the lock first in the lock method, and the unfair lock does not check whether there are threads waiting for the lock in the blocking queue.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325765398&siteId=291194637