Skip to main content

System Architecture

Redox OS consists of multiple layers and components working together:

Core Components

Kernel

The Redox microkernel is the heart of the system:

Size

~20,000 lines of Rust code

Role

Process management, memory, IPC, core schemes

Repository

Maintainer

@jackpot51
Key Responsibilities:
  • Process and thread scheduling
  • Virtual memory management
  • System call handling
  • Basic scheme providers (memory, pipe, irq, time)
// Kernel provides core schemes
const KERNEL_SCHEMES: &[&str] = &[
    "debug",   // Debug output
    "event",   // Event notification
    "memory",  // Physical memory access
    "pipe",    // Pipe IPC
    "serio",   // Serial I/O
    "irq",     // Interrupt handling
    "time",    // System time
    "sys",     // System information
];

Base System Components

The base repository contains essential system components and drivers:
# Essential scheme daemons
randd        # Random number generator (rand:)
nulld        # Null device (null:)
zerod        # Zero device (zero:)
ptyd         # Pseudo-terminal (pty:)

File Systems

RedoxFS

The default file system for Redox OS:
RedoxFS is a Copy-on-Write (CoW) file system inspired by ZFS and BTRFS, designed specifically for Redox.
Features:
  • Copy-on-Write semantics
  • Built-in compression
  • Checksumming for data integrity
  • Snapshots
  • Written entirely in Rust
// RedoxFS structure (simplified)
pub struct RedoxFS {
    disk: Disk,
    header: Header,
    nodes: BTreeMap<u64, Node>,
    // CoW allocation
}

impl Scheme for RedoxFS {
    fn open(&mut self, path: &str, flags: OpenFlags) -> Result<usize>;
    fn read(&mut self, id: usize, buf: &mut [u8]) -> Result<usize>;
    fn write(&mut self, id: usize, buf: &[u8]) -> Result<usize>;
    // ...
}

Other File Systems

ext4

Linux ext4 support for compatibility

FAT32

FAT32 for USB drives and boot partitions

ISO 9660

CD/DVD file system support

tmpfs

RAM-based temporary file system

Network Stack

smolnetd

Redox’s network service based on the smoltcp library:
# Network initialization from base.toml
[files]
path = "/usr/lib/init.d/10_net"
data = """
requires_weak 00_drivers
notify smolnetd
nowait dhcpd
"""
Supported Protocols:
  • IPv4 (full support)
  • IPv6 (planned)
  • ICMP (ping, traceroute)
  • ARP (address resolution)
Network Scheme Example:
use std::net::TcpStream;
use std::io::{Read, Write};

fn main() -> std::io::Result<()> {
    // Opens tcp: scheme via smolnetd
    let mut stream = TcpStream::connect("example.com:80")?;
    
    stream.write_all(b"GET / HTTP/1.0\r\n\r\n")?;
    
    let mut response = String::new();
    stream.read_to_string(&mut response)?;
    
    println!("Response: {}", response);
    Ok(())
}

Display Server - Orbital

Orbital is Redox’s display server and window manager:

Architecture

Compositing window manager with GPU acceleration

Features

Window management, event handling, 2D graphics

Scheme

Provides orbital: and display: schemes

Desktop

Integrates with COSMIC desktop apps
Orbital Operations:
// Creating a window via orbital: scheme
use orbclient::{Color, Renderer, Window};

fn main() {
    let mut window = Window::new(
        100, 100, 800, 600,
        "My Application"
    ).unwrap();
    
    window.set(Color::rgb(255, 255, 255));
    window.sync();
    
    // Event loop
    'events: loop {
        for event in window.events() {
            // Handle keyboard, mouse, etc.
        }
    }
}

Shell - Ion

Ion is the default shell for Redox:
# Ion shell configuration
[users.root]
shell = "/usr/bin/ion"

[users.user]
shell = "/usr/bin/ion"
Ion Features:
# Variables with types
let name = "Redox"
let count: int = 42

# Array operations
let files = [file1.txt file2.txt file3.txt]
echo @files
fn greet name
    echo "Hello, $name!"
end

