Rust

From OSDev.wiki
Revision as of 23:54, 8 November 2015 by osdev>Philopp (Update url and description of blog series)
Jump to navigation Jump to search

Rust is a new systems language under development by Mozilla, designed to offer better safety and concurrency than other, more traditional systems programming languages. The syntax is a C dialect with the familiar braces and semi-colons. It features constructs from imperative programming (such as if and while), functional programming (such as lambda's, multi-directional pattern matching and immutable variables) and object oriented languages (traits and objects).

Rust has a strong focus on memory safety and control. Object allocation happens on the stack by default, but they can explicitly be stored on the heap. Objects are automatically deallocated as soon as they are no longer needed. Rust's references prevent dangling pointers, null references, and out of bounds memory access.

Operating System Development

While Rust has its own runtime (that uses libc), Rust can easily be configured to compile programs without it. This gives developers the freedom to implement their own memory allocation and other low-level services. This makes Rust ideal for operating system development.

Projects

  • Meaty Bare-Bones
  • "Tifflin"
    • Multiboot image for x86_64
    • Actively developed, has VFS and userland
  • RustBoot
    • x86 bootsector, doesn't use libcore
    • Out-of-date, written in pre 1.0 code
  • Ryanra's RustOS
    • Uses libcore/collections/alloc
    • Actively developed
  • Redox
    • Actively developed

Libraries

  • green-rs: Original green threads in early rust. No longer maintainted.
  • libfringe: Lightweight threading/task library based on libgreen.
  • libx86: Library to program x86 hardware.
  • libcpu: Library to program CPUs.
  • slabmalloc: Low-level memory allocator for liballoc.
  • multiboot: Library to read multiboot layout.

See Also