20 May 2016
The Rust Programming Language
Code for low-level software, such as operating systems and browsers, is usually written in the C or C++ programming languages. These allow direct control of operations with a minimum of overhead, but they make it easy to do unsafe things. In these languages, a program can write any location in memory, whether it should or not. This is a big reason security-threatening bugs make it into software.
Other languages, like Java, PHP, and Ruby, provide a high level of safety, but code written in them isn''t nearly as fast, and they don''t provide access to low-level features like physical memory addressing. This means they aren''t suitable when speed is essential.
People have generally assumed that it has to be one or another; but in 2010, Mozilla started a project for the Rust programming language, which combines safety, speed, and concurrency and is suitable for low-level code.
It''s a fully compiled language, like C++; the compiler turns it into executable code that doesn''t need a runtime environment. It offers high-level features with what it calls "zero-cost abstraction." The compiler does the safety checking for these features, so there''s no overhead at runtime. It doesn''t use a garbage collector, so it avoids the unpredictable pauses that are unacceptable in real-time code. Its concurrency features are designed to avoid data races in multi-threaded code.
Sometimes low-level code has to do things which the compiler can''t prove are safe. If, for example, it''s necessary to manipulate raw data pointers, a Rust program can mark this code in an "unsafe" block. This tells the compiler to allow features that it would otherwise forbid, and it reminds programmers to be ultra-sure that those blocks don''t have any errors.
With Rust, future system-level code may have significantly fewer bugs that malicious software can exploit.
To learn more about our creative digital solutions, please contact us.