Re:Comparison of Rust async and Linux thread context switch ...
by Tuna-Fish on Friday February 12, 2021 @01:50AM
(#26111287)
> io_uring makes a huge dent but I don't think it's intending to reimplement everything
At this point it's proponents are being pretty unapologic that it will, in fact, reimplement every part of the syscall interface that is actively used.
Re:Comparison of Rust async and Linux thread context switch ...
by lathiat on Thursday February 11, 2021 @11:56PM
(#26110876)
I'm not sure about io_uring not reimplementing everything.. it seems to be gaining more and more scope.
Re:Comparison of Rust async and Linux thread context switch ...
by throwaway81523 on Friday February 12, 2021 @03:39AM
(#26111748)
Another possibility at least in the case of lots of network sockets is DPDK, avoiding almost all the context switches if the user side is async.
So the whole thing is a bit of a false equivalence. Better interfaces that reduce context switches are desirable, but even where they exist often you are just substituting a user thread for a kernel one, and in the general case, there is likely to always be system interfaces that never make it into the brave new world -- take SysV IPC for example (a 1975 era API), it seems doubtful anyone would put the effort into making it async, but there will probably still be times where you might want to consume those interfaces for compatibility or some other obscure reason.
Also consider the case where a user program has a need for some substantial thread pools of its own, it might be the case in some scenarios that reusing resources that must already exist in user space and live in warmed caches makes more sense. Neither async or Linux threads are "better", it will always depend on a particular use case, and even then the right answer might well be some combination of both.