"Rust is the future of system programming, C is the new assembler" - a speech by one of the leading engineers of Intel

At the recent Open Source Technology Summi (OSTS) Josh Triplett, an Intel lead engineer, said that his company is interested in Rust reaching "parity" with C, which is still dominant in the field of systems and low-level development, in the near future. In his speech under the heading "Intel and Rust: The Future of Systems Programming" he also talked about the history of systems programming, how C became the "default" system programming language, what Rust features give it an edge over C, and how in the near future it could completely replace C in a given area of ​​programming.

"Rust is the future of system programming, C is the new assembler" - a speech by one of the leading engineers of Intel

System programming is the development and management of software that serves as a platform for creating application applications, ensuring that the latter interact with the processor, RAM, I / O devices, and network equipment. System software creates a special abstraction in the form of interfaces that help you create application software without going into the details of how the hardware itself works.

Triplett himself defines systems programming as "anything that is not an application". It includes things like BIOS, firmware, boot loaders and operating system kernels, various kinds of built-in low-level code, and virtual machine implementations. Interestingly, Triplett believes that the web browser is also system software, since the browser has long gone beyond "just a program" into its own "platform for websites and web applications."

In the past, most system programs, including BIOS, bootloaders, and firmware, were written in assembly language. Experiments began in the 1960s to provide hardware support for high-level languages, leading to languages ​​such as PL/S, BLISS, BCPL, and ALGOL 68.

Then, in the 1970s, Dennis Ritchie created the C programming language for the Unix operating system. Created in the B programming language, which did not even have typing support, C was filled with powerful high-level functions that were best suited for writing operating systems and drivers. Several components of UNIX, including its kernel, were eventually rewritten in C. Subsequently, many other system programs, including the Oracle database, most of the Windows source code, and the Linux operating system, were also written in C.

C received huge support in this direction. But what exactly made the developers switch to it? Triplett believes that in order to motivate developers to switch from one programming language to another, the latter must first provide new features without losing old features.

First, the language must offer "impressive enough" new features. “He can't be any better. It has to be significantly better to justify the effort and time it takes for the engineers to make the transition,” he explains. Compared to assembly language, C had a lot to offer. It supported somewhat type-safety, provided better portability and performance with high-level constructs, and generated much more readable code overall.

Secondly, the language must provide support for old features, which means that in the history of the transition to C, developers had to be sure that it was no less functional than assembly language. Triplett explains: "A new language cannot simply be better, it must also be just as good." In addition to being faster and supporting any data types that assembly language could use, C also had what Triplett called an "escape hatch," namely, support for inserting assembly language code within it.

"Rust is the future of system programming, C is the new assembler" - a speech by one of the leading engineers of Intel

Triplett believes that C is now becoming what assembly language was many years ago. "C is the new assembler," he says. Developers are now looking for a new high-level language that will not only solve C's lingering problems that are no longer fixable, but also offer exciting new features. Such a language must be compelling enough to force developers to switch to it, must be secure, provide automatic memory management, and much more.

“Any language that wants to be better than C needs to offer much more than buffer overflow protection if it really wants to be a compelling alternative. Developers are interested in usability and performance, in writing code that is self-explanatory and does more work in fewer lines. Security issues also need to be addressed. Ease of use and performance go hand in hand with it. The less code you have to write to achieve something, the less opportunity you have to make any security-related or non-security-related errors,” Triplett explains.

Comparing Rust and C

Back in 2006, Graydon Hoare of Mozilla started writing Rust as a personal project. And in 2009, Mozilla began sponsoring the development of Rust for its own needs, and also expanded the team to further develop the language.

One of the reasons Mozilla was interested in the new language is that Firefox was written in over 4 million lines of C++ code and had quite a few critical vulnerabilities. Rust was built with security and concurrency in mind, making it the perfect choice for rewriting many Firefox components as part of Quantum's project to completely overhaul the browser's architecture. Mozilla is also using Rust to develop Servo, an HTML rendering engine that will replace Firefox's current rendering engine in the future. Many other companies have started using Rust for their projects, including Microsoft, Google, Facebook, Amazon, Dropbox, Fastly, Chef, Baidu, and many more.

Rust solves one of the most important problems of the C language. It offers automatic memory management so developers don't have to manually allocate and then deallocate it for every object in an application. What distinguishes Rust from other modern languages ​​is that it does not have a garbage collector that automatically removes unused objects from memory, nor does it have a runtime environment that is required for it to work, such as the Java Runtime Environment for Java. Instead, Rust has the concepts of ownership, borrowing, references, and lifetimes. “Rust has a system for declaring object calls, allowing you to specify whether the owner is using it or if it's just borrowing. If you just borrow an object, the compiler will keep an eye on it and ensure that the original stays in place while you refer to it. And Rust will also ensure that the object is removed from memory as soon as it is finished using it, inserting the appropriate call into the code at compile time without additional time,” says Triplett.

The lack of a native runtime can also be considered a positive feature of Rust. Triplett believes that the languages ​​that run with it are difficult to use as a tool for systems programming. As he explains, "You must initialize this runtime before you can call any code, you must use this runtime to call functions, and the runtime itself can run additional code behind your back at unexpected times."

Rust also strives to provide safe parallel programming. The same features that make it memory-safe keep track of things like which thread owns which object and which objects can be passed between threads and which need a lock.

All of these features make Rust compelling enough for developers to choose as their new system programming tool. However, in terms of parallel computing, Rust is still slightly behind C.

Triplett is going to create a special working group that will implement the necessary features in Rust so that it can fully equal, surpass and replace C in the field of systems programming. IN topic on reddit, dedicated to his speech, he said that "the FFI / C Parity group is in the process of being created and has not yet begun work", while he is ready to answer any questions, and in the future he will definitely publish the nearest plans for the development of Rust as part of his initiative for all interested parties.

It can be assumed that, first of all, the FFI / C Parity group will be engaged in improving Rust's multithreading support, introducing support for BFLOAT16, the floating point format that appeared in the new Intel Xeon Scalable processors, as well as stabilizing assembly code insertions.



Source: 3dnews.ru

Add a comment