Tech

Linus Torvalds weighs in on Rust language in the Linux kernel

Rust coats a pipe in an industrial construction site.

Enlarge / No, not that kind of Rust. (credit: Heritage Images via Getty Images)

This week, ZDNet’s Steven J. Vaughan-Nichols asked Linus Torvalds and Greg Kroah-Hartman about the possibility of new Linux kernel code being written in Rust—a high performance but memory-safe language sponsored by the Mozilla project.

C versus Rust

As of now, the Linux kernel is written in the C programming language—essentially, the same language used to write kernels for Unix and Unix-like operating systems since the 1970s. The great thing about C is that it’s not assembly language—it’s considerably easier to read and write, and it’s generally much closer to directly portable between hardware architectures. However, C still opens you up to nearly the entire range of catastrophic errors possible in assembly.

In particular, as a nonmemory-managed language, C opens the programmer up to memory leaks and buffer overflows. When you’re done with a variable you’ve created, you must explicitly destroy it—otherwise, old orphaned variables accumulate until the system crashes. Similarly, you must allocate memory to store data in—and if your attempt to put too much data into too-small an area of RAM, you’ll end up overwriting locations you shouldn’t.

Read 11 remaining paragraphs | Comments