Re:Threads, Threads, and More Threads
by tcfhgj on Tuesday March 22, 2022 @08:19PM
(#30773326)
Does this still hold if you use async/await which simply would push a different task on the thread while the other one is waiting?
[ Parent
| on HN ]
Re:Threads, Threads, and More Threads
by marginalia_nu on Tuesday March 22, 2022 @08:29PM
(#30773393)
As far as the operating system is concerned, a thread is a thread. Async/await is a pattern for hiding the implementation details of multitasking or faking it in languages with limited support, it still largely works the same, except you see it as the thread being yielded to rather than from in explicit threading.
Async-await uses non-blocking operations in the kernel. If blocking operations need to occur, then these can occur on a separate thread but this is rare. Most things have a non-blocking equivalent.
Re:Threads, Threads, and More Threads
by preseinger on Tuesday March 22, 2022 @11:24PM
(#30774532)
Async/await is an abstraction that exists at a layer above OS threads. "Non-blocking" isn't well defined when speaking about OS threading models.