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
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 8 | void *[2] | m_link | Holds the slot's link in the slot list | verified, proof one | core/scheduler#slot-acquire-and-release |
0x0008 | 4 | uint32_t | m_index | Holds the slot's index in the slot table | verified, proof one | core/scheduler#slot-acquire-and-release |
0x000c | 4 | uint32_t | m_threads | Holds the number of loop threads serving the slot | verified, proof one | core/scheduler#slot-acquire-and-release |
0x0010 | 4 | uint32_t | m_load | Holds the sum of the costs of the slot's contexts | verified, proof one | core/scheduler#load-accounting |
0x0014 | 4 | uint32_t | m_meanLoad | Holds the load divided by the context count, 0 when empty | verified, proof one | core/scheduler#load-accounting |
0x0018 | 4 | uint32_t | m_contexts | Holds the number of contexts the slot holds | verified, proof one | core/scheduler#load-accounting |
0x001c | 4 | uint32_t | m_credit | Holds how many contexts the slot may hand to a lighter slot | verified, proof one | core/scheduler#load-accounting |
0x0020 | 4 | void * | m_event | Holds the auto-reset event that wakes the slot's loop thread | verified, proof one | core/scheduler#slot-acquire-and-release |
0x0024 | 20 | uint32_t[5] | m_heap | Holds the min-heap of contexts: capacity, count, storage, quantum, element offset 0x30 | verified, proof one | core/scheduler#slot-acquire-and-release |