riot icon indicating copy to clipboard operation
riot copied to clipboard

Rewrite Hashmap to play nicely with the scheduler

Open leostera opened this issue 1 year ago • 2 comments

At the moment we are exposing our internal "Dashmap" as a Hashmap that should be prefered in userland Riot programs for concurrent access.

Sadly, this Hashmap is far from ideal as it is lock-based. We should design a version of this interface that plays along nicely with concurrent and parallel access, and that doesn't rely on locks directly, but rather uses Riot-friendly mutexes.

It'll be useful to have some of #45 in place to do this.

Implementation Notes

Something I had in mind was to mimic what Dashmap from Rust does, where the Hashmap has individual read-write locks for every single entry, which allows concurrent and parallel read/write access to separate entries.

This could be implemented on top of the Hashtbl.t (like the current dashmap.ml does), and just try to get a lock on a value at the very moment the value will be used.

leostera avatar Jan 21 '24 02:01 leostera

I'd love to take this on!

FayCarsons avatar Mar 22 '24 02:03 FayCarsons

Hi @FayCarsons! That sounds great :D assigning it to you. Thanks for reaching out! ✨

leostera avatar Mar 24 '24 03:03 leostera