A better operating system thanks to Rust’s combination of safety and performance?

Laptops running Redox, a new operating system written in Rust

Laptops running Redox, a new operating system written in Rust

The Redox OS, written in Rust and currently under development, is only “a few months of work away” from self-hosting, meaning that the Rustc compiler would run on Redox itself, according to its creator Jeremy Soller.

Soller, who is also a principal engineer at the Linux hardware company System76, based in Denver, USA, says that he is now running Redox OS permanently on one of his company’s laptops, with “full support for the keyboard, touchpad, storage and Ethernet”.

Soller says that a long-standing issue has been “to allow the compilation of Rust binaries on Redox OS”.

This was nearly achieved in 2017 by participating in a Google Summer of Code (a Google-sponsored programme for open-source projects), but bug-fixing along with complications with dynamic linking for the Rustc compiler have delayed “the dream of self-hosting” – though Soller believes this is now close.

Redox does run, though, and Soller has shown it booting in three seconds with an NVMe (Non-Volatile Memory Express) drive, a time he says is “not fast enough”.

What is Redox for? An online book explains the how and why. It is “a general purpose operating system and surrounding ecosystem written in pure Rust. Our aim is to provide a fully functioning Unix-like microkernel, that is both secure and free.”

The book takes an opinionated look at current Unix-like operating systems. Linux, it says, has issues with legacy drivers, a bloated codebase and lack of memory safety; and the GPL2 is less permissive than the MIT licence used by Redox. BSD is preferred but “a single buggy driver can crash the system”.

Redox benefits from the fact that the Rust language is designed for safety and attempts to avoid compromising performance. It also has an innovative philosophy which adapts the “everything is a file” idea in Unix to become “everything is a URL”. According to the book:

Redox will be a desktop operating system first, but both embedded and server uses are envisaged eventually.

Redox has a POSIX-compliant C library written in Rust, called relibc. It is Linux-compatible both at the syscall API level and at the syscall ABI (Application binary interface) level, subject to the same architecture. You can also run Redox applications on Linux. There is a shell called ion. There is a desktop environment called Orbital, and applications already include a calculator, file browser, image viewer, terminal emulator, 3D renderer, and a vi-like editor called Sodium.

The Orbital desktop in Redox

The Orbital desktop in Redox (image from Redox site)

Arm technical director Robin Randhawa spoke at FOSDEM in February 2019 about porting Redox OS to Arm v8.0. Rust, he noted, is genuinely useful for implementing a microkernel. If Randhawa is successful, Redox will run on hardware like Raspberry Pi.

Reality check: the latest release of Redox is version 0.5, out in March 2019.

It is best described as experimental and not in line to replace any existing OS for the time being. Still, if Rust continues to grow in popularity, its characteristics of safety and unimpeded performance seem ideal for creating a new operating system, so perhaps Redox will become more prominent. ®


Source link