News for hackers. Stuff that matters.
Re:Comparison of Rust async and Linux thread context switch ... by littlestymaar on Friday February 12, 2021 @08:47AM (#26113564)
I find your comment about stack traces a bit weird: of course, when all your work is sequential and you can use only threads, you will have a nice stack trace for free, when async stack traces need a lot of support from the tooling.

But most of the time you not only use thread, but also several synchronization primitives (locks, channel, etc.) and when doing so, regarding stack trace you are in an even worst situation than what async stack traces gives you (“some thread changed this shared-memory value and now it's not what you expected, but you have no easy way to know which one did and when, good luck”).

Re:Comparison of Rust async and Linux thread context switch ... by GordonS on Friday February 12, 2021 @09:53AM (#26114232)
Maybe if you spray threads around at random :), but in real-world use I find it much easier to pinpoint where the problem occurred, and the path taken to get there. Also, at least with threads you can get the thread ID and/or name.

Regarding shared, mutable state - if multiple async "threads" can access that state, then you still need to guard it, but usually with an async-capable means.

Re:Comparison of Rust async and Linux thread context switch ... by littlestymaar on Friday February 12, 2021 @01:44PM (#26116976)
> Regarding shared, mutable state - if multiple async "threads" can access that state, then you still need to guard it, but usually with an async-capable means.

Sometimes, but not as often, because the scope of your async function is often the only “shared state” you need.