-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add task/worker pool similar to Domainslib task pool #512
Comments
Hi @darrenldl, thanks for bringing this up. Would domain-local-await work for you, for domainslib integration? |
Yes, that would be good. We have an item in the 1.0 roadmap for this (which I've now linked to this issue). As @Sudha247 mentioned, it is possible to make mutexes work over multiple schedulers (this support will be in Eio 0.10), but we do want a worker pool in Eio too. There's an example showing how to do this in the README already (https://github.com/ocaml-multicore/eio#example-worker-pool) but we should agree on a proper API for it. We might want to make an |
Ah I must have missed it, oops, my bad.
Could you elaborate on that? I'm confused by what |
|
I see, seems like a good skeleton to base the problem on indeed. Thanks for the pointer! |
I think we can do a nicer implementation with the low-level primitives in Eio, but I did hastily port this whilst porting Irmin in case it is useful https://github.com/patricoferris/irmin/blob/direct-style/src/irmin-fs/unix/eio_pool.ml |
Ooo neat! Will take a closer look when I actually begin the PR (if no one has beaten me to it by then). At first glance it seems that |
Related to making synchronization primitives work across schedulers, you might be interested in this example of how one might setup interop between Eio and Domainslib using the kcas library (that uses the domain-local-await mentioned previously). |
Added by #639. |
Thanks for your work first of all, it's been nice to use.
The Domainslib integration as described in README works fine, but working with mutexes then becomes a bit complicated.
Eio.Mutex.lock
etc within a Domainslib (or just non-Eio I guess) domain causes it to stop progressingMutex
works, but then suffers from the problem of locking the entire domain needlessly if used on the Eio sideRight now it seems that there are enough components to replicate task pool
(unit -> unit) Eio.Stream.t
(same as domainslib example in readme)And it would be very nice to be able to stay in Eio domains for parallel worker pools.
I'm happy to draft a PR in next few days if the addition is not deemed problematic.
The text was updated successfully, but these errors were encountered: