From fb7895bc23ce4359a3574103ae4a7864669e5a95 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Wed, 29 May 2024 01:23:40 -0500 Subject: kernel: sched: implement the round-robin scheduler Implement a basic round-robin scheduler and tie it to the PIT timer interrupt on x86. Signed-off-by: Danny Holman --- include/kernel/sched.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/kernel/sched.h b/include/kernel/sched.h index fef36b8..00a5d95 100644 --- a/include/kernel/sched.h +++ b/include/kernel/sched.h @@ -2,26 +2,19 @@ #define KERNEL_SCHED_H #include -#include - -#define THREAD_READY 0 -#define THREAD_RUNNING 1 -#define THREAD_WAIT 2 - -struct task_block { - unsigned int pid; - unsigned int parent_pid; - int nice; - unsigned int num_threads; - struct thread_block *threads; - struct list_head list; -}; +#include +#include void sched_init(void); void schedule_next(void); +void schedule_thread(struct kthread *thread); + +void block_thread(struct kthread *thread); +void unblock_thread(struct kthread *thread); + +void sched_lock(void); +void sched_unlock(void); -struct task_block* init_task(int nice, unsigned int ppid); -void schedule_thread(struct thread_block *thread); -void switch_thread(struct thread_block *old, struct thread_block *new); +void switch_thread(struct kthread *old, struct kthread *new); #endif -- cgit v1.2.3