Kernel threads
The kernel currently uses asynchronous scheduling via a Rust async runtime. This works, but has a few drawbacks:
- Each function runs in sequence (even if it is marked as
async). - The kernel has no way of executing multiple tasks at once, slowing the boot process.
The bonus to this is that this will be remarkably easy. We use the spin crate for synchronization primitives, so that gives us locks and lazy initialization. As such, all the data structures that need to be encapsulated within a lock
or that need to be lazily initialized are already encapsulated using these mechanisms. As such, we won't need to do much refactoring. This will also make SMP support (as defined in issue #12) much simpler as well.
This issue depends primarily on a preemptive scheduler. Thus, this issue and issue #7 are closely linked. However, we do not need a preemptive scheduler for this to work; if we can launch other cores or processors to do parallel work alongside the BSP, that will suffice as well. Resolving both issue #7 and #12 would be the best outcome, however this will take time, since the new MP wakeup mechanism that ACPI defines in v. 6.4 most likely hasn't been propagated to EDK II or QEMU.