Table of Contents:

Free Python Course ➞ Mini-course for beginners and experienced coders. 4 cool projects in the portfolio, live communication with the speaker. Click and find out what you can learn in this course.
Learn More
Brian Cantrill is an experienced specialist in his field, possessing deep knowledge and practical experience. He actively shares his findings and research, providing readers with relevant and useful information. His works cover a wide range of topics, making them interesting for a variety of audiences. Through his unique approach and attention to detail, the author successfully draws attention to important issues and trends, promoting their better understanding. Readers can expect high-quality and relevant content that answers pressing questions and helps solve practical problems. Cantrill is a systems programmer with over 20 years of experience and is the co-founder and CTO of Oxide Computer Company. From 1996 to 2006, he developed the Solaris operating system kernel at Sun Microsystems, and from 2010 to 2019, he worked on SmartOS at Joyent. His experience and knowledge in the field of systems programming make him an expert in the development of modern operating systems.
At the QCon conference, Brian Cantrill outlined the reasons why many systems programmers prefer the Rust language. He also discussed the prospects for using Rust for the development of modern operating systems. Rust offers advantages such as memory safety and high performance, making it an ideal choice for systems programming. In his talk, Cantrill emphasized that Rust solves many problems faced by developers and opens up new opportunities for creating reliable and efficient software solutions.
In this article, we presented the main ideas and conclusions of the talk. We analyzed the key points and discussed their significance. Readers will be able to familiarize themselves with the main points and gain useful information based on the content of the talk.
If you ask the question of whether all operating systems should be rewritten in Rust, according to the principle of Betteridge's headings, you might expect the answer to be "no". However, there are many arguments in favor of the answer "yes". In this article, I will explain why this idea is worth considering and why I use a question mark instead of an exclamation point in the title. Rust, thanks to its safety and efficiency, has the potential to significantly improve the quality of operating systems. This programming language offers protection against memory leaks and data races, which is an important aspect in the development of complex systems. It is also important to consider the growing community of Rust developers and its active development, which may lead to the emergence of new tools and libraries that simplify the creation of operating systems. Therefore, it is worth considering Rust's potential in this area and how it can change the approach to operating system development.
What is an Operating System
At first glance, the question of what software is may seem simple. However, to understand this topic, it is important to consider the definition of software. For example, the Euclidean algorithm is not considered software, as it was developed before the advent of computers. Software is a set of instructions that controls the operation of a computer and performs specific tasks. Thus, software includes applications, operating systems, and other components that allow users to interact with devices and perform various operations.
An operating system (OS) runs on top of the hardware. However, it is not limited to physical devices, as it can be deployed in the cloud on virtual machines. Therefore, the issue of choosing and configuring an operating system becomes more complex and requires a careful approach.
An operating system is software that manages a computer's hardware resources and enables the execution of third-party applications. If the operating system stops functioning, all running processes and applications also cease to function. Proper OS configuration and support play a key role in the stability and performance of the system, which emphasizes the importance of regular updates and maintenance.
An operating system includes a kernel, which provides full access to the processor's resources, memory, and other hardware. However, the kernel is not the only component of an OS. Libraries, commands, and daemons also play an important role, providing functionality and interaction between the user and the system. Libraries provide the necessary functions for applications, commands allow users to manage the system, and daemons run in the background, performing various tasks and providing process support. All these elements together ensure the stable and efficient operation of the operating system.
How Operating Systems Evolved
Operating system simulacrums began to be developed in assembly language immediately after World War II. However, the first full-fledged operating system was created in 1961—it was MCP, written in the ESPOL language. The MCP was developed for the Burroughs B5000 computer, which, despite its innovative technologies, failed to gain a worthy place in the market due to commercial impracticality.
In 1964, an attempt to develop the concept of multitasking was made at the Massachusetts Institute of Technology (MIT), which led to the creation of CTSS, a multitasking operating system. This system was capable of effectively distributing hardware resources among different programs and users. The result of the project was a system known as Multics, which became a significant step forward in the field of operating systems and multitasking.
The creators of Multics were striving for the perfect solution, but encountered what is commonly known as second-system syndrome. They decided to rewrite almost all components of the project from scratch, which led to its significant growth. As a result, the completion date for the development was constantly postponed.
The operating system was developed using the PL/I programming language. The compilation of this language was entrusted to an outsourcing company, but the project was not successful. As a result, to overcome the difficulties that arose, a team of scientists developed a new language called EPL and continued developing a system based on it.
In 1969, Bell Labs, one of the key participants in the project, recognized its unpromising nature and decided to leave it. As a result, Bell Labs employee Ken Thompson used the project's developments to create UNIX, an operating system designed for the PDP-7 minicomputer. UNIX became the basis for many modern operating systems and had a significant influence on the development of computing technology.
UNIX and High-Level Languages
Many people mistakenly believe that the UNIX operating system was created in the C language, but this is not true. In fact, UNIX was developed entirely in assembly language. Unlike the Multics developers, the team that created UNIX avoided the second system syndrome. They first created a working component and then focused on writing documentation for it. This development methodology contributed to a more stable and efficient operating system, making UNIX the basis for many modern systems.
In 1969, the B programming language was developed at Bell Labs. It was used to write various utilities for the UNIX operating system, and assembly language was also used. The B language was an important step in the evolution of programming and laid the foundation for the creation of more complex languages such as C, which subsequently significantly influenced software and systems development.
The UNIX developers were faced with the insufficient performance of the B language. Although they believed that an operating system could be created in a high-level language, B turned out to be an unsuitable option. The main problem was the lack of byte addressability, which limited the possibilities of system development and optimization.
The C programming language was developed in the early 1970s. The first version of the language did not contain structures, which were introduced only in 1973 for the needs of the UNIX operating system kernel. During this period, bit fields were added, which significantly expanded the capabilities of the language and improved its functionality. The C language became the basis for the development of many other programming languages and had a significant influence on modern programming.
The programming language developed gradually, which is both its advantage and disadvantage. One of the disadvantages, in my opinion, is the lack of a logical XOR operation. One of the creators of the language claimed that XOR is not suitable for performing calculations according to a short circuit, which puzzles me. This limitation can complicate the development and optimization of algorithms that require the use of logical operations.
The C programming language continued to evolve, and macros were introduced, which are one of the key features similar to those in Rust. Preprocessors also play a significant role in this process. While preprocessors are not always preferred by many developers, they are essential tools for systems such as DTrace and ZFS. These features extend the functionality of the language and enable the creation of more complex and efficient solutions.
Operating Systems in the 1980s and 1990s
In the 1980s, the C programming language dominated operating system development, and most operating systems were based on it. However, in the 1990s, a trend toward object-oriented programming emerged, leading to the view that C-based operating systems were obsolete. They were expected to be replaced by systems written in Java and C++. However, these attempts were unsuccessful, partly due to a phenomenon known as second-system syndrome.
In the 1990s, when Gil Amelio served as Apple's CEO, the company actively promoted Mac OS Copland, but was never able to release the operating system. At the time, competitors in Silicon Valley were watching Apple's struggles, hoping for its bankruptcy so they could acquire its assets at a low price. This period became critical for the company, as it had to overcome significant financial and technical challenges that would determine its future fate in the tech market.

