Part of:Windows kernel 101 for desktop administrators
Does Windows kernel use Rust and what does it mean for IT?
Desktop administrators need to learn how Windows OSes function to work most effectively, and the kernel at the center of the OS is a great place to start.
All OSes contain a kernel, which serves as the core set of instructions that all other operations and programs rely upon, and the fundamental nature of desktop kernels means that IT admins should learn how they work and what they consist of.
Microsoft has made some recent changes to its kernel, so there is more to learn for admins regardless of their experience level.
Is the Windows kernel written in Rust?
Yes, the Windows kernel currently uses the Rust programming language. Microsoft announced the change in April 2023. The first update that included Rust was pushed out to users and admins with the Windows 11 Insider update preview release in May 2023, and all subsequent updates will include Rust within the Windows kernel.
What is the Windows kernel?
The Windows kernel is the core of Windows OSes and controls key functions, including the following:
Device and hardware control. It communicates with hardware drivers allowing hardware devices to interface with the OS. This allows access to printers, network interfaces, USB drives, hard drives and other devices.
Memory management. This is a complicated task for OSes because all processes require memory allocation to function. The physical hardware provides the memory, and the OS manages it, allowing programs and devices to access memory storage for their data. Obviously, there is a physical limit of RAM, but the OS can also use physical disk storage temporarily. However, inefficient memory storage can increase the memory footprint. The kernel functions almost like a traffic cop that manages or maps memory to applications and other processes. Application failures and OS crashes are often caused by memory errors -- either hardware failure, corruption or a poorly written program.
Thread and process management. Threads are units of execution in CPU resources that are scheduled and managed by the kernel. In multithreaded applications, the OS must manage and track these threads to avoid errors and make execution efficient.
File system management. This aspect is very visible to users, as the file system allows the user to access files on disk and appears in Windows as the File Manager or Windows Explorer. This includes storage, retrieval and management of files as well as working with the security system to assign security tokens to files and folders.
Security and stability. Besides managing security for the file system, one of the kernel's key functions is to enforce security policies and protect the OS. This includes protection from threats such as viruses, malware and other attacks by external sources, as well as protecting the system from errant applications or drivers written intentionally or accidentally to disrupt operations.
The kernel is not to be confused with user applications that interface with the kernel functions but are written in a variety of languages. PowerShell was introduced in Windows XP SP2 and Vista, and it is part of Windows and combines the old CLI in a management framework in an object-oriented language that is a powerful tool. PowerShell is also available on macOS and Linux and interfaces with services such as Azure, Exchange, AWS and Google Cloud. Other application languages have been supported, including the following:
.NET in Windows NT.
Windows Runtime API in Windows, which allowed cross-platform apps and supported JavaScript, HTML5 and CSS.
Through all this, the kernel core was still coded in C and C++. Microsoft continues to move forward on support for universal application development across all hardware platforms.
What is Rust and why is Windows kernel written in Rust?
Rust is an open source programming language, officially released in 2018 and enjoys a certain popularity among developers. Rust has been used in many software applications such as OSes, games, file systems and even virtual reality engines. Its popularity comes from an increased efficiency in its compile-time correctness and has several attractive features for Windows:
Security. One of Rust's key features is a focus on "memory safety." As noted previously, Windows has long been plagued with memory errors such as null references, buffer overflows, data written to bad addresses and more. Rust is designed to avoid common memory-related errors, thus reducing the possibility of system crashes, "hangs," security breaches and application errors.
Reliability. Compared to programs written in C and C++, Rust provides greater reliability through compile-time checks, allowing errors to be resolved prior to run time. Eliminating errors in an OS kernel is key to eliminating system-wide failures.
Concurrent programming.Multithreaded software allows multiple processes to run simultaneously or even at overlapping times. This requires a complex process in which kernels manage the threads to avoid deadlocks and race conditions. Rust enforces strict rules for concurrent programming, which helps prevent data race conditions. Rust enforces strict rules for concurrent programming, providing the benefit of performance and reducing the risk of race conditions causing application and OS failure.
Besides Microsoft, other mainline software applications have converted at least in part to Rust, including Amazon, Facebook, Dropbox, Mozilla, Cloudflare, Coursera, Discord and others.
These advantages of Rust address key kernel functions that have plagued the Windows OS since its inception. Besides Microsoft, other mainline software applications have converted at least in part to Rust, including Amazon, Facebook, Dropbox, Mozilla, Cloudflare, Coursera, Discord and others. Thus, Microsoft is not going out on much of a limb to adopt a relatively new language.
What does Rust in the Windows Kernel mean for IT?
IT Admins could reasonably be concerned about a rewrite of the kernel, prompting various questions:
Is it safe?
Will it make my job easier or harder?
When will this be implemented?
How do I prepare for it?
Since Rust is already implemented with Windows 11, it should not be a concern for IT admins worried about safety or compatibility. There is no need to prepare or worry about implementation.
While the Windows kernel's entire million-plus lines of code aren't completely replaced, key sections will continue to be replaced to improve performance and security. Further, new kernel work will likely move to Rust, just as Linux's new 6.1 kernel did.
The upside is that Microsoft will continue to provide more Rust code to enhance security, memory safety and overall performance.
Gary Olsen has worked in the IT industry since 1983 and holds a Master of Science in computer-aided manufacturing from Brigham Young University. He was on Microsoft's Windows 2000 beta support team for Active Directory from 1998 to 2000 and has written two books on Active Directory and numerous technical articles for magazines and websites.
Virtual desktops and the underlying virtual machines are a critical part of many organization's end-user technology stacks, so admins need to ...
Continue Reading
Apple Pay simplifies checkout for customers, but setup isn't always as straightforward. IT admins can review the costs to decide if Apple Pay makes ...
Continue Reading