How jonaskruckenberg/k23 works
Main Components
• WASM Engine and Runtime: The kernel includes a dedicated WASM subsystem, with components for compiling (using both a “compile” folder and Cranelift backend under kernel/src/wasm/cranelift), running WASM modules (runtime), and handling traps. This is central to its experimental approach and should be highlighted as an isolated “WASM Engine” within the kernel.
• Bootloader/Loader: The “loader” directory represents the bootloader component that initializes the hardware, sets up the initial address mappings, and loads the kernel. It contains its own architecture-specific routines and a main entry point.
• Libraries (“libs”): A large set of libraries supports various low-level functions:
• CPU-local storage, frame allocation, fault handling, and address translation/lookup (e.g., libs/cpu-local, libs/addr2line, libs/leb128, libs/riscv).
• Several libraries provide building blocks for WASM encoding, parsing, and execution support (e.g., libs/wasm-encoder, libs/wast).
• Other components, like “libs/spin” for synchronization primitives and “libs/ksharded-slab” for concurrent data structures, are crucial to the kernel’s performance and reliability.
• Testing/CI: Note the “tests”, “.github/workflows”, and other configuration files. While these are not direct runtime components, they indicate continuous integration and testing flows which can be represented as a supporting infrastructure (perhaps as external tools or feedback loops).
Relationships and Data Flow
• Boot Sequence: Represent the flow where the loader (bootloader) initializes the system and hands control over to the kernel.
• Architecture-specific modules (each architecture module feeds into the common kernel functionality).
• Memory management units, including paging, address spaces, and frame allocators.
• The scheduler and task management that drive concurrency and process execution.
Architectural Patterns and Design Principles
• Modularity: Notice how the project is cleanly separated into components (kernel, loader, various libraries), which reflects a modular design ideal for research in microkernel architecture.
• Extensibility: Given the roadmap (e.g., future proposals for concurrency features, extended WASM proposals, drivers, etc.), include notes or placeholders that indicate future expansion points.
• Low-Level Hardware Abstraction: The architecture-specific directories and modules (e.g., interrupt handling in kernel/src/arch, device tree parsing in kernel/src/device_tree.rs) showcase abstracted hardware interfaces.