sched: add kernel thread creation and SMP-aware thread scheduling

This commit is contained in:
2023-05-04 21:43:18 +01:00
parent bb524c1576
commit 7d321fb7f0
5 changed files with 86 additions and 2 deletions

View File

@@ -89,6 +89,7 @@ struct runqueue {
struct queue rq_queues[PRIO_MAX];
uint32_t rq_readybits;
spin_lock_t rq_lock;
unsigned int rq_nthreads;
struct thread *rq_cur, *rq_idle;
};
@@ -141,6 +142,9 @@ extern bool need_resched(void);
extern struct task *current_task(void);
extern struct thread *current_thread(void);
extern struct runqueue *select_rq_for_thread(struct thread *thr);
extern void schedule_thread_on_cpu(struct thread *thr);
extern void start_charge_period(void);
extern void end_charge_period(void);
@@ -158,7 +162,7 @@ extern struct thread *thread_alloc(void);
extern kern_status_t thread_init(struct thread *thr, uintptr_t ip);
extern int thread_priority(struct thread *thr);
extern void idle(void);
extern struct thread *create_kernel_thread(void(*fn)(void));
extern struct thread *create_idle_thread(void);
extern void add_timer(struct timer *timer);