News for hackers. Stuff that matters.
Re:Async Rust Is A Bad Language by Taek on Friday September 08, 2023 @01:46PM (#37436894)
Rust made a critical safety mistake when it chose its async paradigm. It gave the code the option to decide when to yield.

What that means is that when I'm writing async code, I have to audit every library I import to make sure that library is guaranteed to yield after a few microseconds of execution, otherwise my own core loops starve. Importing unknown code when using async rust is not safe for any application that needs to know its own threads won't starve.

A safe async language must guarantee that threads will make progress. Rust should change the scheduler so that it can pre-empt any code after that code has hogged a thread for too long.

Re:Async Rust Is A Bad Language by zamalek on Friday September 08, 2023 @02:38PM (#37437596)
> A safe async language must guarantee that threads will make progress.

You might be looking for parallelism, not concurrency.

Re:Async Rust Is A Bad Language by brickteacup on Friday September 08, 2023 @05:58PM (#37439889)
No? You don't need parallelism to guarantee global progress as long as the scheduler has the ability to preempt tasks. Of course coroutines (as opposed to e.g. userspace threads) can't really be preempted, which is the issue here.
Re:Async Rust Is A Bad Language by zamalek on Friday September 08, 2023 @11:45PM (#37442077)
> parallelism to guarantee global progress as long as the scheduler has the ability to preempt task

Preempting tasks is a single-core simulation of parallelism. I suspect there is confusion about what parallelism and concurrency are here: the terms are often used interchangeably (especially saying "concurrency" instead of "parallelism"), but they are definitely not interchangeable - or even, arguably, related at all. Concurrency, by definition, is concerned with continuations. If you remove continuations (async/await and/or futures/promises - depending on the language choices) then you aren't talking about concurrency any more.

Either way, you can use parallelism is Rust today - just use blocking APIs, locking, and threads. I don't get what the big deal is. You can even use concurrency and parallelism together, just use await/async across multiple threads.

I agree with the premise of the article, but the reasoning in this comment chain is something along the lines of "cats are horrible, because 5." The criticism is foreign to the entire subject matter.

Re:Async Rust Is A Bad Language by kprotty on Saturday September 09, 2023 @01:30PM (#37447834)
Preemption simulates localized concurrency (running multiple distinct things logically at the same time) not parallelism (running them physically at the same time). You can have concurrency outside continuations. OS threads for example are not continuations, but still express concurrency to the kernel so that it can (not guaranteed) express concurrency to the physical CPU cores which hopefully execute the concurrent code in parallel (not guaranteed again, due to hyperthreading).
Re:Async Rust Is A Bad Language by SkiFire13 on Friday September 08, 2023 @04:11PM (#37438791)
> Rust should change the scheduler

Rust doesn't have a scheduler, and having one would be a no-go for any sufficiently low level code (e.g. in microcontrollers).

Re:Async Rust Is A Bad Language by kasdi on Saturday September 09, 2023 @04:31AM (#37443340)
Naive question: Why not use OS concurrency then?