26 lines
880 B
C
26 lines
880 B
C
#pragma once
|
|
// ke_sched.h - Multi-Level Feedback Queue scheduler
|
|
// Three run queues (Low / Normal / High). IRQ 0 drives KeSchedulerTick.
|
|
#include <ke_thread.h>
|
|
|
|
#define QUANTUM_MS 10 // base time slice in milliseconds
|
|
|
|
// Called once by KernelMain before any threads are created.
|
|
void KeInitializeScheduler(void);
|
|
|
|
// Add / remove a thread from the run queues.
|
|
void KeReadyThread(THREAD* thread);
|
|
void KeUnreadyThread(THREAD* thread);
|
|
|
|
// Called from the timer ISR every QUANTUM_MS.
|
|
void KeSchedulerTick(void);
|
|
|
|
// Voluntarily yield the CPU. Picks the next runnable thread immediately.
|
|
__declspec(dllexport) void KeYield(void);
|
|
|
|
// Returns the thread currently running on this CPU (reads GS:[0]).
|
|
THREAD* KeGetCurrentThread(void);
|
|
|
|
// Set the current-thread GS slot. Called once per CPU at boot.
|
|
void KeSetCurrentThread(THREAD* thread);
|