4 ms·
A few comments. First of all, this is fine for a densely packed, growable "array" of things indexed by small integers. Think of things like a file descriptor
by cryptonector 7y ago
A few comments.
First of all, this is fine for a densely packed, growable "array" of things indexed by small integers. Think of things like a file descriptor table indexed by FD number and mapping to an open file handle. But this is not a generic hash table indexable by strings.
Second, the hard part here is that readers that have obtained an about-to-no-longer-be-current root need to be able to use it to completion, while writers of new roots need to be able to ensure the eventual freeing of old roots when no readers remain who have a live reference to an old root. This is particularly tricky to get right -- it's the sort of thing that in the Linux kernel gets done with RCU, but RCU in userland is not portable. That's not to say that there aren't solutions. I've implemented something like just that piece with a generic API in[0].
[0] https://github.com/cryptonector/ctp
- jsnell 7y agoThe system they're describing is written in Java, so I think they trust the GC to take care of that.
- cryptonector 7y agoAh, yes, neo4j -- the 'j' means Java, and that's fair, but a concurrent GC is an assumption worth stating!
- ot 7y ago> RCU in userland is not portable Portable implementations are possible by using thread-local integers. There's one in Folly for example.