greet "World"
# Try-catch style error handling
if test -f file.txt
    cat file.txt
else
    echo "File not found"
end

C Library - relibc

Relibc is Redox’s C standard library, written in Rust:
Relibc provides POSIX compatibility, enabling many Linux and BSD programs to run on Redox with minimal or no modifications.
Key Features:
  • POSIX function implementations
  • Thread support (pthreads)
  • Dynamic linking
  • C++ standard library support (via libstdc++)
  • Rust implementation for memory safety
// Standard C programs work on Redox
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main() {
    // These POSIX functions are provided by relibc
    char cwd[PATH_MAX];
    getcwd(cwd, sizeof(cwd));
    printf("Current directory: %s\n", cwd);
    
    FILE* f = fopen("/file/data.txt", "r");
    if (f) {
        // File I/O works through Redox schemes
        char buf[256];
        fgets(buf, sizeof(buf), f);
        printf("Content: %s", buf);
        fclose(f);
    }
    
    return 0;
}

System Library - libredox

Libredox provides Rust access to Redox-specific functionality:
use redox_scheme::Scheme;
use libredox::flag::*;

// Open a scheme URL
let fd = libredox::call::open(
    "tcp:example.com:80",
    O_RDWR | O_CLOEXEC
)?;

// Write data
libredox::call::write(fd, b"GET / HTTP/1.0\r\n\r\n")?;

// Read response
let mut buffer = [0u8; 4096];
let bytes_read = libredox::call::read(fd, &mut buffer)?;

// Close
libredox::call::close(fd)?;

Package Manager - pkgutils

Redox’s package manager for installing and managing software:
# Install a package
pkg install rust

# Install from specific repository
pkg install --repo=https://static.redox-os.org/pkg rust
Package Configuration:
# Package repository configuration from base.toml
[[files]]
path = "/etc/pkg.d/50_redox"
data = "https://static.redox-os.org/pkg"

System Initialization

Redox uses init scripts for system startup:

Base Initialization

# From base.toml: /usr/lib/init.d/00_base
# Clear and recreate tmpdir with 0o1777 permission
rm -rf /tmp
mkdir -m a=rwxt /tmp

notify ipcd   # Start IPC coordinator
notify ptyd   # Start pseudo-terminal daemon
nowait sudo --daemon  # Start privilege daemon

Driver Initialization

# From base.toml: /usr/lib/init.d/00_drivers
requires_weak 00_base
pcid-spawner  # PCI device manager spawns drivers

Network Initialization

# From base.toml: /usr/lib/init.d/10_net
requires_weak 00_drivers
notify smolnetd  # Start network stack
nowait dhcpd     # Start DHCP client
Init scripts use notify for services that should complete startup before continuing, and nowait for background services.

System Utilities

Redox includes essential Unix-like utilities:

uutils

Rust implementation of core Unix utilities (ls, cp, mv, etc.)

userutils

User management tools (login, sudo, passwd)

netutils

Network utilities (ping, wget, nc)

coreutils

Additional system utilities
# Standard Unix commands work as expected
ls -la /
ps aux
netstat -an
top
free -h
df -h

Device Management

Devices in Redox are accessed through schemes:
# Device file symlinks from base.toml
/dev/null    -> /scheme/null
/dev/random  -> /scheme/rand
/dev/urandom -> /scheme/rand
/dev/zero    -> /scheme/zero
/dev/tty     -> libc:tty
/dev/stdin   -> libc:stdin
/dev/stdout  -> libc:stdout
/dev/stderr  -> libc:stderr
Unlike Linux’s /dev which contains thousands of device nodes, Redox uses lightweight symlinks to scheme URLs.

Component Diagram

Complete system overview:

Key Repositories

Kernel

Core microkernel implementation

Base

Essential system components and drivers

RedoxFS

Default file system

relibc

C standard library

Ion

Default shell

Orbital

Display server

pkgutils

Package manager

libredox

System library

Next Steps

Scheme System

Learn about the scheme system in detail

Contributing

Start contributing to Redox components

Build docs developers (and LLMs) love