Rust has been growing in popularity for years. Earlier this year, Microsoft announced its intention to rewrite part of the Windows kernel in the Rust programming language. Recently, the company revealed that it was aiming to allow the development of OS drivers in Rust as well. Amazon, Dropbox and Cloudflare are among those making extensive use of it. What is the secret behind Rust’s advance?
Rust’s development started back in 2006 as a personal project of Mozilla developer Graydon Hoare. It was designed to make it as easy as possible for developers to code, with well-designed memory management at its core. Starting in 2009, Rust received official support from Mozilla and was open-sourced. However, after Mozilla laid off a quarter of its employees in August 2020, Rust’s future momentarily appeared to be in jeopardy. In February 2021, AWS, Huawei, Google, Microsoft and Mozilla formed the Rust Foundation to safeguard the language’s continued development. Although this organization has come under fire several times due to various incidents, the programming language it maintains has retained its momentum.
For years, Windows has primarily run on C, a language developed in the 1970s. It is known as a “minimalist” programming language that gives a lot of control to the developer, but with it, a lot of responsibility. As a result, it’s a tough ask to manage memory properly, especially in larger projects. Programs using C and C++ (or many other languages) can crash or provide an attack vector for cybercrime due to improper memory management. Indeed, memory that isn’t reallocated, may be used by a hacker to perform code injection. Bugs caused by memory management errors are said to account for 70 percent of all vulnerabilities in Microsoft products.
In this practical sense, it means that Rust produces reliable code, especially useful for devices that are difficult or impossible to update. Examples include IoT devices or OT infrastructure, where a particular function usually needs to be executed for long periods of time without interruptions.
Because Rust uses memory efficiently, the language is well suited for large amounts of data and tasks that demand a lot of computing power. Software engineer at GitHub Jason Ordendorff says Rust is fast and reliable. “It lets me write multi-headed programs that run on 16 cores and keep them readable, maintainable, and crash-free.” Coincidentally, this is a good fit with the direction computer hardware is moving: because Moore’s Law no longer seems to apply to x86 chips, AMD and Intel are opting for more and more cores and threads. This makes parallelization increasingly important, or simultaneous processing of different calculations. Long gone are the days that we can expect Gigahertz counts of chips to increase extensively – it’s multi-core effectiveness that reaps the most reward.
To top it off, according to many a programmer, Rust is easy to analyze. Code review is an essential component for developing secure software, so this quality of Rust is worth its weight in gold. In addition, Rust’s error messages are often informative and helpful.
Criticism and problems
However, not everything said about Rust is this positive. For example, the syntax is said to be unnecessarily complex and has a steep learning curve. Even then, though, not everyone agrees that the actual time it takes to learn Rust differs significantly from other languages. Google research shows that only 16.6 percent of developers surveyed take more than 4 months to become proficient with the language.
Something that just about everyone seems to agree on is that Rust’s compilation time is unappealingly long. Just over 40 percent from the aforementioned Google survey consider this speed “acceptable”. In addition, Rust is said to be difficult to integrate with other programming languages.
Research by Usenix used Rust as a case study to analyze the pros and cons of deploying a secure programming language. A survey from it showed that there were many positives, but the quality of Rust’s debugging tools divided opinion.
Another issue proved more difficult to resolve: that of standardization. As an open-source project, Rust is constantly evolving. However, there are no standards yet to meet certain industry requirements.
In short, Rust offers many advantages that fit the modern IT world. Its emphasis on security and stability over the programming languages of yesteryear makes it a logical successor to C and C++. It’s also set up to harness the power of modern hardware, with a good foundation to support parallelization and asynchronous programming. Standardization is still needed for some purposes such as deployment in the automotive world. It remains to be seen whether Rust will address that. Either way, programmers seem only too happy to switch to a language that protects them from some perennial pitfalls.