How can I visualize the call stack of a single thread that is executing the co-routine functions?
Does any language implementation support co-routines running in different threads?
I came across the awesome Stack Overflow question Difference between a “coroutine” and a “thread”?. In this question, I saw this point:
[I]f you have a routine doing some work and it performs an operation you know will block for some time (i.e. a network request), with a co-routine you can immediately switch to another routine without the overhead of including the system scheduler in this decision - yes you the programmer must specify when co-routines can switch.
In JS, if I have a routine (some function) which is a CPU bound operation (not IO/Network request), then can I still use co-routines (i.e., generators in JS)? Or shall I use Web Workers so I don’t block the event loop (i.e. at least UI rendering happens)?