Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Starving, sleeping, and yielding: understanding Go's scheduler (bitfieldconsulting.com)
6 points by ingve 31 days ago | hide | past | favorite | 2 comments


> but goroutine B (the goroutineB function) apparently never ran at all.

Untrue. Up the iterations to 1000, you'll get your interleaving. Since 1.14, goroutines are async preemptible (async safe points), and will not block the scheduler. Also, time.Sleep bad, use runtime.Gosched().


time.Sleep bad? Grug no understand.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: