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

@@ -19,6 +19,15 @@ void print_kernel_banner(void)
printk("Socks kernel version " BUILD_ID);
}
void background_thread(void)
{
printk("background_thread() running on processor %u", this_cpu());
while (1) {
milli_sleep(500);
printk("tock");
}
}
void kernel_init(uintptr_t arg)
{
ml_init(arg);
@@ -38,6 +47,8 @@ void kernel_init(uintptr_t arg)
run_all_tests();
create_kernel_thread(background_thread);
while (1) {
milli_sleep(1000);
printk("tick");