benilla-re systems structs docs

EvtThread

struct · core · 56 bytes

Meaning
Holds a scheduler slot: its list link, thread count, load, event and heap of contexts
Confidence
verified, proof one
Finding
core/scheduler#slot-acquire-and-release

Finding: Slot acquire and release in core: scheduler

AcquireSlot (0x421080) returns the index of the slot a loop thread serves. Under the slot lock 0x883ef4 it takes the first empty table entry, else the entry with the fewest threads (+0x0c, the lowest index on a tie). An empty entry gets a new slot: an auto-reset event, initially unset, at +0x20, an empty heap with element offset 0x30, and the last place in the slot list. The thread count rises by 1. ReleaseSlot (0x4211d0) lowers it. At 0 it clears the table entry, empties the heap, frees the slot, then sets the run state of each removed context to 1 when it is 0 and tears it down with 0x420e60 on the calling thread, the last one removed first.

The derivation is in the doc.

Fields 9

offsetsizetypenamemeaningconfidencefinding
0x00008void *[2]m_linkHolds the slot's link in the slot listverified, proof onecore/scheduler#slot-acquire-and-release
0x00084uint32_tm_indexHolds the slot's index in the slot tableverified, proof onecore/scheduler#slot-acquire-and-release
0x000c4uint32_tm_threadsHolds the number of loop threads serving the slotverified, proof onecore/scheduler#slot-acquire-and-release
0x00104uint32_tm_loadHolds the sum of the costs of the slot's contextsverified, proof onecore/scheduler#load-accounting
0x00144uint32_tm_meanLoadHolds the load divided by the context count, 0 when emptyverified, proof onecore/scheduler#load-accounting
0x00184uint32_tm_contextsHolds the number of contexts the slot holdsverified, proof onecore/scheduler#load-accounting
0x001c4uint32_tm_creditHolds how many contexts the slot may hand to a lighter slotverified, proof onecore/scheduler#load-accounting
0x00204void *m_eventHolds the auto-reset event that wakes the slot's loop threadverified, proof onecore/scheduler#slot-acquire-and-release
0x002420uint32_t[5]m_heapHolds the min-heap of contexts: capacity, count, storage, quantum, element offset 0x30verified, proof onecore/scheduler#slot-acquire-and-release