Sun Microsystems developed the Spring operating system in C++. As a student, I came across a Spring CD and tried to install it on my computer, but the system wouldn't boot. The problem was that I only had 32 MB of RAM, while the installation required at least 128 MB. Today, this is comparable to requiring 2 TB of RAM.
Creating an operating system in Java turned out to be impossible. The main reason is the lack of an unsigned data type in this language, which significantly complicates the interaction of the system with the hardware.
Operating Systems in the 2000s
Since the advent of Linux, writing operating systems in C has become the industry standard. Many developers have tried to create an OS kernel in C++, but most of these attempts have been unsuccessful. The Haiku project is an exception, but it was primarily a hobby project and never reached the level of serious systems.
In the early 2000s, Java and C++ were considered the main programming languages. In subsequent years, languages such as Ruby, Python, and JavaScript emerged, focusing on speeding up the development process. However, despite their popularity, no one has attempted to create an operating system in Ruby or Python, which highlights the specific application of these languages and their limitations in the context of systems programming.
JavaScript was initially not very popular, but its use increased significantly in 2006. At that time, developers realized that browsers began to support a full-fledged language that allows for the creation of powerful web applications. For me, JavaScript is a kind of disguised Lisp, adapted for running in a browser, but with a simplified syntactic structure, without an abundance of parentheses. This language has become a staple for web developers, opening up new horizons in creating interactive and dynamic websites. By the 2010s, systems programmers were looking for a programming language that would combine the high performance of C with the convenient tools found in other languages. Key features they were looking for were features like the split() method and support for regular expressions, which would simplify string processing and regular operations. Creating such a language would be a significant step forward in software development, striking a balance between efficiency and ease of development. JavaScript has given rise to many interesting developments. One of these was the powerful V8 engine, which enables server-side JavaScript execution. This was followed by Node.js, which opened up new horizons for developing server-side applications. Despite my liking for JavaScript, its use in systems software can be challenging. Some Bell Labs employees joined the Google team and developed the Go programming language. This language is free from many of JavaScript's shortcomings, but it has its own unique features. Go offers stronger typing, which reduces compile-time errors and improves performance. In addition, it supports concurrent programming, making it an ideal choice for developing high-load applications.
In his presentation, Google developer Adin Scannell noted that it is possible to create an operating system kernel using Go. However, like JavaScript, Go shares a common problem: garbage collectors. These memory management mechanisms can significantly slow down system programs, making them ineffective for operating system development. Therefore, developers should consider these limitations when choosing programming languages for such tasks.
What's special about Rust
I've written over a hundred thousand lines of code in C++ and don't plan to return to this language. Recently, I have become increasingly attracted to Rust, as it combines high performance and safety, making it an ideal choice for developing systems software. Rust offers modern approaches to memory management, which significantly reduces the likelihood of errors. These values make it attractive for developers looking to create reliable and efficient applications.
One of the key features of the Rust programming language is the concept of ownership. Rust statically determines who owns a particular resource, which provides a high level of memory safety. The compiler manages the allocation and deallocation of memory, doing this automatically when you finish using the resource. If the compiler cannot establish the owner of the memory, it uses the borrowing mechanism. This approach avoids memory leaks and ensures that one program cannot overwrite the memory of another. Thus, Rust provides safety and efficiency in working with resources, making it an attractive choice for developing reliable applications.
There are many features in Rust that I really like. This programming language offers a rich set of capabilities that allow developers to solve problems efficiently. One of its key features is its memory management system, which ensures safety and prevents leaks. Also worth noting are its powerful concurrency tools, making Rust an ideal choice for developing high-performance applications. Furthermore, its user-friendly syntax and support for functional programming make it attractive to developers of all skill levels. Rust allows for the creation of reliable and efficient code, which is undoubtedly one of the reasons for its popularity among programmers.
Algebraic types are a powerful tool for error handling in programming. They function similarly to unions in C, offering efficient mechanisms for working with different data states. Using algebraic types allows developers to manage errors more safely and clearly, improving code readability and maintainability. When used correctly, algebraic types can significantly improve software quality by minimizing the likelihood of unexpected failures and simplifying debugging.
Hygienic macros are a powerful tool for programming language development. Unlike C, where they are not used, in other languages such as Rust or Lisp, hygienic macros allow you to create safer and more predictable code. One of the main advantages of such macros is that they minimize the likelihood of name collisions, simplifying the process of writing and maintaining software code. The ability to access hygiene macros as an abstract syntax tree alongside the rest of your code opens up new horizons for developers, enabling more complex and flexible solutions.
Rust's external function interface is carefully designed, allowing seamless integration of C code into Rust programs and vice versa. This interoperability between languages provides greater flexibility and extensibility, making Rust an ideal choice for developers looking to leverage existing C code in new applications.
The unsafe keyword is used to disable memory safety, allowing operations that the compiler would otherwise prohibit. This keyword gives developers the ability to directly manage memory and optimize code, but requires careful use, as it can introduce bugs and vulnerabilities. Using unsafe allows you to develop high-performance applications, but it is important to consider the risks associated with the security and stability of the program.
Is it possible to write an operating system in Rust?
Rust is a programming language that is ideal for developing operating systems. For the past 30 years, developers have been looking for a tool that would ensure memory safety and high performance. Rust combines these qualities, allowing you to create reliable and efficient systems. Thanks to its memory management system and strong typing, Rust minimizes the risks associated with errors, making it an excellent choice for systems programming. In this context, Rust opens new horizons for developers striving to create modern and secure operating systems.
The first known attempt to develop an operating system was Weenix. This project was created by student Zachary Espiritu as part of his diploma thesis. In his research, he describes in detail the difficulties and challenges he faced during the development process. Weenix was an important step in understanding the principles of operating system development and opened new horizons for further research in this area.
Since 2015, small operating systems based on the Rust programming language have begun to appear, such as Redox, Tock, IntermezzOS, BlogOS, QuiltOS, and Rux. Of these, IntermezzOS and BlogOS are educational projects, while Tock was developed with a focus on IoT devices. These operating systems demonstrate the growing interest in Rust in the field of systems programming and its potential for creating secure and efficient platforms.
Unfortunately, these operating systems lack binary compatibility with Linux, making it impossible to run most Linux applications. Therefore, I believe that hybrid approaches are the optimal solution for developing operating systems in Rust. This approach allows for the integration of best practices and capabilities across platforms, providing support for essential programs and expanding system functionality.
Why I'm Looking Forward to Hybrid C and Rust Operating Systems
I'm very optimistic about the prospects for the Rust programming language. I'm confident that it can be effectively applied to operating system development, including firmware, kernel extensions, and various OS components. However, in practice, significant challenges may arise that require attention and solutions. Rust offers a number of advantages, such as memory safety and high performance, making it an attractive choice for systems programming.
Rust provides compatibility with systems developed in C, which is one of its key features. This compatibility opens up broad horizons for developers, allowing them to integrate Rust into existing projects and leverage its advantages, such as memory safety and performance. This approach leads to more reliable and efficient applications, making Rust an attractive choice for systems software development.
Check out additional materials:
- Facebook* is rusty: why corporations should support the Rust language
- The three testers problem in an interview
- Must read. 7 fresh English-language articles about FreeBSD, NetBSD, and OpenBSD

