linux-sysprog · beginner · ~15 min
Reason about pipe back-pressure.
A pipe has a fixed capacity. Implement int write_would_block(int inflight, int capacity, int n) returning 1 if writing n more bytes would exceed capacity (inflight + n > capacity), else 0.
int write_would_block(int inflight, int capacity, int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.