3 ms·
They're not OS-level because there isn't wide consensus on the right way to do things yet. Rust, C#, and JS all have similar concepts of async, but they're all
by ReactiveJelly 5y ago
They're not OS-level because there isn't wide consensus on the right way to do things yet.
Rust, C#, and JS all have similar concepts of async, but they're all slightly different. None of them would be trivial to adapt to other system langs like C and C++ - Rust requires compiler support to take apart async functions and put them back together as state machine, and the others lean on their GC. (And also compiler support, IIRC) I think there is a proposal to add coroutines in the new C++ standard, but I'm not sure how it would be done in the kernel.
And sometimes I see people saying, "async is very bad, just use coroutines." Having only used Lua coroutines, I don't understand what the big difference is supposed to be.
But mostly, these runtimes don't need OS-level support. Async is sort of a way to do concurrency without a kernel-level context switch for every task switch, right? If it's working so well in-process, why involve the OS at all?
> wondering if at this point we need an OS at all
Depends what you mean by OS. If you deploy in a container, of course your OS shares its kernel with the host. But for some user stories, (glares at Android) "OS" means all the software, including a Blink-based web browser, a plethora of GUI programs, and other things that I would rather call a "desktop environment" than an OS.
- paavohtl 5y ago> Rust requires compiler support to take apart async functions and put them back together as state machine, and the others lean on their GC C# actually does the same thing, though it indeed still relies on GC.