SCore is a RISC-V based microkernel operating system designed for educational purposes. It is an evolution of RCore, the teaching OS from Tsinghua University's OS training camp, and was jointly developed and optimized by Lin Yuchen and Zhang Yiwen, undergraduate students from the College of Computer Engineering and Science at Shanghai University.
The architecture of SCore is illustrated below:

- Modular Component Design: The system is designed with modular components, where each component interacts with others through clearly defined interfaces. This approach enhances the system's maintainability, extensibility, and security, allowing modules to be developed, tested, and replaced independently, thereby reducing system coupling.
- Stride Scheduling Algorithm: The system employs the Stride Scheduling algorithm, a fair scheduling mechanism based on priority allocation. This algorithm dynamically adjusts the execution order of processes based on their respective strides, ensuring fairness and effectively preventing issues like priority inversion and starvation, thus optimizing system resource allocation.
- LRU Block Cache Algorithm: To improve memory management efficiency, the system utilizes the LRU (Least Recently Used) algorithm to manage the block cache. This policy prioritizes the eviction of the least recently used blocks, which increases the cache hit rate and enhances overall system performance.
- Extensive Use of Rust Macros: Rust macros are widely used throughout the codebase to improve code flexibility and reusability. By using macros, we simplify the implementation of common code patterns, reduce redundancy, and enhance the code's abstraction and extensibility. This not only boosts development efficiency but also improves code maintainability.
This section lists the main documentation for the project.
- Microkernel
- Kernel Startup: The boot process of SCore.
- SBI Calls: Implementation of Rust SBI calls in SCore.
- Process Management: Implementation of the process management module in SCore.
- Memory Management: Implementation of the memory management module in SCore.
- Trap Handling: Implementation of the trap handling module in SCore.
- File System
- File System: A simple, in-memory-based file system.
- User-level Application Support
- User Applications: User programs for testing kernel features.
- System Calls: System calls provided by SCore.
- Docker
Build the Docker image by running the following command in the project's root directory:
make build_dockerStart the Docker environment:
make dockerNavigate to the os directory:
cd osRun the kernel:
make runBuild the documentation:
make docSCore
├── bootloader
│ └── rustsbi-qemu.bin
├── Dockerfile
├── easy-fs (A simple file system, EasyFileSystem, implementation)
│ ├── Cargo.toml
│ └── src
│ ├── bitmap.rs (Bitmap abstraction)
│ ├── block_cache.rs (Block cache layer, caches some blocks from the block device in memory)
│ ├── block_dev.rs (BlockDevice abstract interface)
│ ├── efs.rs (Disk layout of the entire EasyFileSystem)
│ ├── layout.rs (In-memory layout of on-disk data structures)
│ ├── lib.rs
│ └── vfs.rs (Core virtual file system abstraction, i.e., Inode)
├── easy-fs-fuse (Packages user-space executables into the easy-fs format)
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── Makefile
├── os
│ ├── build.rs (Links application ELF files to form link_app.S)
│ ├── Cargo.toml
│ ├── Makefile
│ └── src
│ ├── config.rs
│ ├── console.rs
│ ├── drivers (Block device drivers for QEMU and K210 platforms)
│ ├── entry.asm (Assembly code for the entry point)
│ ├── fs (File system support for regular files)
│ ├── lang_items.rs (Panic handler implementation)
│ ├── link_app.S
│ ├── linker-qemu.ld (Kernel address space layout)
│ ├── loader.rs (Application loader)
│ ├── main.rs
│ ├── mm (Memory management module implementation)
│ ├── sbi.rs (Interface for RustSBI calls)
│ ├── syscall (System call module implementation)
│ ├── task (Process scheduling implementation)
│ ├── timer.rs (Timer implementation)
│ ├── trap (Trap handler implementation)
└── usr
├── Cargo.lock
├── Cargo.toml
├── Makefile
└── src
├── bin (User applications)
├── console.rs (Provides the println! macro)
├── lang_items.rs (Panic handler implementation)
├── lib.rs (Library for user applications)
├── linker.ld (Application memory layout)
└── syscall.rs (System call interface implementation)
- SCore is based on the official rCore-Tutorial-Book-v3.
- The implementation of SCore references the rCore-Tutorial-Code-2024A from Tsinghua University.
- The RustSBI implementation in SCore references the rustsbi open-source community.