User-managed concurrency groups
User-managed concurrency groups
Posted Dec 31, 2021 16:11 UTC (Fri) by foom (subscriber, #14868)In reply to: User-managed concurrency groups by Cyberax
Parent article: User-managed concurrency groups
Yet, a syscall could take longer than that on-cpu (without blocking), in which case you've over-scheduled work vs number of cpus. Alternately, a syscall might block immediately, in which case you've wasted time, where you could've run another goroutine.
To ameliorate those issues in common cases, there's two other variants of syscall entry, one for invoking a syscall that "never" blocks, and another for syscalls that are considered to very likely immediately block, which resumes another goroutine immediately.)
This mechanism clearly works, but it really doesn't seem ideal. If the kernel could, instead, notify the go scheduler when a thread has blocked, all this guessing and heuristics could be eliminated.
Posted Dec 31, 2021 22:47 UTC (Fri)
by Cyberax (✭ supporter ✭, #52523)
[Link]
I'm not sure if it would help. You still need a scheduler thread and checking for a stuck thread right now is pretty fast. I guess one thing that might be helpful is ability to force-preempt threads. Right now Go uses signals for that, and signals have their drawbacks.
User-managed concurrency groups