Fixed-priority preemptive scheduler
This commit is contained in:
+9
-4
@@ -31,7 +31,10 @@ rather than restate it. Roughly in the order things happen at runtime:
|
||||
9. **[heap.md](heap.md) — the kernel heap.** A growable free-list allocator built on
|
||||
the VMM, exposed as a `std.mem.Allocator` so std containers work — dynamic
|
||||
allocation for the kernel.
|
||||
10. **[halting.md](halting.md) — halting.** Why a kernel can't just "exit", and
|
||||
10. **[scheduling.md](scheduling.md) — the scheduler.** Fixed-priority preemptive
|
||||
multitasking: kernel threads, the context switch, and O(1) priority selection —
|
||||
the leap to a running system.
|
||||
11. **[halting.md](halting.md) — halting.** Why a kernel can't just "exit", and
|
||||
how `while (true) hlt` parks the CPU safely once there's nothing left to do.
|
||||
|
||||
Start with the north star:
|
||||
@@ -61,9 +64,10 @@ into a **frame allocator** ([frame-allocator.md](frame-allocator.md)), installs
|
||||
its **descriptor tables** so CPU faults are caught ([interrupts.md](interrupts.md)),
|
||||
builds its own **page tables** and switches onto them ([paging.md](paging.md)),
|
||||
brings up the **heap** for dynamic allocation ([heap.md](heap.md)), starts the
|
||||
**timer** so it has a heartbeat ([device-interrupts.md](device-interrupts.md)),
|
||||
runs — its CPU-specific bits behind the [arch](arch.md) boundary — and when it has
|
||||
finished, or panics, it **halts** ([halting.md](halting.md)).
|
||||
**scheduler** ([scheduling.md](scheduling.md)) and the **timer** that preempts it
|
||||
([device-interrupts.md](device-interrupts.md)), runs — its CPU-specific bits behind
|
||||
the [arch](arch.md) boundary — and when idle, or on a panic, it **halts**
|
||||
([halting.md](halting.md)).
|
||||
|
||||
## Source map
|
||||
|
||||
@@ -74,6 +78,7 @@ finished, or panics, it **halts** ([halting.md](halting.md)).
|
||||
| Shared loader↔kernel contract (`BootInfo`, `Framebuffer`, `MemoryMap`, ABI) | `src/root.zig` |
|
||||
| Physical frame allocator | `src/pmm.zig` |
|
||||
| Kernel heap (`std.mem.Allocator`) | `src/heap.zig` |
|
||||
| Scheduler (fixed-priority preemptive) | `src/sched.zig` |
|
||||
| Framebuffer text console (mirrors to serial) | `src/console.zig` |
|
||||
| In-kernel test cases | `src/tests.zig` |
|
||||
| Arch-specific kernel code (`halt`, GDT/IDT/TSS, exception + interrupt stubs, page tables, APIC/timer, serial, linker script) | `src/arch/x86_64/` |
|
||||
|
||||
Reference in New Issue
Block a user