Android Open Source Project now supports Rust for OS development
Rust uses a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid, improving memory safety while providing equivalent performance to C and C++.
- Country:
- United States
Google on Tuesday announced that the Android Open Source Project (AOSP) now supports the Rust programming language for OS development.
While memory-safe languages such as Kotlin and Java are designed for ease of use, portability, and safety and are the best option for Android app development, they are not an option for the lower layers of the OS which require systems programming languages like C, C++, and Rust.
However, for C and C++ languages, the developer is responsible for managing memory lifetime and it's easy to make mistakes when doing this, especially in complex and multithreaded codebases. That's where Rust comes into the picture.
Rust uses a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid, improving memory safety while providing equivalent performance to C and C++.
On the other hand, C and C++ don't provide these same safety guarantees and require robust isolation. Rust helps overcome the limitations of these languages as it lowers the density of bugs within a code, increasing the effectiveness of current sandboxing and also reduces sandboxing needs, allowing the introduction of new features that are both safer and lighter on resources.
Besides, Rust improves the correctness of a code by modernizing a range of other language aspects such as memory safety, data concurrency, better error handling in standard libraries, safer integer handling and variable initialization.
"Adding a new language to the Android platform is a large undertaking. There are toolchains and dependencies that need to be maintained, test infrastructure and tooling that must be updated, and developers that need to be trained. For the past 18 months, we have been adding Rust support to the Android Open Source Project, and we have a few early adopter projects that we will be sharing in the coming months. Scaling this to more of the OS is a multi-year project," Google said.
Google News