Admit concurrent readers against a fixed capacity and turn the remaining read slots into an admit, hold, or shed remediation action.

RWMutex Read Remediation Report

rwmutex_read_remediation_report.go
package main

import "fmt"

func main() {
	var readers = 
	capacity := 3
	admitted := readers
	if admitted > capacity {
		admitted = capacity
	}
	remaining := capacity - admitted
	var action string
	if remaining >= 2 {
		action = "admit"
	} else if remaining == 1 {
		action = "hold"
	} else {
		action = "shed"
	}
	fmt.Printf("readers=%d admitted=%d remaining=%d %s\n", readers, admitted, remaining, action)
}
package main

import "fmt"

func main() {
	var readers = 
	capacity := 3
	admitted := readers
	if admitted > capacity {
		admitted = capacity
	}
	remaining := capacity - admitted
	var action string
	if remaining >= 2 {
		action = "admit"
	} else if remaining == 1 {
		action = "hold"
	} else {
		action = "shed"
	}
	fmt.Printf("readers=%d admitted=%d remaining=%d %s\n", readers, admitted, remaining, action)
}
package main

import "fmt"

func main() {
	var readers = 
	capacity := 3
	admitted := readers
	if admitted > capacity {
		admitted = capacity
	}
	remaining := capacity - admitted
	var action string
	if remaining >= 2 {
		action = "admit"
	} else if remaining == 1 {
		action = "hold"
	} else {
		action = "shed"
	}
	fmt.Printf("readers=%d admitted=%d remaining=%d %s\n", readers, admitted, remaining, action)
}
read admission The reader admission is modeled with a scalar capacity counter, so the remaining slots stay deterministic and free of lock identity while driving the remediation action.