As part of the Kerla project, a core operating system is being developed using the Rust programming language. The new kernel is primarily designed to ensure compatibility with the Linux kernel at the ABI level, allowing the execution of unmodified binaries compiled for Linux in a Kerla-based environment. The code is distributed under the Apache 2.0 and MIT licenses. The project is being developed by Japanese developer Seiya Nuta, known for creating the microkernel operating system Resea, written in C.
At the current stage of development, Kerla can only run on x86_64 architecture systems and implements basic system calls such as write, stat, mmap, pipe, and poll, supporting signals, unnamed pipes, and context switching. For process management, it provides calls such as fork, wait4, and execve. Support for tty and pseudoterminals (pty) is included. The supported file systems currently are initramfs (used for mounting the root file system), tmpfs, and devfs. A network stack with TCP and UDP socket support, based on the smoltcp library, is also provided.
The developer has prepared a boot environment that can be launched in QEMU or in virtual machine Firecracker with the virtio-net driver, which can already be connected to via SSH. The musl library is used as the system library, and BusyBox is used for user utilities.

A build system based on Docker has been prepared, allowing the creation of custom bootable initramfs with the Kerla kernel. A shell similar to fish, called nsh, and a GUI stack Kazari based on the Wayland protocol are being developed separately.

Using the Rust language in a project reduces the number of errors in code by applying safe programming techniques and enhancing the efficiency of problem detection when working with memory. Safe memory handling in Rust is ensured at compile time through reference checking, ownership tracking of objects, and consideration of object lifetimes (scope), as well as through the evaluation of memory access correctness during code execution. Additionally, Rust provides tools to guard against integer overflows, requires mandatory initialization of variable values before use, employs the concept of immutability for references and variables by default, offers strong static typing to minimize logical errors, and simplifies input value handling through pattern matching.
For developing low-level components such as the OS kernel, Rust supports raw pointers, structure packing, inline assembly inserts, and embedding files in assembly. For operation without reliance on the standard library, there are standalone crate packages for performing operations on strings, vectors, and bit flags. Additional advantages include built-in tools for code quality assessment (linter, rust-analyzer) and creating unit tests that can be run not only on actual hardware but also in QEMU.
Source: opennet.ru
