Expand description
Process Management Module
Chapter 6 - Process Management Experiment
Modules§
- context
- elf
- ELF64 parser for user program loading.
- pcb
- pid
- scheduler
- state
- PTA Exercise: Process state machine using Rust enum + match. Students implement ProcessState, Event, and next_state().
- switch
- Context switch assembly — bootstrap only.
- user
- User-mode task creation and address space management.
- user_
elf - Minimal RISC-V ELF64 user program embedded in the kernel.
Structs§
Enums§
Constants§
Functions§
- create_
kernel_ ⚠task - Create a kernel task PCB backed by the supplied stack.
- debug_
scheduler_ state - exec_
current - Replace the current process image with a new ELF loaded from
path. FD table is preserved; address space and context are rebuilt. - exec_
current_ into_ trap_ frame - Replace the current image and, on success, copy the new process context into
the live trap frame that
trap_returnwill restore. - exit_
current_ and_ switch - Exit the current process. Does NOT return — jumps to
trap_return. - fork_
current - Fork the current user process by deep-copying the parent’s user pages. Returns child PID (to parent) or 0 (to child).
- init_
frame_ allocator_ from - kernel_
page_ table_ paddr - scheduler_
tick - Called on every timer tick with the current trap frame.
If the scheduler picks a different task, the trap frame is
updated in-place so that
trap_returnresumes the new task. - set_
kernel_ page_ table_ paddr - start_
first_ ⚠task - Safety
- wait_
current - Wait for any child to exit. If a zombie exists, returns its PID. If children exist but none are zombies, blocks the current process and jumps directly to trap_return (does NOT return). If no ready task can run while the parent is blocked, returns EBUSY instead of parking the parent without a runnable handoff. Returns -1 if no children exist.
- with_
frame_ allocator