book/src/development/design/README.md

3.0 KiB

Understanding the Design Goals

Mercury has several new and novel design decisions that make it radically different from other general Operating Systems.

A lot of these designs will likely change and shift as work get's done on the project.

First off, it's written in Rust, which allows for several nice features, including:

  • Memory safety
  • Easy dependency and build management with cargo
  • Great performance and reliability
  • Several compilation targets, with simple cross-compilation

It also uses microkernel architecture - this allows for us to keep the base kernel code small, and have additional features be modular, and easy to integrate into other projects. This also allows for a smaller attack surface, less bloat, smaller code, etc.

Additionally, Mercury is designed for ARM/RISC-V architecture machines. This is not only because they are simpler, but also because I believe they are the future of computing. For the future, I do not see myself wanting or attempting to implement x86 functionality.

We may also use Rhai for scripting, for easy user control & modification of the system.

It will also use a global configuration - similar to Guix or NixOS. This allows it to be easily setup. It will likely use RON for configuration.

Note: figlet-rs can be used for cool ASCII art!

Further design decisions are gone into detail in the next few chapters.

Code Organization

These names and layout are all **WIP**.

All of the code will take place in separate repositories. Information on actually commiting, pulling, etc. is in the Workflow chapter.

Most of the code will be implemented as libraries, enabling for them to be used across systems, and worked on separately. Similarly drivers will be libraries in git submodules.

  • ferrite - The core microkernel code w/ bootloader
  • hermes - The package manager
  • meteor - The actors library/implementation
  • gravitas - The library for working with storage
  • pulsar - Networking code
  • photon - GUI library

Overall Design

Connections

erDiagram
    BOOTLOADER ||--|| KERNEL: runs
    KERNEL ||..o{ GRAVITAS: uses
    KERNEL }|..o{ METEOR: uses
    GRAVITAS }|..o{ HAL: uses
    GRAVITAS ||--o{ DISK: IO
    KERNEL ||--|{ MEMORY: maps
    KERNEL ||--o{ EXE: runs
    EXE }|..o{ METEOR: uses
    EXE }|..o{ KERNEL: msg

Startup Flow

flowchart TD
    boot[Bootloader] --> kern(Kernel)
    kern --> disk(Read Disk) --> ind(Index Filesystem) -->
    parse(Parse Configuration) --> run(Run Startup Programs)
    parse -.-> sh([Interactive Shell])
    kern --> mem(Map Memory) -.-> ind
    run ==> actor([Create Actors])