Re:Scipio: A Thread-per-Core Crate for Rust and Linux
by Joker_vD on Tuesday November 03, 2020 @10:36AM
(#24980559)
Wait, Rust doesn't associate executors with futures? If it does, and there is a single-threaded executor available, then it's absolutely possible to deadlock just like in .NET.
[ Parent
| on HN ]
Re:Scipio: A Thread-per-Core Crate for Rust and Linux
by davidhyde on Tuesday November 03, 2020 @02:23PM
(#24982986)
That is a good question. It is possible to avoid deadlocks in a single threaded executor with higher priority interrupts but I’m no authority in this area. Maybe someone else can comment. Most of my understanding in this area comes from reading this article: https://os.phil-opp.com/async-await/
Re:Scipio: A Thread-per-Core Crate for Rust and Linux
by Matthias247 on Wednesday November 04, 2020 @12:12AM
(#24986559)
In Rust a task which is started on a given executor never leaves it. It can not switch executors like it can in C# where the continuations could be called on an arbitrary thread. In Rust, wakeups for an async task essentially just schedule it for running again, but the execution happens on the previous executor.
Anyway, in both models you can have deadlocks. And even if there is no deadlock, blocking the eventloop is still an antipattern, since it prevents other tasks which might be able to make progress from running.