Spend a contention budget against a fixed limit and turn the acquired and rejected counts into a spend, drain, or throttle remediation action.

Mutex Budget Remediation Report

mutex_budget_remediation_report.go
package main

import "fmt"

func main() {
	var budget = 
	limit := 2
	acquired := 0
	rejected := 0
	for i := 0; i < budget; i++ {
		if acquired < limit {
			acquired++
		} else {
			rejected++
		}
	}
	remaining := limit - acquired
	var action string
	if rejected > 0 {
		action = "throttle"
	} else if remaining == 0 {
		action = "drain"
	} else {
		action = "spend"
	}
	fmt.Printf("budget=%d acquired=%d rejected=%d %s\n", budget, acquired, rejected, action)
}
package main

import "fmt"

func main() {
	var budget = 
	limit := 2
	acquired := 0
	rejected := 0
	for i := 0; i < budget; i++ {
		if acquired < limit {
			acquired++
		} else {
			rejected++
		}
	}
	remaining := limit - acquired
	var action string
	if rejected > 0 {
		action = "throttle"
	} else if remaining == 0 {
		action = "drain"
	} else {
		action = "spend"
	}
	fmt.Printf("budget=%d acquired=%d rejected=%d %s\n", budget, acquired, rejected, action)
}
package main

import "fmt"

func main() {
	var budget = 
	limit := 2
	acquired := 0
	rejected := 0
	for i := 0; i < budget; i++ {
		if acquired < limit {
			acquired++
		} else {
			rejected++
		}
	}
	remaining := limit - acquired
	var action string
	if rejected > 0 {
		action = "throttle"
	} else if remaining == 0 {
		action = "drain"
	} else {
		action = "spend"
	}
	fmt.Printf("budget=%d acquired=%d rejected=%d %s\n", budget, acquired, rejected, action)
}
budget limit The contention limit and budget are scalars, so the acquired and rejected counts that drive the remediation action stay deterministic and free of lock identity.