4 ms·
Simply using 1,000+ OS threads is often very close to as efficient as using coroutines or an event loop: https://www.slideshare.net/e456/tyma-paulmultithreaded1
by jashmatthews 9y ago
Simply using 1,000+ OS threads is often very close to as efficient as using coroutines or an event loop:
https://www.slideshare.net/e456/tyma-paulmultithreaded1 https://www.slideshare.net/e456/tyma-paulmultithreaded1
- zzzcpan 9y agoIf your event loop is as slow as 1000+ coroutines or OS threads, you are doing it very very wrong.
- jashmatthews 9y agoAFAIK the main benefit to coroutines is getting to manually manage tiny stacks. For example, in Go, they mark a goroutine's stack as "hasn't executed since the last time we marked", which makes GC with thousands of threads a lot faster.
- arghwhat 9y ago[Citation needed]
- jashmatthews 9y agohttps://github.com/golang/go/issues/12061 https://github.com/golang/go/issues/12061 "Mark termination does not have to rescan stacks that haven’t executed since the last scan" With pre-emptive scheduling of OS threads, you potentially dirty a ton more stacks, and have to scan them all for pointers to heap memory. I'm not sure how VMs using lots of OS threads deal with this.