3 ms·
Yeah, async is a type of greenthreading.
by hot_gril 3y ago
Yeah, async is a type of greenthreading.
- hu3 3y agoWhen I read async, I think about an event loop in a single thread. Meanwhile when I read greenthreading, I think of lightweight threads like goroutines or Java's virtual threads. Am I wrong?
- hot_gril 3y agoRight. Both of them are running on a single OS thread with application-layer context switching. Async's form of context switching is the event loop, greenthreading's is something analogous to OS threads. Maybe it's inaccurate to say async is a type of greenthreading and better to say it's a form of application-layer context-switching comparable to greenthreading.
- metaltyphoon 3y agoWhen I think of green threads / fibers, its threading handled in user space. Where a stack is starts small and it can grow and its managed by the language’s runtime.