@mingkangpan at a high level, you have a small number of threads, typically number of cores + 1 or something equivalent
So even though you’re starting 100k coroutines / light-weight-threads / fibers / green threads / etc, you’re only using a small number of threads which monitors these lightweight threads to see if they’ve completed yet.
Since methods are marked as suspendable, the whole call-stack can be snapshotted and be restored when needed - so execution can be paused, especially during things that you have to wait for, like a sleep or a callback.
I’m not sure how the specific implementation of Coroutines work, but Fibers and Quasars do something similar which you can read about here:
https://zeroturnaround.com/rebellabs/what-are-fibers-and-why-you-should-care/