Improve scaling of downcalls using MemorySegments allocated with shared arenas
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Dec 8 18:42:34 UTC 2025
> sum() is really just a snapshot, it adds up the counters (Cells), so
> it wouldn't ensure the counter was at zero. Immediately after
> returning zero a thread could have already incremented it.
Yes. What I mean is: you can check if close() should throw because of
pending acquires. But, as I said, we can use that in any way to "block"
other acquires from happening in case we _do_ want to close. Which
leaves us exposed.
>
>
>> For the purpose of implementation clarity -- would it be useful to
>> wrap the various counters plus logic to acquire/ release (and
>> "closing" state) into a separate abstraction, which is then used by
>> SharedMemorySession? A sort of "atomic" LongAdder, if you will :-)
>>
>> That might make it easier to verify the correctness of the
>> implementation, by validating each aspect (the atomic long adder, and
>> its use from SharedMemorySession) separately.
>
> Sure, that would be a bit cleaner, thanks.
Thanks.
Maurizio
More information about the panama-dev
mailing list