Memory Mapped Segment with offsets into the underlying file
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jul 1 23:49:22 UTC 2020
On 01/07/2020 23:44, Johannes Lichtenberger wrote:
> The only thing, which is missing right now might be sharing a
> MemorySegment between threads, whereas I'm making sure that only ever
> one thread reads or writes (but that's something where I have to wait
> for Java 15 or even later I guess). A basic operation SirixDB is
> offering is a timer based auto-commit with the
> ScheduledExecutorService, which commits in another thread than the
> main parent thread.
This is at the top of our list of things to work on see [1] for some
background. The trick is to find a way to have shared segment which work
at speed, and retain some form of deterministic deallocation.
In the meantime though, with the Java 15 API you can workaround the
limitation by using the MemorySegment::ofNativeRestricted factory -
which allows you to set a "null" owner thread (so it's effectively a
shared segment, but an unsafe one, so if you manipulate it incorrectly
you can crash the VM).
Maurizio
[1] -
https://mail.openjdk.java.net/pipermail/panama-dev/2020-May/009004.html
More information about the panama-dev
mailing list