Operational Remediation Reports
Permit Pool Remediation Report
Admit readers against a fixed permit pool and turn the remaining permits into an admit, hold, or shed remediation action.
remaining capacity
The permit pool is modeled with a scalar counter, so the remaining permits stay deterministic and free of atomic identity while driving the remediation action.
Permit Pool Remediation Report
PermitPoolRemediationReport.kt
Replay: real traced execution (multi-file project)
fun main() {
val readers = 1
val capacity = 3
var admitted = readers
if (admitted > capacity) {
admitted = capacity
}
val remaining = capacity - admitted
val action = if (remaining >= 2) {
"admit"
} else if (remaining == 1) {
"hold"
} else {
"shed"
}
println("readers=$readers admitted=$admitted remaining=$remaining $action")
}
fun main() {
val readers = 2
val capacity = 3
var admitted = readers
if (admitted > capacity) {
admitted = capacity
}
val remaining = capacity - admitted
val action = if (remaining >= 2) {
"admit"
} else if (remaining == 1) {
"hold"
} else {
"shed"
}
println("readers=$readers admitted=$admitted remaining=$remaining $action")
}
fun main() {
val readers = 4
val capacity = 3
var admitted = readers
if (admitted > capacity) {
admitted = capacity
}
val remaining = capacity - admitted
val action = if (remaining >= 2) {
"admit"
} else if (remaining == 1) {
"hold"
} else {
"shed"
}
println("readers=$readers admitted=$admitted remaining=$remaining $action")
}
readers ← 1, capacity ← 3, admitted ← 1, remaining ← 2, action ← admit
1fun main() {2 val readers→ 1 = 1 //@readers=2, 43 val capacity→ 3 = 34 var admitted→ 1 = readers15 if (admitted > capacity) {6 admitted = capacity7 }8 val remaining→ 2 = capacity3 - admitted1910 val action→ admit = if (remaining2 >= 2) {11 "admit"12 } else if (remaining2 == 1) {13 "hold"14 } else {15 "shed"16 }1718 println("readers=$readers1 admitted=$admitted1 remaining=$remaining2 $actionadmit")19}outputreaders=1 admitted=1 remaining=2 admit
readers ← 2, capacity ← 3, admitted ← 2, remaining ← 1, action ← hold
1fun main() {2 val readers→ 2 = 23 val capacity→ 3 = 34 var admitted→ 2 = readers25 if (admitted > capacity) {6 admitted = capacity7 }8 val remaining→ 1 = capacity3 - admitted2910 val action→ hold = if (remaining1 >= 2) {11 "admit"12 } else if (remaining1 == 1) {13 "hold"14 } else {15 "shed"16 }1718 println("readers=$readers2 admitted=$admitted2 remaining=$remaining1 $actionhold")19}outputreaders=2 admitted=2 remaining=1 hold
readers ← 4, capacity ← 3, admitted ← 4
1fun main() {2 val readers→ 4 = 43 val capacity→ 3 = 34 var admitted→ 4 = readers45 if (admitted > capacity) {admitted ← 3
4var admitted = readers5if (admitted4 > capacity3) {6 admitted→ 3 = capacity37}remaining ← 0, action ← shed
7 }8 val remaining→ 0 = capacity3 - admitted3910 val action→ shed = if (remaining0 >= 2) {11 "admit"12 } else if (remaining0 == 1) {13 "hold"14 } else {15 "shed"16 }1718 println("readers=$readers4 admitted=$admitted3 remaining=$remaining0 $actionshed")19}outputreaders=4 admitted=3 remaining=0 shed