Skip to main content

Module pool

Module pool 

Source
Expand description

A fixed array of frames, allocated once and never grown.

Eviction is CLOCK: one reference bit per frame, a hand that sweeps. LRU’s per-entry links are pure overhead at this budget.

SACRIFICE (Law 4): CLOCK approximates LRU, so a pathological access order can evict a page that LRU would have kept. Bought: one bit per frame instead of two pointers, and no list surgery on every hit.

Each frame carries a pin count plus a writer flag. The count keeps a frame out of victim’s reach while any guard references it; the flag additionally enforces reader/writer exclusivity between get and get_mut on the same page, the same way RefCell enforces it between borrow and borrow_mut — a conflicting request panics rather than handing out a second &mut [u8] over memory another guard already points into. Without that flag, get and get_mut on the same page_no could alias a live &[u8]/&mut [u8] pair, which the unsafe fns on AlignedRegion exist specifically to rule out.

Structs§

BufferPool
PinnedRead
PinnedWrite
PoolStats