A Rust advanced and operating system introductory exercise repository in the style of rustlings.
Learn Rust concurrency programming, async programming, no_std development, and operating system core concepts through completing code and passing tests.
Prerequisites
Rust toolchain (stable, >= 1.75)
Linux environment: most exercises target x86_64; Module 4 (context switching) only supports riscv64 and requires a riscv64 environment or QEMU user-mode emulation
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Exercise Structure
6 modules, 23 exercises in total, from easy to advanced:
Green thread scheduler, cooperative scheduling, yield
Module 4 only runs on riscv64. Run ./check.sh or use the oscamp CLI as with the rest of the repository — no separate scripts needed. See exercises/04_context_switch/README.md for details.
Built-in interactive terminal tool similar to rustlings, supporting real-time file watching and progress tracking:
oscamp # Start interactive watch mode (default)
oscamp watch # Same as above
oscamp list # View completion status of all exercises
oscamp check # Check all exercises in batch
oscamp run <pkg> # Run tests for specified exercise
oscamp hint <pkg> # View exercise hint
oscamp help# Show help
Watch Mode Features
Automatic file change detection: Automatically re-run tests after saving files
Auto-jump: Automatically jump to next unfinished exercise after current one passes
Real-time progress bar: Show overall completion progress
Shortcuts:
h — View hint for current exercise
l — View list of all exercises
n / p — Next / Previous exercise
r / Enter — Re-run tests
q / Esc — Quit
Manual Execution
# Run tests for a specific exercise
cargo test -p thread_spawn
# View detailed output
cargo test -p thread_spawn -- --nocapture
# Check all exercises
cargo test --workspace
Workflow
Start: Run ./target/debug/oscamp watch to enter interactive mode
Read: Open current exercise file src/lib.rs, read documentation to understand concepts
Code: Find todo!() markers, complete code according to comment hints
Save: After saving file, CLI automatically re-runs tests
Pass: After passing tests, automatically jump to next exercise; press h to view hints anytime
Notes
Some exercises (e.g., Module 2 syscall wrapper, Module 4 assembly) require a Linux environment; Module 4 only supports riscv64
It is recommended to complete exercises in module order; within each module, exercises progress from easy to advanced