Skip to content

SCore: a Rust-based RISC-V microkernel OS for education & research—process/memory/FS, stride scheduler, LRU cache, with Dockerized dev env and docs.

Notifications You must be signed in to change notification settings

KaidRommel/score

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SCore

中文文档

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:
Overall Architecture

Key Features

  • 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.

Documentation

This section lists the main documentation for the project.

Development Process

Kernel Design Philosophy

Development History

Architectural Design

Functional Testing

Overall Functional Testing

Quick Start

Prerequisites

  • Docker

Build and Run

Build the Docker image by running the following command in the project's root directory:

make build_docker

Start the Docker environment:

make docker

Navigate to the os directory:

cd os

Run the kernel:

make run

Build the documentation:

make doc

Directory Structure

SCore
├── 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)

Acknowledgements

  1. SCore is based on the official rCore-Tutorial-Book-v3.
  2. The implementation of SCore references the rCore-Tutorial-Code-2024A from Tsinghua University.
  3. The RustSBI implementation in SCore references the rustsbi open-source community.

About

SCore: a Rust-based RISC-V microkernel OS for education & research—process/memory/FS, stride scheduler, LRU cache, with Dockerized dev env and docs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •