Why I’m Excited That Rust Is Coming to the Linux Kernel

https://www.profitableratecpm.com/f4ffsdxe?key=39b1ebce72f3758345b2155c98e6709c

A slow change arrives on the Linux nucleus, and it is as fundamental as for programmers: language even in which they write. Such an impactful decision must be managed carefully, but it is a cause of celebration.

To what extent the Linux nucleus written at the moment?

The Linux nucleus is the heart of the operating system, with low level control of resources such as memory, processor and file systems. This is the type of software hidden at 99.99% of users, but that affects everything that is happening on your computer.

Related

What is the Linux nucleus, and why is it important?

What is there at the center of all this?

Linus Torvalds began to develop the nucleus in 1991, using C (low level language) and an assembly (about as much as possible). Despite attempts to introduce the support of higher level languages, such as C ++ in 1997, the nucleus has remained with C since. Even today, its GitHub repository reports that 98% of the nucleus code are written in C:

A graph showing the languages used in the Linux kernel code, with C at 98.3% and rusts at 0.1%.

In addition to the failure of the C ++ experience, the only other language with potential participation in the nucleus was rust. A fairly new language, Rust 1.0 arrived in 2015 with a syntax similar to C, but the design of language influences at all levels. The programmers had already experienced the previous versions of language as an option for the programming of nucleus modules, with proof of concept developed in 2013.

Since then, Linux developers have taken measures to use rust in the development of the nucleus, although progress has been slower than expected. The Rust for Linux project began in 2020 and marked the start of a determined effort to bring rust of the nucleus drivers, in order to reduce bugs. This led to the possible inclusion of pilots written by rust in version 6.8 of the nucleus, which was published in December 2023.

Related

What is a programming language?

Have you ever wondered what programming languages are?

What changes now?

More and more rust drivers are added to the Linux kernel. While Rust Code represents only 0.1% of the total code base, it’s still 143 separate files on all facets of the nucleus.

Version 6.16 of rust nucleus for Linux improvements to correct the race conditions. The nucleus updates tend to go out every two months, so the work during rust is up to date and the project is always very active. It seems that core developers still like to continue this decision, even if there have been occasional dissent.

The Tyr driver for GPUs Arm Mali is a contemporary example of rust for Linux work. This graphic pilot of the nucleus is written in rust and aims to develop the more theoretical work that has been carried out so far. Having a real pilot that depends on existing compatibility means that there is a real test for the work carried out so far. This should help encourage faster progress with the Rust for Linux initiative.

Why is it a good thing?

The Rust website currently describes it as:

A language allowing everyone to create reliable and effective software.

This instruction does not explicitly target programming of the nucleus, but the code at the heart of an operating system, in particular, must be reliable and effective.

One of the main arguments for the sale of Rust is its memory safety. The way in which a language deals with the allocation of memory is a factor that determines whether it is a low level language or high -level language. Low -level languages offer programmers a lot of power, allowing them to manage memory manually, but expecting them to do so responsible. Higher level languages tend to protect the programmer, managing memory allocation on their behalf. A waste collector is often used to automatically clean the memory, but this can cause ineffectiveness.

Rust has a different approach: it uses a property system to enforce memory techniques without requiring garbage collector with high processing intensity. The language also manages competition in the same way, approaching another functionality which is often a source of bugs.

Related

What is a memory leak and what can you do about it?

A memory leak can slowly operate your computer. Learn to spot one and recover your ram.

Bogues in the nucleus are particularly insidious because they can affect any other program code which takes place during execution. They can also be difficult to identify and, since the code they live is highly optimized, difficult to diagnose and repair. Core bugs can also be much more catastrophic than bugs in applications: they can reduce whole systems and open safety holes so that bad players can exploit.

Avoiding these bugs means that core developers must take their time and pay particular attention to their work. In short, the core bugs lead to slower progress. This is one of the reasons why I am enthusiastic about the transition to Rust. By eliminating certain types of bugs, it has the potential to accelerate the development of the nucleus and increase the rate of progress.

Rust also gains in popularity. Although C is even more popular (20.3% against 12.6% according to the Stackoverflow survey of 2024), Rust is catching up, and it is quite possible that more new programmers, now or soon, use Rust. Even if the nucleus is slow to adopt modules written in rust at the moment, the work to prepare it is precious.

And that brings me to my last point: even considering an alternative language is beneficial. Having eyes on all parts of the code base, inspecting architecture, making it more adaptable to other languages, must be a good thing.

Related

Why should you learn rust, especially if you are new in programming

Rust is one of the most recent programming languages, and it can change the way you see the code.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button