Reputation: 2133
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?
Upvotes: 18
Views: 2889
Reputation: 719229
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.
Upvotes: 31