DEV Community


Posted on • Originally published at on

Rust in Android OS and Linux

Google had two recent announcements of particular interest to Rust enthusiasts: ongoing efforts to introduce Rust into Android OS and the Linux kernel.

While a number of memory-safe languages like Java/Kotlin/go/et al. are used in user-space, the majority of OSes are written in C/C++ where incorrect memory usage is still a source of “high severity” bugs. The idea is that using Rust would avoid such classes of bugs and provide other benefits.

The Linux article has a few specific examples for a simple character device, ioctl handling, and synchronisation primitives. They illustrate some of Rust’s advantages: immutability, static typing, lifetime checks, bounds checks, RAII, required initialisation and error-handling, and so on. Most achieved at compile-time rather than run-time.

Why not bring C++ to Linux? Linus Torvalds had this to say:

LOL. C++ solves none of the C issues, and only makes things worse. It really is a crap language.

Top comments (0)