KScheduler

KScheduler

class KScheduler extends KSchedulableInterruptEvent;

Size : 0x228 bytes

OffsetTypeDescription
0x0void **Pointer to vtable
0x4KSynchronizationObject *Inherited field. Unused.
0x8u32Count for thread switch attempts - this is only added to if a context switch function runs but exits because the scheduler is locked by another thread.
0xCboolContext switch needed
0xDboolContext switch started during interrupt
0xEboolTrigger CPU cross-core interrupt (interrupt 8)
0xFboolPost-interrupt rescheduling needed
0x10s16Scheduler core number
0x12s16Count of threads currently being managed by this scheduler object
0x14u32Bit field for high priority threads in KScheduler(0-31)
0x18u32Bit field for low priority threads in KScheduler(32-63)
0x1CKThread*Scheduler’s idle thread (runs when no other runnable thread is available)
0x20KThreadLinkedListLinked list of threads managed by this KScheduler instance
0x28ThreadSchedulePrioList[64]List of KThread pair structs by priority

There is 1 KScheduler object per core.

KScheduler instances are mapped to SGI #8. The interrupt handler/callback returns 1, which triggers a post-interrupt rescheduling and context switch (like all the other handlers not returning NULL), but does nothing else in particular. The second virtual method is stubbed.

Each priority of KThread has an associated linked list of KThreads object pointers below the KScheduler object. Each pair of pointers makes up 1 entry in that core’s Scheduler for their priority.

Priority bit fields:

Each bit field goes from the most significant bit to the least significant bit, high priority to low priority. This means, for example, that bit 31 in the high priority bit field is for priority 0 and bit 0 is for priority 31. These fields are set when a KThread with the corresponding priority is added for scheduling and are cleared when the last KThread in the linked list for a given priority is removed from the scheduler.

Category:Kernel interrupt events