Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lock splitting vs lock striping

Below is the excerpt from Effective Java by Joshua:

If you do synchronize your class internally, you can use various techniques to achieve high concurrency, such as lock splitting, lock striping, and nonblocking concurrency control.

Above suggests that lock splitting and lock striping are 2 different techniques but when I tried to find the difference between I couldn't find a difference.

Is there is a difference between them or they are same thing?

like image 857
pjj Avatar asked May 22 '17 22:05

pjj


People also ask

What is lock splitting?

Lock splitting is about using different locks for different parts of a classes functionality; e.g. one lock for read operations and another one for write operations.

What is a striped lock?

Conceptually, lock striping is the technique of dividing a lock into many stripes, increasing the granularity of a single lock and allowing independent operations to lock different stripes and proceed concurrently, instead of creating contention for a single lock.


1 Answers

Lock splitting is about using different locks for different parts of a classes functionality; e.g. one lock for read operations and another one for write operations.

Lock striping is about using different locks for different parts (stripes) of the data structure that a class manages; e.g. dividing a map into submaps, each with their own locks.

like image 192
Stephen C Avatar answered Sep 18 '22 19:09

Stephen C