Mar 7, 2021

[Go] methods for lock starvation: Barging / Handoff / Spinning

Before Go v1.9.0, methods for thread starvation:

  • Barging
  • Spinning

After Go v.1.9.0 includes:
  • Handoff

Goroutines wait for the lock for more than one millisecond, aka. bounded waiting, will be flagged as starving.

If there are Goroutines flagged as starving, the unlock method will hand off the lock to the first waiter directly.
[reference: Bounded waiting]

If there are Goroutines flagged as starving, the spinning method is deactivated.



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.