summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-05-29 01:23:40 -0500
committerDanny Holman <dholman@gymli.org>2024-05-29 01:23:40 -0500
commitfb7895bc23ce4359a3574103ae4a7864669e5a95 (patch)
tree55b499de39568378106117229835ebb19619ffb1 /include
parentc85e601ddac49f7519563371eb993386598ce826 (diff)
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 <dholman@gymli.org>
Diffstat (limited to 'include')
-rw-r--r--include/kernel/sched.h27
1 files changed, 10 insertions, 17 deletions
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 <kernel/asm.h>
-#include <kernel/data/list.h>
-
-#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 <kernel/kthread.h>
+#include <stdint.h>
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