Why JDK API team does not using lock stripping to implement a Concurrent List (like Concurrent Map) ? Java provides ConcurrentSkipListSet and CopyOnWriteArrayList but not a list with lock stripping approach.
Asked
Active
Viewed 108 times
0
-
5What did they tell you when you asked them? – Fildor Dec 07 '15 at 12:01
-
maybe this http://stackoverflow.com/a/6916414 – zapl Dec 07 '15 at 12:12
-
1Because lock striping doesn't work if you can partition the data structure into FIXED sections (stripes). And you simply can't do that (efficiently, scalably) with a list that conforms to the `List` API. Basically, the fact that the `List` API has operations that index the list means you can't create a general purpose concurrent list. – Stephen C Dec 07 '15 at 12:34
-
1(Or at least, if it >> is << possible, nobody has achieved it yet ... to my knowledge.) – Stephen C Dec 07 '15 at 12:38
-
1The best example of a "concurrent list" that I could find was this: http://www.java2s.com/Code/Java/Collections-Data-Structure/ConcurrentDoublyLinkedList.htm ... It is concurrent in the sense that it is thread-safe (with weak consistency guarantees) in the face of multiple threads iterating and modifying. HOWEVER it doesn't implement any index-based operations. Note also the original author. – Stephen C Dec 07 '15 at 12:51
-
Thanks you guys, yes that answer has required info. – Ajeet Dec 07 '15 at 12:59
-
2My first comment should read *"Because lock striping doesn't work if you cannot partition ..."*. Double negatives are tricky :-) – Stephen C Dec 07 '15 at 13:35
-
@Stephen C: so that “concurrent doubly linked list without index-based operations” basically is a [`ConcurrentLinkedDeque`](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentLinkedDeque.html), so it got into the Java API, just with a clearer name. In the end, if something of that author does not make into the Java API, there must be a strong reason for that… – Holger Dec 07 '15 at 14:39