A teaching kernel: scheduler, paging, and a tiny VFS.

1#include <stdint.h>
2
3typedef struct { uint32_t pid; uint32_t state; } task_t;
4
5static task_t tasks[64];
6static uint32_t task_count;
7
8void schedule(void) {
9 for (uint32_t i = 0; i < task_count; i++) {
10 if (tasks[i].state == 1) {
11 /* pick the next runnable task */
12 return;
13 }
14 }
15}
16
16 lines · 298 bytesLast updated 2 days ago