Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
A third choice is parallel iteration. See below a small example of an app which scans a directory tree and runs 8x command line apps (CAD rendering on Windows/Linux/macOS) on an 8 core computer. This is CPU-bound optimal for simple apps and would be 12x on 12 cores etc. tokio with default runtime parameters would do the same using join, for example join!(first_async_fn(), second_async_fn()). In both cases, as one command ends, another begins until all complete. https://github.com/paulirotta/openscad-make
That said, you're basically building pueue. https://github.com/Nukesor/pueue/blob/main/ARCHITECTURE.md might give you some pointers. From reading it, there seems to be a mishmash of tokio stuff, and then everything gets serialised onto an MPSC channel (that's serviced by TaskHandler, on a single thread that's also responsible for polling for finished processes etc, every 200ms).
Related posts
- Looking for a pueue debian maintainer
- How can I run commands in parallel and write the output of each command to different linux terminals, one linux terminal for each command running in parallel.
- Systemd timer having service running one after the other at a set time.
- What do you use to copy large files from one HDD to another?
- Tool to queue tasks and add/remove them ?