Is there any off-heap lock-free data structure (list, set, map etc..) on Java?

Viewed 673

I have found several off heap in memory data storage, such as Chronicle-Map, mapdb, etc... They all have usage of locks (stamped read write lock, or reentrant read write lock).

Is there any data structure that is off heap and lock free on Java? Or is there any off heap data structure that is read-lock-free?

2 Answers

Agrona's ring buffer is fully lock free off-heap data structure. This queue could be used as inter-process-communication library (and actually is used inside aeron) and doesn't leverage any locks/system calls for message passing. Besides that, I'm pretty sure Agrona has more off-heap data structures, so you might want to check it out.

Lock-free is not necessarily faster than lock-based.

In modern JVMs, built-in locks are extremely fast, and beat old lock-free algorithms by a high magnitude.

This looks like an XY problem. What are you trying to achieve?

Related