starkernel: item 3.4 -- density ranking
Punch list §25 item 3.4 complete. stadium_density(cell_index) reads a header's heat and mass and returns heat / mass -- a division on demand from fields already stored in the cell, matching §19.3's "read, not computed by a scheduler" literally. Stays valid Q48.16 without a special fixed-point routine, since heat is already Q48.16 and mass is a plain integer divisor. mass == 0 and an out-of-range cell_index both return 0 rather than dividing by zero -- an empty or never-admitted slot has no footprint to be dense within. Deliberately not built here, per the item's own wording: finding the densest or least-dense resident (§19.3's admission/eviction comparison) is item 3.5's scope, not this one's. Nothing calls stadium_density() yet either. Verified: three-architecture boot (amd64, aarch64, riscv64), all reaching ok> with identical dict_hash=0x3d4e1daf289da94f matching the item-3.3 baseline. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
378d688898
commit
0b47c256fc
@@ -178,6 +178,29 @@ typedef enum {
|
||||
*/
|
||||
void stadium_dispatch(size_t cell_index, StadiumBehaviour behaviour);
|
||||
|
||||
/*
|
||||
* stadium_density - Heat / mass for the patron header at cell_index (FABRIC.md
|
||||
* §19.2, §19.3). Read, not computed by a scheduler: both operands already
|
||||
* live in the header, so this is a division on demand, not maintained
|
||||
* bookkeeping. Result stays valid Q48.16, since heat is already Q48.16 and
|
||||
* mass is a plain integer divisor.
|
||||
*
|
||||
* Returns 0 if mass is 0 -- an empty or never-admitted slot (everything is
|
||||
* zero-initialized by stadium_boot_init() until something is actually born
|
||||
* into the Stadium, which nothing yet does) has no footprint to be dense
|
||||
* within, rather than a division by zero.
|
||||
*
|
||||
* Does not validate that cell_index actually holds a header rather than a
|
||||
* continuation cell or an out-of-range index -- callers are expected to
|
||||
* consult the item-3.1 discriminator bitmap first. Ranking (finding the
|
||||
* densest or least-dense resident) is item 3.5's scope, not this one's;
|
||||
* this function only supplies the per-cell value that comparison reads.
|
||||
*
|
||||
* @param cell_index Index into the Stadium of the patron header to measure.
|
||||
* @return Density in Q48.16, or 0 if the header's mass is 0.
|
||||
*/
|
||||
uint64_t stadium_density(size_t cell_index);
|
||||
|
||||
#endif /* __STARKERNEL__ */
|
||||
|
||||
#endif /* STARKERNEL_VM_STADIUM_H */
|
||||
Reference in New Issue
Block a user