3 ms·
> Async is all wrong when there's considerable compute-bound work, and incompatible with threads running at multiple priorities The priority thing is relativel
by hedora 3y ago
> Async is all wrong when there's considerable compute-bound work, and incompatible with threads running at multiple priorities
The priority thing is relatively easy to fix:
Either create multiple thread pools, and route your futures to them appropriately.
Or, write your own event loop, and have it pull from more than one event queue (each with a different priority).
It should be even easier than that, but I don’t know of a crate that does the above out of the box.
One advantage of the second approach is (if your task runtime is bounded) that you can have soft realtime guarantees for high priority stuff even when you are making progress on low priority stuff and running at 100% CPU.
- astrange 3y agoThis doesn't help with priority inversions; since you don't know who is waiting on a future/promise until it starts waiting on it, you can't resolve them until then, which means you can have work running at too low a priority. It's not structured enough.