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
Submitting Scores
Push to the main branch of your repository to trigger the scoring pipeline. GitHub Actions will automatically run all tests, calculate your score (out of 100), and upload it to the OpenCamp leaderboard.
Accept the GitHub Classroom assignment link — this creates your personal repository
Complete exercises locally or in GitHub Codespaces (click “Code” > “Codespaces” > “Create”)
Commit and push your changes to main
Check the “Actions” tab to see your score
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
OS Camp - Rust & OS Advanced Experiments
A Rust advanced and operating system introductory exercise repository in the style of rustlings. Learn Rust concurrency programming, async programming,
no_stddevelopment, and operating system core concepts through completing code and passing tests.Prerequisites
Exercise Structure
6 modules, 23 exercises in total, from easy to advanced:
Module 1: Concurrency (Synchronous) —
01_concurrency_sync/01_thread_spawnthread::spawn,moveclosures,join02_mutex_counterArc<Mutex<T>>, shared state concurrency03_channelmpsc::channel, multiple producer pattern04_process_pipeCommand,Stdio::piped(), process pipesModule 2: no_std Development —
02_no_std_dev/01_mem_primitivesno_stdmemory primitives: memcpy, memset, memmove, strlen, strcmp02_bump_allocatorGlobalAlloctrait, Bump allocator, CAS-based thread safety03_free_list_allocator04_syscall_wrapper05_fd_tableArc<dyn File>, fd reuse strategyModule 3: OS Concurrency Advanced —
03_os_concurrency/01_atomic_counterAtomicU64,fetch_add, CAS loop02_atomic_orderingOnceCell03_spinlockcompare_exchange,spin_loop04_spinlock_guardDeref/DerefMut/Drop05_rwlockstd::sync::RwLock)Module 4: Context Switching —
04_context_switch/(riscv64 only)01_stack_coroutine02_green_threadsModule 4 only runs on riscv64. Run
./check.shor use theoscampCLI as with the rest of the repository — no separate scripts needed. Seeexercises/04_context_switch/README.mdfor details.Module 5: Async Programming —
05_async_programming/01_basic_futureFuturetrait,Poll,Waker02_tokio_taskstokio::spawn,JoinHandle, concurrent tasks03_async_channeltokio::sync::mpsc, async producer-consumer04_select_timeouttokio::select!, timeout control, race executionModule 6: Page Tables —
06_page_table/01_pte_flags02_page_table_walk03_multi_level_pt04_tlb_simQuick Start
Interactive CLI Tool (
oscamp)Built-in interactive terminal tool similar to rustlings, supporting real-time file watching and progress tracking:
Watch Mode Features
h— View hint for current exercisel— View list of all exercisesn/p— Next / Previous exerciser/Enter— Re-run testsq/Esc— QuitManual Execution
Workflow
./target/debug/oscamp watchto enter interactive modesrc/lib.rs, read documentation to understand conceptstodo!()markers, complete code according to comment hintshto view hints anytimeSubmitting Scores
Push to the
mainbranch of your repository to trigger the scoring pipeline. GitHub Actions will automatically run all tests, calculate your score (out of 100), and upload it to the OpenCamp leaderboard.mainNotes
License
MIT