Operational Remediation Reports
Reader Pool Remediation Report
Admit readers against a fixed pool capacity and turn the remaining slots into an admit, hold, or shed remediation action.
remaining capacity
The reader pool capacity is modeled with a scalar counter, so the remaining slots stay deterministic and free of atomic identity while driving the remediation action.
Reader Pool Remediation Report
reader_pool_remediation_report.cpp
Replay: real traced execution (multi-file project)
#include <iostream>
#include <string>
int main() {
int readers = 1;
const int capacity = 3;
int admitted = readers;
if (admitted > capacity) {
admitted = capacity;
}
int remaining = capacity - admitted;
std::string action;
if (remaining >= 2) {
action = "admit";
} else if (remaining == 1) {
action = "hold";
} else {
action = "shed";
}
std::cout << "readers=" << readers
<< " admitted=" << admitted
<< " remaining=" << remaining
<< " " << action << std::endl;
return 0;
}
#include <iostream>
#include <string>
int main() {
int readers = 2;
const int capacity = 3;
int admitted = readers;
if (admitted > capacity) {
admitted = capacity;
}
int remaining = capacity - admitted;
std::string action;
if (remaining >= 2) {
action = "admit";
} else if (remaining == 1) {
action = "hold";
} else {
action = "shed";
}
std::cout << "readers=" << readers
<< " admitted=" << admitted
<< " remaining=" << remaining
<< " " << action << std::endl;
return 0;
}
#include <iostream>
#include <string>
int main() {
int readers = 4;
const int capacity = 3;
int admitted = readers;
if (admitted > capacity) {
admitted = capacity;
}
int remaining = capacity - admitted;
std::string action;
if (remaining >= 2) {
action = "admit";
} else if (remaining == 1) {
action = "hold";
} else {
action = "shed";
}
std::cout << "readers=" << readers
<< " admitted=" << admitted
<< " remaining=" << remaining
<< " " << action << std::endl;
return 0;
}
readers ← 1, capacity ← 3, admitted ← 1, remaining ← 2, action ← (empty)
4int main() {5 int readers→ 1 = 1; //@readers=2, 46 const int capacity→ 3 = 3;7 int admitted→ 1 = readers1;8 if (admitted > capacity) {9 admitted = capacity;10 }11 int remaining→ 2 = capacity3 - admitted1;1213 std::string action→ (empty);14 if (remaining >= 2) {action ← admit
13std::string action;14if (remaining2 >= 2) {15 action→ admit = "admit";16} else if (remaining == 1) {std::cout << "readers=" << readers
22 std::cout << "readers=" << readers123 << " admitted=" << admitted124 << " remaining=" << remaining225 << " " << actionadmit << std::endl;26 return 0;27}outputreaders=1 admitted=1 remaining=2 admit
readers ← 2, capacity ← 3, admitted ← 2, remaining ← 1, action ← (empty)
4int main() {5 int readers→ 2 = 2;6 const int capacity→ 3 = 3;7 int admitted→ 2 = readers2;8 if (admitted > capacity) {9 admitted = capacity;10 }11 int remaining→ 1 = capacity3 - admitted2;1213 std::string action→ (empty);14 if (remaining >= 2) {action ← hold
15 action = "admit";16} else if (remaining1 == 1) {17 action→ hold = "hold";18} else {std::cout << "readers=" << readers
22 std::cout << "readers=" << readers223 << " admitted=" << admitted224 << " remaining=" << remaining125 << " " << actionhold << std::endl;26 return 0;27}outputreaders=2 admitted=2 remaining=1 hold
readers ← 4, capacity ← 3, admitted ← 4
4int main() {5 int readers→ 4 = 4;6 const int capacity→ 3 = 3;7 int admitted→ 4 = readers4;8 if (admitted > capacity) {admitted ← 3
7int admitted = readers;8if (admitted4 > capacity3) {9 admitted→ 3 = capacity3;10}remaining ← 0, action ← (empty)
10}11int remaining→ 0 = capacity3 - admitted3;1213std::string action→ (empty);14if (remaining >= 2) {action ← shed
17 action = "hold";18} else {19 action→ shed = "shed";20}std::cout << "readers=" << readers
22 std::cout << "readers=" << readers423 << " admitted=" << admitted324 << " remaining=" << remaining025 << " " << actionshed << std::endl;26 return 0;27}outputreaders=4 admitted=3 remaining=0 shed