«Rust — the future of systems programming, C — the new Assembly» — a presentation by one of Intel's leading engineers

At the recently held Open Source Technology Summit (OSTS) Josh Triplett, a leading engineer at Intel, discussed how his company is interested in achieving 'parity' for Rust with the still-dominant systems programming language, C, in the near future. In his presentation titled 'Intel and Rust: The Future of Systems Programming,' he also spoke about the history of systems programming, how C became the default systems programming language, the advantages Rust offers over C, and how it could completely replace C in this programming domain in the near future.

«Rust — the future of systems programming, C — the new Assembly» — a presentation by one of Intel's leading engineers

Systems programming is the development and management of software that serves as a platform for building application software, facilitating interaction with the processor, RAM, input/output devices, and networking equipment. System software creates a special abstraction in the form of interfaces that help develop application software without delving into the details of how the 'hardware' functions.

Triplett himself defines systems programming as 'everything that is not an application.' This includes things like BIOS, firmware, bootloaders, and operating system kernels, various types of embedded low-level code, as well as implementations of virtual machines. Interestingly, Triplett considers the web browser to also be system software, as it has long since evolved from being 'just a program' into a standalone 'platform for websites and web applications.'

In the past, most system programs, including BIOS, bootloaders, and firmware, were written in assembly language. In the 1960s, experiments began to provide hardware support for high-level languages, leading to the creation of 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. Developed from the B programming language, which lacked even type support, C was filled with powerful high-level features that were ideally 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, a significant portion of Windows source code, and the Linux operating system, were also written in C.

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

Firstly, the language must present "sufficiently impressive" new features. "It can't be just a little better. It has to be significantly better to justify the effort and time engineers need to transition," he explains. Compared to assembly language, C had many advantages to offer. It supported safe typing to some extent, provided better portability and performance with high-level constructs, and generated overall much more readable code.

Secondly, the language must support old functionalities, meaning that in the transition to C, developers needed to be confident that it was at least as functional as assembly language. Triplett clarifies: "A new language can't just be better; it also has to be no worse." Besides being faster and supporting any data types that assembly language could use, C also had what Triplett referred to as an "emergency hatch," allowing for inline assembly code.

«Rust — the future of systems programming, C — the new Assembly» — a presentation by one of Intel's leading engineers

Triplett believes that C is becoming what assembly language was many years ago. "C is the new Assembly," he states. Now, developers are looking for a new high-level language that not only solves the accumulated problems with C, which are now impossible to fix, but also offers exciting new features. Such a language must be compelling enough to persuade developers to switch, must be safe, provide automatic memory management, and much more.

"Any language that wants to be better than C must offer much more than just protection against buffer overflows if it truly wants to be a convincing alternative. Developers are interested in usability and performance, in writing code that requires no explanation and does more work with fewer lines. Security issues also need to be addressed. Ease of use and performance are inextricably linked. The less code you need to write to achieve something, the fewer opportunities you have to make any security-related mistakes," explains Triplett.

Comparison of Rust and C

Back in 2006, Graydon Hoare, an employee at Mozilla, began writing Rust as a personal project. In 2009, Mozilla started sponsoring the development of Rust for its own needs and expanded the team for further language development.

One reason Mozilla became 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 created with security and concurrency requirements in mind, making it an ideal choice for rewriting many components of Firefox as part of the Quantum project to completely overhaul the browser's architecture. Mozilla also uses Rust for the development of Servo, an HTML rendering engine that will eventually replace the current Firefox rendering engine. Many other companies have started using Rust for their projects, including Microsoft, Google, Facebook, Amazon, Dropbox, Fastly, Chef, Baidu, and many others.

Rust addresses one of the most significant problems of the C language. It offers automatic memory management, which means that developers do not need to manually allocate and then free memory for each object in their application. What sets Rust apart from other modern languages is that it does not have a garbage collector to automatically remove unused objects from memory, nor does it require a runtime environment, like the Java Runtime Environment for Java. Instead, Rust incorporates concepts of ownership, borrowing, references, and lifetimes. "Rust has a system for declaring object calls that allows you to specify whether it's owned by the owner or just borrowed. If you are just borrowing the object, the compiler will track this and ensure that the original remains in place as long as you are referencing it. Additionally, Rust will ensure that the object is removed from memory immediately after its use, by inserting the appropriate call into the code during compilation without any additional time cost," explains Triplett.

The absence of its own runtime environment can also be considered a positive feature of Rust. Triplett believes that languages executed with it are difficult to use as a tool for system programming. As he explains: "You have to initialize this runtime before you can call any code, you have to use this runtime to call functions, and the runtime itself can run additional code behind your back at unexpected moments."

Rust also aims to ensure safe concurrent programming. The same features that make it memory-safe also track things like which thread owns which object and which objects can be passed between threads, and which need to be locked.

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

Triplett is set to create a special working group that will implement the necessary functions in Rust so that it can fully match, surpass, and replace C in the field of systems programming. In a discussion on Reddit, dedicated to his presentation, he mentioned that "the FFI/C Parity group is in the process of being established and has not yet begun work"; for now, he is ready to answer any questions, and in the future will definitely publish the upcoming plans for Rust's development as part of his initiative for all interested parties.

It can be assumed that the FFI/C Parity group will primarily focus on enhancing multithreading support in Rust, implementing support for BFLOAT16, a floating-point number representation format that has emerged in new Intel Xeon Scalable processors, as well as stabilizing code insertions in Assembly.



Source: 3dnews.ru
Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster