News for hackers. Stuff that matters.
Re:Writing an OS in Rust: Async/Await by steveklabnik on Monday March 30, 2020 @11:28AM (#22728755)
Well, there's a big difference:

> Using async/wait, we now have basic support for cooperative multitasking in our kernel. While cooperative multitasking is very efficient, it leads to latency problems when individual tasks keep running for too long and thus prevent other tasks to run. For this reason, it makes sense to also add support for preemptive multitasking to our kernel.

> In the next post, we will introduce threads as the most common form of preemptive multitasking. In addition to resolving the problem of long running tasks, threads will also prepare us for utilizing multiple CPU cores and running untrusted user programs in the future.

It seems the plan here is to use this for internal work, and still give a preemptive multitasking API to userspace.

Re:Writing an OS in Rust: Async/Await by jklehm on Monday March 30, 2020 @12:41PM (#22729537)
Isn't that driving against the lesson learned from the past though? 3rd party drivers can not be trusted to behave and hang the kernel when doing so with cooperative multitasking.
Re:Writing an OS in Rust: Async/Await by steveklabnik on Monday March 30, 2020 @12:41PM (#22729554)
I am not sure what Phil's overall kernel design is; you're assuming a monolithic kernel, but not every kernel has drivers in kernel space.
Re:Writing an OS in Rust: Async/Await by jklehm on Monday March 30, 2020 @12:42PM (#22729562)
Fair point, looking forward to following along :)
Re:Writing an OS in Rust: Async/Await by mtnygard on Monday March 30, 2020 @12:51PM (#22729669)
Phil's series is meant for learning rather than production use. So sometimes he takes a "shortcut" in one post then removes the restrictions or workarounds later.
Re:Writing an OS in Rust: Async/Await by eximius on Monday March 30, 2020 @12:42PM (#22729565)
Toy OS, so he has less to worry about. But also maybe just be more careful around kernel modules, if that eventually exists?
Re:Writing an OS in Rust: Async/Await by Koshkin on Monday March 30, 2020 @12:47PM (#22729617)
GP is not wrong, then: with this implementation, async/await still amounts to the good old cooperative multitasking and does not (yet?) take advantage of threads. (In C#, for example, async/await is indeed different from this, being based on TAP - Task-based Asynchronous Pattern, where tasks are executed "asynchronously on a thread pool thread rather than synchronously on the main application thread.")
Re:Writing an OS in Rust: Async/Await by steveklabnik on Monday March 30, 2020 @12:58PM (#22729740)
Async/await lets you build tasks, but is completely orthogonal to threads. You could set up tasks with a 1:1 or N:M or even single threaded model.

And yes, the GP is not wrong that if this were the only mechanism provided, it would be similar. It does not seem like the plan is to expose this externally whatsoever, though.