Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Android Starts Supporting Rust Programming Language To Reduce Memory Bugs

Android is a very capable and versatile operating system. But behind the scene, there are rooms for improvements.

The operating system that is supported by Google, is the brainchild of Andy Rubin. It's based on a modified version of the Linux kernel and other open source software.

Among other reasons, this is why Android suffers from what's called the Memory safety bug, which is a state where the operating system is vulnerable to software and security vulnerabilities when dealing with memory access, such as buffer overflows among others.

The team behind Android has been pushing Kotlin and Java for app developers.

However, those languages rely on the Android Runtime (ART) in order to function.

As a result, developers cannot program on anything lower-level than ART in Java, since there would be no runtime environment to run it on. In the past, Google has typically used C or C++, but neither of these are memory-managed languages, and that opens Android up to memory leaks and buffer overflows.

To lower the risk of the memory safety bug, in a blog post, Google announced that the Android Open Source Project (AOSP) is supporting the Rust programming language for low-level OS components.

The benefit of using Rust instead of C/C++, according to Google:

"Rust provides memory safety guarantees by using a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid. This safety is achieved while providing equivalent performance to C and C++."

Rust is a multi-paradigm programming language, designed for performance and safety.

While it is syntactically similar to C++, the programming language can guarantee memory safety by using a borrow checker to validate references. This makes Rust capable of achieving memory safety without garbage collection.

But rewriting existing Android's programming that accounts to "tens of millions of lines" from C and C++ to Rust is "simply not feasible."

And because "most of our memory bugs occur in new or recently modified code, with about 50% being less than a year old," said Google, Rust shall only be used for new components, and only when necessary.

"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," Google said on its blog post.

Credit: Google

Rust was originally designed by the team at Mozilla Research in 2010, with contributors that include Brendan Eich, and others.

The industry recognizes Rust as a pretty stable programming language.

This is because Rust is intended to be a language for highly concurrent and highly safe systems. This makes it capable of creating and maintaining boundaries that preserve large-system integrity. This in turn has led to a feature set with an emphasis on safety, control of memory layout, and concurrency.

Since then, Rust has gained increasing popularity among some tech companies in industry.

Microsoft for example, has started using Rust to power and secure some of its safety-critical software components.

The popularity of Rust has given it the title "most loved programming language" in the Stack Overflow Developer Survey every year since 2016.

Further reading Android And IOS Memory Management, And How Are They Different

Published: 
11/04/2021
News
Google
Android
OS
Programming
Developers
Review
Trends


This post first appeared on Eyerys | Eyes For Solution, please read the originial post: here

Share the post

Android Starts Supporting Rust Programming Language To Reduce Memory Bugs

×

Subscribe to Eyerys | Eyes For Solution

Get updates delivered right to your inbox!

Thank you for your subscription

×