Facebook wants to generalize the Rust programming language

Facebook joined the Rust Foundation, the organization that supports the Rust programming language, alongside Amazon Web Services, Google, Huawei, Microsoft, and Mozilla.

Facebook is the latest tech giant to accelerate its adoption of Rust, a language originally developed by Mozilla. It has become popular for programming systems because of its memory security guarantees over fast C and C ++ languages. Rust is attractive for writing components like drivers and compilers.

The Rust Foundation was established in February with initial support from Amazon Web Services, Google, Huawei, Microsoft, and Mozilla. Microsoft is exploring Rust for certain components of Windows and Azure, while Google is using Rust to build new parts of the Android operating system and support an effort to bring Rust into the Linux kernel.

Facebook has adopted Rust since 2016

Facebook’s engineering team say they started using Rust in 2016, a year after Rust hit stage 1.0. “For developers, Rust offers the performance of older languages ​​like C ++ with a heavier emphasis on code security. Today there are hundreds of developers at Facebook who write millions of lines of Rust code, ”explains Facebook’s software engineering team.

Facebook has joined the Rust Foundation at the highest level, alongside its tech giant peers, giving it a place on the foundation’s board of directors.

“Facebook has embraced Rust since 2016 and uses it in all aspects of development, from source control to compilers,” says Joel Marcey, head of the open source ecosystem at Facebook, and now director of the board of directors of the Rust Foundation. “We are joining the Rust Foundation to help improve and grow this language that has become so valuable to us and developers around the world. We look forward to participating with fellow Foundation members and the Rust community to make Rust a popular language of choice for systems programming and beyond. “

The Diem blockchain mainly written in Rust

Facebook has used Rust in a number of projects, including its controversial cryptocurrency and blockchain project Libra, which is now governed by the Diem association. Facebook is now just a main member of this association, via its Novi digital wallet. Facebook notes that the Diem blockchain is mostly written in Rust.

Previously, Facebook had turned to Rust for Mononoke, a source control server, in a 2016 project. “Developing Mononoke in C ++ was the obvious choice initially. At the time, Facebook’s back-end code base was very heavy in C ++, which means that Mononoke would have been implemented in C ++ by default, ”Facebook engineers note.

“But the source control team had to consider the reliability needs of the source control back-end. Where corruption or downtime can potentially cause services to stop, reliability is a top priority. That’s why the team chose to go with Rust over C ++. “

Adopting Rust was a big and risky decision due to the time it takes to learn a new language and the time already invested in projects written in another language, as Jeremy Fitzhardinge, software engineer at Facebook, explained during from a talk at RustConf 2019.

A Rust team created in 2020

After proving the successful transition to Rust for Mononoke, developer interest within Facebook increased. Facebook notes that a large number of engineers drawn to Rust came from Python and JavaScript backgrounds. This is remarkable, given that they are the two most popular programming languages. Python is popular for machine learning and back-end system development, while JavaScript governs web front-end systems.

“They liked Rust’s combination of high performance and compilation error detection. As success stories like two to four order of magnitude performance improvements circulated across the company, interest in using Rust for service code increased. back-end and exploring its use in mobile applications as well, ”notes Facebook.

In 2020, Facebook created a Rust team within its “Programming Languages” unit, which is also responsible for its work on C ++ standards and toolchains. This team focused on Rust toolchains, Rust compiler code reviews, and ensuring Rust interoperable with C ++ code. “We have a large amount of C ++ code that is needed to communicate with the back-end systems on which the services are built. We need developers to be able to use these libraries safely and easily from within Rust without sacrificing the benefits Rust offers, ”Facebook explains.

“Conversely, if we want Rust components to be integrated with our larger C ++ binaries, we need intelligent run-time interoperability in asynchronous code. Facebook’s servers are highly distributed and heavily threaded. Rust tasks must fit into the C ++ thread pool and securely share sync primitives and input / output resources. “

This team also supported and quickly adopted the coroutines of C ++ 20, the C ++ standard finalized by Working Group 21 (WG21) in September. “The introduction of Rust to the game will be an extension of this and build on the great work already done in Rust’s asynchronous library stack. “

Source: .com

Back to top button