SlideShare uma empresa Scribd logo
1 de 23
Baixar para ler offline
Is it time to rewrite the operating
system in Rust?
CTO
bryan@joyent.com
Bryan Cantrill
@bcantrill
Spoiler alert
What even is the operating system?
• The operating system is harder to define than it might seem…
• For every definition, it can be easy to come up with exceptions
• At minimum: the operating system is the program that abstracts
hardware to allow execution of other programs
• The operating system defines the liveness of the machine:
without it, no program can run
• The operating system software that runs with the highest level
of architectural privilege is the operating system kernel
• …but the kernel is not the entire operating system!
Operating system implementation history
• Historically, operating systems — née “executives” — were
written entirely in assembly
• Starting with the Burroughs B5000 MCP in 1961, operating
systems started to be written in higher level languages…
• In 1964, when Project MAC at MIT sought to build a successor
to their Compatible Timesharing System (CTSS), they selected
the language (PL/I) before writing any code (!)
• But PL/I had no functioning compiler — and wouldn’t until 1966
PL/I in Multics
• The decision to use PL/I in Multics was seen by its creators as a
great strength, even when reflecting back in 1971:













• …but that the compiler was unavailable for so long (and when
was available, performed poorly) was a nearly-fatal weakness
Source: “Multics: The first seven years,” Corbato et al.
The birth of Unix
• Bell Labs pulled out of the Multics project in 1969
• A researcher formerly on the Multics effort, Ken Thompson,
implemented a new operating system for the PDP-7
• The system was later ported to the PDP-11/20, where it was
named Unix — a play on “eunuchs” and a contrast to the top-
down complexity of Multics
• Unix was implemented entirely in assembly!
Unix and high-level languages
• The interpreted language B (a BCPL derivative), was present in
Unix, but only used for auxiliary functionality, e.g. the assembler
and an early version of dc(1)
• Some of the B that was in use in Unix was replaced with
assembly for reasons of performance!
• Dennis Ritchie and Thompson developed a B-inspired language
focused on better abstracting the machine, naming it “C”
• Perhaps contrary to myth, C and Unix were not born at the
same instant — they are siblings, not twins!
The C revolution
• C is rightfully called “portable assembly”: it is designed to
closely match the abstraction of the machine itself
• C features memory addressability at its core
• Unlike PL/I, C grew as concrete needs arose
• e.g., C organically adopted important facilities like macro
processing through the C preprocessor
• Standardization efforts came late and were contentious: C
remains infamous for its undefined behaviors
Operating systems in the 1980s
• As the minimal abstraction above the machine, C — despite its
blemishes — proved to be an excellent fit for operating systems
implementation
• With few exceptions, operating systems — Unix or otherwise —
were implemented in C throughout the 1980s
• Other systems existed as research systems, but struggled to
offer comparable performance to C-based systems
Operating systems in the 1990s
• In the 1990s, object oriented programming came into vogue,
with languages like C++ and Java
• By the mid-1990s, C-based systems were thought to be relics
• …but the systems putatively replacing them were rewrites —
and suffered from rampant Second System Syndrome
• They were infamously late (e.g. Apple’s Copland), infamously
slow (e.g. Sun’s Spring), or both (Taligent’s Pink)
• Java-based operating systems like Sun’s JavaOS fared no
better; hard to interact with hardware without unsigned types!
Operating systems in the 2000s
• With the arrival of Linux, Unix enjoyed a resurgence — and

C-based operating systems became deeply entrenched
• With only a few exceptions (e.g., Haiku), serious attempts at

C++-based kernels withered
• At the same time, non-Java/non-C++ languages blossomed:
first Ruby, and then Python and JavaScript
• These languages were focused on ease of development rather
than performance — and there appears to be no serious effort
to implement an operating system in any of these
Systems software in the 2010s
• Systems programmers began pining for something different: the
performance of C, but with more powerful constructs as enjoyed
in other languages
• High-performance JavaScript runtimes allowed for a surprising
use in node.js — but otherwise left much to be desired
• Bell Labs refugees at Google developed Go, which solves some
problems, but with many idiosyncrasies
• Go, JavaScript and others are garbage collected, making
interacting with C either impossible or excruciatingly slow
Rust?
• Rust is a systems software programming language designed
around safety, parallelism, and speed
• Rust has a novel system of ownership, whereby it can statically
determine when a memory object is no longer in use
• This allows for the power of a garbage-collected language, but
with the performance of manual memory management
• This is important because — unlike C — Rust is highly
composable, allowing for more sophisticated (and higher
performing!) primitives
Rust performance (my experience)
Source: http://dtrace.org/blogs/bmc/2018/09/28/the-relative-performance-of-c-and-rust/
Rust: Beyond ownership
• Rust has a number of other features that make it highly
compelling for systems software implementation:
• Algebraic types allow robust, concise error handling
• Hygienic macros allow for safe syntax extensions
• Foreign function interface allows for full-duplex integration
with C without sacrificing performance
• “unsafe” keyword allows for some safety guarantees to be
surgically overruled (though with obvious peril)
• Also: terrific community, thriving ecosystem, etc.
Operating systems in Rust?
• If the history of operating systems implementation teaches us
anything, it’s that runtime characteristics trump development
challenges!
• Structured languages (broadly) replaced assembly because
they performed as well
• Viz., every operating system retains some assembly for reasons
of performance!
• With its focus on performance and zero-cost abstractions, Rust
does represent a real, new candidate programming language
for operating systems implementation
Operating systems in Rust: A first attempt
• First attempt at an operating system kernel in Rust seems to be
Alex Light’s Reenix, ca. 2015: a re-implementation of a teaching
operating system in Rust as an undergrad thesis
• Biggest challenge in Reenix was that Rust forbids an application
from handling allocation failure
• The addition of a global allocator API has improved this in that
now a C-based system can at least handle pressure…
• …but dealing with memory allocation failure is still very much an
unsettled area for Rust (see Rust RFC 2116)
Operating systems in Rust since 2015
• Since Reenix’s first efforts, there have been quite a few small
systems in Rust, e.g.: Redox, Tifflin, Tock, intermezzOS,
RustOS/QuiltOS, Rux, and Philipp Oppermann’s Blog OS
• Some of these are teaching systems (intermezzOS, Blog OS),
some are unikernels (QuiltOS) and/or targeted at IoT (Tock)
• These systems are all de novo, which represents its own
challenges, e.g. forsaking binary compatibility with Linux and
fighting Second System Syndrome
Operating systems in Rust: The challenges
• While Rust’s advantages are themselves clear, it’s less clear
what the advantage is when replacing otherwise working code
• For in-kernel code in particular, the safety argument for Rust
carries less weight: in-kernel C tends to be de facto safe
• Rust does, however, presents new challenges for kernel
development, esp. with respect to multiply-owned structures
• An OS kernel — despite its historic appeal and superficial fit for
Rust — may represent more challenge than its worth
• But what of hybrid approaches?
Hybrid approach I: Rust in-kernel components
• One appeal of Rust is its ability to interoperate with C
• One hybrid approach to explore would be to retain a

C-/assembly-based kernel while allowing for Rust-based

in-kernel components like device drivers and filesystems
• This would allow for an incremental approach — and instead of
rewriting, Rust can be used for new development
• There is a prototype example of this in FreeBSD; others are
presumably possible
Hybrid approach II: Rust OS components
• An operating system is not just a kernel!
• Operating systems have significant functionality at user-level:
utilities, daemons, service-/device-/fault- management facilities,
debuggers, etc.
• If anything, the definition of the OS is expanding to distributed
system that represents a multi-computer control plane — that
itself includes many components
• These components are much more prone to run-time failure!
• Many of these are an excellent candidate for Rust!
Hybrid approach III: Rust-based firmware
• Below the operating system lurks hardware-facing special-
purpose software: firmware
• Firmware is a sewer of unobservable software with a long
history of infamous quality problems
• Firmware has some of the same challenges as kernel
development (e.g., dealing with allocation failures), but may
otherwise be more amenable to Rust
• This is especially true when/where firmware is in user-space
and is network-facing! (e.g., OpenBMC)
Looking forward: Systems software in Rust
• Rust represents something that we haven’t seen in a long time:
a modern language that represents an alternative throughout
the stack of software abstraction
• Despite the interest in operating system kernel implementation,
that might not be a good first fit for Rust
• Rust allows hybrid approaches, allowing for productive kernel
incrementalism rather than whole-system rewrites
• Firmware and user-level operating system software are two very
promising candidates for implementation in Rust!

Mais conteúdo relacionado

Mais procurados

Container Security Vulnerability Scanning with Trivy
Container Security Vulnerability Scanning with TrivyContainer Security Vulnerability Scanning with Trivy
Container Security Vulnerability Scanning with TrivyFaheem Memon
 
Splunk Cloud
Splunk CloudSplunk Cloud
Splunk CloudSplunk
 
Citi Tech Talk Disaster Recovery Solutions Deep Dive
Citi Tech Talk  Disaster Recovery Solutions Deep DiveCiti Tech Talk  Disaster Recovery Solutions Deep Dive
Citi Tech Talk Disaster Recovery Solutions Deep Diveconfluent
 
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Tim Bozarth
 
Understanding container security
Understanding container securityUnderstanding container security
Understanding container securityJohn Kinsella
 
Connecting mq&kafka
Connecting mq&kafkaConnecting mq&kafka
Connecting mq&kafkaMatt Leming
 
Adapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at GoogleAdapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at GoogleApigee | Google Cloud
 
Docker Hub: Past, Present and Future by Ken Cochrane & BC Wong
Docker Hub: Past, Present and Future by Ken Cochrane & BC WongDocker Hub: Past, Present and Future by Ken Cochrane & BC Wong
Docker Hub: Past, Present and Future by Ken Cochrane & BC WongDocker, Inc.
 
Apache Knox setup and hive and hdfs Access using KNOX
Apache Knox setup and hive and hdfs Access using KNOXApache Knox setup and hive and hdfs Access using KNOX
Apache Knox setup and hive and hdfs Access using KNOXAbhishek Mallick
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes NetworkingCJ Cullen
 
DAIS19: On the Performance of ARM TrustZone
DAIS19: On the Performance of ARM TrustZoneDAIS19: On the Performance of ARM TrustZone
DAIS19: On the Performance of ARM TrustZoneLEGATO project
 
Vault Open Source vs Enterprise v2
Vault Open Source vs Enterprise v2Vault Open Source vs Enterprise v2
Vault Open Source vs Enterprise v2Stenio Ferreira
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Exploring Thermal Related Stuff in iDevices using Open-Source Tool
Exploring Thermal Related Stuff in iDevices using Open-Source ToolExploring Thermal Related Stuff in iDevices using Open-Source Tool
Exploring Thermal Related Stuff in iDevices using Open-Source ToolKoan-Sin Tan
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesLuciano Fiandesio
 
Using Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterpriseUsing Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterpriseDataWorks Summit
 

Mais procurados (20)

Container Security Vulnerability Scanning with Trivy
Container Security Vulnerability Scanning with TrivyContainer Security Vulnerability Scanning with Trivy
Container Security Vulnerability Scanning with Trivy
 
Splunk Cloud
Splunk CloudSplunk Cloud
Splunk Cloud
 
Citi Tech Talk Disaster Recovery Solutions Deep Dive
Citi Tech Talk  Disaster Recovery Solutions Deep DiveCiti Tech Talk  Disaster Recovery Solutions Deep Dive
Citi Tech Talk Disaster Recovery Solutions Deep Dive
 
WHONIX OS
WHONIX OSWHONIX OS
WHONIX OS
 
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
Netflix: From Zero to Production-Ready in Minutes (QCon 2017)
 
Understanding container security
Understanding container securityUnderstanding container security
Understanding container security
 
Connecting mq&kafka
Connecting mq&kafkaConnecting mq&kafka
Connecting mq&kafka
 
Adapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at GoogleAdapt or Die: A Microservices Story at Google
Adapt or Die: A Microservices Story at Google
 
Docker Hub: Past, Present and Future by Ken Cochrane & BC Wong
Docker Hub: Past, Present and Future by Ken Cochrane & BC WongDocker Hub: Past, Present and Future by Ken Cochrane & BC Wong
Docker Hub: Past, Present and Future by Ken Cochrane & BC Wong
 
Apache Knox setup and hive and hdfs Access using KNOX
Apache Knox setup and hive and hdfs Access using KNOXApache Knox setup and hive and hdfs Access using KNOX
Apache Knox setup and hive and hdfs Access using KNOX
 
Kali Linux
Kali LinuxKali Linux
Kali Linux
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
DAIS19: On the Performance of ARM TrustZone
DAIS19: On the Performance of ARM TrustZoneDAIS19: On the Performance of ARM TrustZone
DAIS19: On the Performance of ARM TrustZone
 
Multi Stage Docker Build
Multi Stage Docker Build Multi Stage Docker Build
Multi Stage Docker Build
 
Vault Open Source vs Enterprise v2
Vault Open Source vs Enterprise v2Vault Open Source vs Enterprise v2
Vault Open Source vs Enterprise v2
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Exploring Thermal Related Stuff in iDevices using Open-Source Tool
Exploring Thermal Related Stuff in iDevices using Open-Source ToolExploring Thermal Related Stuff in iDevices using Open-Source Tool
Exploring Thermal Related Stuff in iDevices using Open-Source Tool
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
F5 Web Application Security
F5 Web Application SecurityF5 Web Application Security
F5 Web Application Security
 
Using Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterpriseUsing Spark Streaming and NiFi for the next generation of ETL in the enterprise
Using Spark Streaming and NiFi for the next generation of ETL in the enterprise
 

Semelhante a Is it time to rewrite the operating system in Rust?

Operating Systems As a Product
Operating Systems As a ProductOperating Systems As a Product
Operating Systems As a ProductHarshit Srivastava
 
Introducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsIntroducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsAnant Narayanan
 
Manta: a new internet-facing object storage facility that features compute by...
Manta: a new internet-facing object storage facility that features compute by...Manta: a new internet-facing object storage facility that features compute by...
Manta: a new internet-facing object storage facility that features compute by...Hakka Labs
 
Introduction about linux
Introduction about linuxIntroduction about linux
Introduction about linuxABHISHEK KUMAR
 
Presentation on o s for bca iv
Presentation on o s for bca ivPresentation on o s for bca iv
Presentation on o s for bca ivAjit Singh
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsAnant Narayanan
 
Unix lecture1
Unix lecture1Unix lecture1
Unix lecture1dolleyj
 
introduction.pdf
introduction.pdfintroduction.pdf
introduction.pdfxiso
 
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
2015 bioinformatics python_introduction_wim_vancriekinge_vfinalProf. Wim Van Criekinge
 
Topic_2_Introduction_to_Unix.pptx
Topic_2_Introduction_to_Unix.pptxTopic_2_Introduction_to_Unix.pptx
Topic_2_Introduction_to_Unix.pptxdulala3
 
Linux [2005]
Linux [2005]Linux [2005]
Linux [2005]Raul Soto
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linuxsureskal
 

Semelhante a Is it time to rewrite the operating system in Rust? (20)

Operating Systems As a Product
Operating Systems As a ProductOperating Systems As a Product
Operating Systems As a Product
 
Linux forensics
Linux forensicsLinux forensics
Linux forensics
 
Introducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsIntroducing Plan9 from Bell Labs
Introducing Plan9 from Bell Labs
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Manta: a new internet-facing object storage facility that features compute by...
Manta: a new internet-facing object storage facility that features compute by...Manta: a new internet-facing object storage facility that features compute by...
Manta: a new internet-facing object storage facility that features compute by...
 
Plan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIXPlan 9: Not (Only) A Better UNIX
Plan 9: Not (Only) A Better UNIX
 
Introduction about linux
Introduction about linuxIntroduction about linux
Introduction about linux
 
Presentation on o s for bca iv
Presentation on o s for bca ivPresentation on o s for bca iv
Presentation on o s for bca iv
 
Os concepts
Os conceptsOs concepts
Os concepts
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell Labs
 
Unix lecture1
Unix lecture1Unix lecture1
Unix lecture1
 
Ch1-Unix.pptx
Ch1-Unix.pptxCh1-Unix.pptx
Ch1-Unix.pptx
 
introduction.pdf
introduction.pdfintroduction.pdf
introduction.pdf
 
Linux
LinuxLinux
Linux
 
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
2015 bioinformatics python_introduction_wim_vancriekinge_vfinal
 
RTOS [Autosaved].pptx
RTOS [Autosaved].pptxRTOS [Autosaved].pptx
RTOS [Autosaved].pptx
 
os_1.pdf
os_1.pdfos_1.pdf
os_1.pdf
 
Topic_2_Introduction_to_Unix.pptx
Topic_2_Introduction_to_Unix.pptxTopic_2_Introduction_to_Unix.pptx
Topic_2_Introduction_to_Unix.pptx
 
Linux [2005]
Linux [2005]Linux [2005]
Linux [2005]
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 

Mais de bcantrill

Predicting the Present
Predicting the PresentPredicting the Present
Predicting the Presentbcantrill
 
Sharpening the Axe: The Primacy of Toolmaking
Sharpening the Axe: The Primacy of ToolmakingSharpening the Axe: The Primacy of Toolmaking
Sharpening the Axe: The Primacy of Toolmakingbcantrill
 
Coming of Age: Developing young technologists without robbing them of their y...
Coming of Age: Developing young technologists without robbing them of their y...Coming of Age: Developing young technologists without robbing them of their y...
Coming of Age: Developing young technologists without robbing them of their y...bcantrill
 
Towards Holistic Systems
Towards Holistic SystemsTowards Holistic Systems
Towards Holistic Systemsbcantrill
 
The Coming Firmware Revolution
The Coming Firmware RevolutionThe Coming Firmware Revolution
The Coming Firmware Revolutionbcantrill
 
Hardware/software Co-design: The Coming Golden Age
Hardware/software Co-design: The Coming Golden AgeHardware/software Co-design: The Coming Golden Age
Hardware/software Co-design: The Coming Golden Agebcantrill
 
Tockilator: Deducing Tock execution flows from Ibex Verilator traces
Tockilator: Deducing Tock execution flows from Ibex Verilator tracesTockilator: Deducing Tock execution flows from Ibex Verilator traces
Tockilator: Deducing Tock execution flows from Ibex Verilator tracesbcantrill
 
No Moore Left to Give: Enterprise Computing After Moore's Law
No Moore Left to Give: Enterprise Computing After Moore's LawNo Moore Left to Give: Enterprise Computing After Moore's Law
No Moore Left to Give: Enterprise Computing After Moore's Lawbcantrill
 
Andreessen's Corollary: Ethical Dilemmas in Software Engineering
Andreessen's Corollary: Ethical Dilemmas in Software EngineeringAndreessen's Corollary: Ethical Dilemmas in Software Engineering
Andreessen's Corollary: Ethical Dilemmas in Software Engineeringbcantrill
 
Visualizing Systems with Statemaps
Visualizing Systems with StatemapsVisualizing Systems with Statemaps
Visualizing Systems with Statemapsbcantrill
 
Platform values, Rust, and the implications for system software
Platform values, Rust, and the implications for system softwarePlatform values, Rust, and the implications for system software
Platform values, Rust, and the implications for system softwarebcantrill
 
dtrace.conf(16): DTrace state of the union
dtrace.conf(16): DTrace state of the uniondtrace.conf(16): DTrace state of the union
dtrace.conf(16): DTrace state of the unionbcantrill
 
The Hurricane's Butterfly: Debugging pathologically performing systems
The Hurricane's Butterfly: Debugging pathologically performing systemsThe Hurricane's Butterfly: Debugging pathologically performing systems
The Hurricane's Butterfly: Debugging pathologically performing systemsbcantrill
 
Papers We Love: ARC after dark
Papers We Love: ARC after darkPapers We Love: ARC after dark
Papers We Love: ARC after darkbcantrill
 
Principles of Technology Leadership
Principles of Technology LeadershipPrinciples of Technology Leadership
Principles of Technology Leadershipbcantrill
 
Platform as reflection of values: Joyent, node.js, and beyond
Platform as reflection of values: Joyent, node.js, and beyondPlatform as reflection of values: Joyent, node.js, and beyond
Platform as reflection of values: Joyent, node.js, and beyondbcantrill
 
Debugging under fire: Keeping your head when systems have lost their mind
Debugging under fire: Keeping your head when systems have lost their mindDebugging under fire: Keeping your head when systems have lost their mind
Debugging under fire: Keeping your head when systems have lost their mindbcantrill
 
Down Memory Lane: Two Decades with the Slab Allocator
Down Memory Lane: Two Decades with the Slab AllocatorDown Memory Lane: Two Decades with the Slab Allocator
Down Memory Lane: Two Decades with the Slab Allocatorbcantrill
 
The State of Cloud 2016: The whirlwind of creative destruction
The State of Cloud 2016: The whirlwind of creative destructionThe State of Cloud 2016: The whirlwind of creative destruction
The State of Cloud 2016: The whirlwind of creative destructionbcantrill
 
Oral tradition in software engineering: Passing the craft across generations
Oral tradition in software engineering: Passing the craft across generationsOral tradition in software engineering: Passing the craft across generations
Oral tradition in software engineering: Passing the craft across generationsbcantrill
 

Mais de bcantrill (20)

Predicting the Present
Predicting the PresentPredicting the Present
Predicting the Present
 
Sharpening the Axe: The Primacy of Toolmaking
Sharpening the Axe: The Primacy of ToolmakingSharpening the Axe: The Primacy of Toolmaking
Sharpening the Axe: The Primacy of Toolmaking
 
Coming of Age: Developing young technologists without robbing them of their y...
Coming of Age: Developing young technologists without robbing them of their y...Coming of Age: Developing young technologists without robbing them of their y...
Coming of Age: Developing young technologists without robbing them of their y...
 
Towards Holistic Systems
Towards Holistic SystemsTowards Holistic Systems
Towards Holistic Systems
 
The Coming Firmware Revolution
The Coming Firmware RevolutionThe Coming Firmware Revolution
The Coming Firmware Revolution
 
Hardware/software Co-design: The Coming Golden Age
Hardware/software Co-design: The Coming Golden AgeHardware/software Co-design: The Coming Golden Age
Hardware/software Co-design: The Coming Golden Age
 
Tockilator: Deducing Tock execution flows from Ibex Verilator traces
Tockilator: Deducing Tock execution flows from Ibex Verilator tracesTockilator: Deducing Tock execution flows from Ibex Verilator traces
Tockilator: Deducing Tock execution flows from Ibex Verilator traces
 
No Moore Left to Give: Enterprise Computing After Moore's Law
No Moore Left to Give: Enterprise Computing After Moore's LawNo Moore Left to Give: Enterprise Computing After Moore's Law
No Moore Left to Give: Enterprise Computing After Moore's Law
 
Andreessen's Corollary: Ethical Dilemmas in Software Engineering
Andreessen's Corollary: Ethical Dilemmas in Software EngineeringAndreessen's Corollary: Ethical Dilemmas in Software Engineering
Andreessen's Corollary: Ethical Dilemmas in Software Engineering
 
Visualizing Systems with Statemaps
Visualizing Systems with StatemapsVisualizing Systems with Statemaps
Visualizing Systems with Statemaps
 
Platform values, Rust, and the implications for system software
Platform values, Rust, and the implications for system softwarePlatform values, Rust, and the implications for system software
Platform values, Rust, and the implications for system software
 
dtrace.conf(16): DTrace state of the union
dtrace.conf(16): DTrace state of the uniondtrace.conf(16): DTrace state of the union
dtrace.conf(16): DTrace state of the union
 
The Hurricane's Butterfly: Debugging pathologically performing systems
The Hurricane's Butterfly: Debugging pathologically performing systemsThe Hurricane's Butterfly: Debugging pathologically performing systems
The Hurricane's Butterfly: Debugging pathologically performing systems
 
Papers We Love: ARC after dark
Papers We Love: ARC after darkPapers We Love: ARC after dark
Papers We Love: ARC after dark
 
Principles of Technology Leadership
Principles of Technology LeadershipPrinciples of Technology Leadership
Principles of Technology Leadership
 
Platform as reflection of values: Joyent, node.js, and beyond
Platform as reflection of values: Joyent, node.js, and beyondPlatform as reflection of values: Joyent, node.js, and beyond
Platform as reflection of values: Joyent, node.js, and beyond
 
Debugging under fire: Keeping your head when systems have lost their mind
Debugging under fire: Keeping your head when systems have lost their mindDebugging under fire: Keeping your head when systems have lost their mind
Debugging under fire: Keeping your head when systems have lost their mind
 
Down Memory Lane: Two Decades with the Slab Allocator
Down Memory Lane: Two Decades with the Slab AllocatorDown Memory Lane: Two Decades with the Slab Allocator
Down Memory Lane: Two Decades with the Slab Allocator
 
The State of Cloud 2016: The whirlwind of creative destruction
The State of Cloud 2016: The whirlwind of creative destructionThe State of Cloud 2016: The whirlwind of creative destruction
The State of Cloud 2016: The whirlwind of creative destruction
 
Oral tradition in software engineering: Passing the craft across generations
Oral tradition in software engineering: Passing the craft across generationsOral tradition in software engineering: Passing the craft across generations
Oral tradition in software engineering: Passing the craft across generations
 

Último

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Último (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

Is it time to rewrite the operating system in Rust?

  • 1. Is it time to rewrite the operating system in Rust? CTO bryan@joyent.com Bryan Cantrill @bcantrill
  • 3. What even is the operating system? • The operating system is harder to define than it might seem… • For every definition, it can be easy to come up with exceptions • At minimum: the operating system is the program that abstracts hardware to allow execution of other programs • The operating system defines the liveness of the machine: without it, no program can run • The operating system software that runs with the highest level of architectural privilege is the operating system kernel • …but the kernel is not the entire operating system!
  • 4. Operating system implementation history • Historically, operating systems — née “executives” — were written entirely in assembly • Starting with the Burroughs B5000 MCP in 1961, operating systems started to be written in higher level languages… • In 1964, when Project MAC at MIT sought to build a successor to their Compatible Timesharing System (CTSS), they selected the language (PL/I) before writing any code (!) • But PL/I had no functioning compiler — and wouldn’t until 1966
  • 5. PL/I in Multics • The decision to use PL/I in Multics was seen by its creators as a great strength, even when reflecting back in 1971:
 
 
 
 
 
 
 • …but that the compiler was unavailable for so long (and when was available, performed poorly) was a nearly-fatal weakness Source: “Multics: The first seven years,” Corbato et al.
  • 6. The birth of Unix • Bell Labs pulled out of the Multics project in 1969 • A researcher formerly on the Multics effort, Ken Thompson, implemented a new operating system for the PDP-7 • The system was later ported to the PDP-11/20, where it was named Unix — a play on “eunuchs” and a contrast to the top- down complexity of Multics • Unix was implemented entirely in assembly!
  • 7. Unix and high-level languages • The interpreted language B (a BCPL derivative), was present in Unix, but only used for auxiliary functionality, e.g. the assembler and an early version of dc(1) • Some of the B that was in use in Unix was replaced with assembly for reasons of performance! • Dennis Ritchie and Thompson developed a B-inspired language focused on better abstracting the machine, naming it “C” • Perhaps contrary to myth, C and Unix were not born at the same instant — they are siblings, not twins!
  • 8. The C revolution • C is rightfully called “portable assembly”: it is designed to closely match the abstraction of the machine itself • C features memory addressability at its core • Unlike PL/I, C grew as concrete needs arose • e.g., C organically adopted important facilities like macro processing through the C preprocessor • Standardization efforts came late and were contentious: C remains infamous for its undefined behaviors
  • 9. Operating systems in the 1980s • As the minimal abstraction above the machine, C — despite its blemishes — proved to be an excellent fit for operating systems implementation • With few exceptions, operating systems — Unix or otherwise — were implemented in C throughout the 1980s • Other systems existed as research systems, but struggled to offer comparable performance to C-based systems
  • 10. Operating systems in the 1990s • In the 1990s, object oriented programming came into vogue, with languages like C++ and Java • By the mid-1990s, C-based systems were thought to be relics • …but the systems putatively replacing them were rewrites — and suffered from rampant Second System Syndrome • They were infamously late (e.g. Apple’s Copland), infamously slow (e.g. Sun’s Spring), or both (Taligent’s Pink) • Java-based operating systems like Sun’s JavaOS fared no better; hard to interact with hardware without unsigned types!
  • 11. Operating systems in the 2000s • With the arrival of Linux, Unix enjoyed a resurgence — and
 C-based operating systems became deeply entrenched • With only a few exceptions (e.g., Haiku), serious attempts at
 C++-based kernels withered • At the same time, non-Java/non-C++ languages blossomed: first Ruby, and then Python and JavaScript • These languages were focused on ease of development rather than performance — and there appears to be no serious effort to implement an operating system in any of these
  • 12. Systems software in the 2010s • Systems programmers began pining for something different: the performance of C, but with more powerful constructs as enjoyed in other languages • High-performance JavaScript runtimes allowed for a surprising use in node.js — but otherwise left much to be desired • Bell Labs refugees at Google developed Go, which solves some problems, but with many idiosyncrasies • Go, JavaScript and others are garbage collected, making interacting with C either impossible or excruciatingly slow
  • 13. Rust? • Rust is a systems software programming language designed around safety, parallelism, and speed • Rust has a novel system of ownership, whereby it can statically determine when a memory object is no longer in use • This allows for the power of a garbage-collected language, but with the performance of manual memory management • This is important because — unlike C — Rust is highly composable, allowing for more sophisticated (and higher performing!) primitives
  • 14. Rust performance (my experience) Source: http://dtrace.org/blogs/bmc/2018/09/28/the-relative-performance-of-c-and-rust/
  • 15. Rust: Beyond ownership • Rust has a number of other features that make it highly compelling for systems software implementation: • Algebraic types allow robust, concise error handling • Hygienic macros allow for safe syntax extensions • Foreign function interface allows for full-duplex integration with C without sacrificing performance • “unsafe” keyword allows for some safety guarantees to be surgically overruled (though with obvious peril) • Also: terrific community, thriving ecosystem, etc.
  • 16. Operating systems in Rust? • If the history of operating systems implementation teaches us anything, it’s that runtime characteristics trump development challenges! • Structured languages (broadly) replaced assembly because they performed as well • Viz., every operating system retains some assembly for reasons of performance! • With its focus on performance and zero-cost abstractions, Rust does represent a real, new candidate programming language for operating systems implementation
  • 17. Operating systems in Rust: A first attempt • First attempt at an operating system kernel in Rust seems to be Alex Light’s Reenix, ca. 2015: a re-implementation of a teaching operating system in Rust as an undergrad thesis • Biggest challenge in Reenix was that Rust forbids an application from handling allocation failure • The addition of a global allocator API has improved this in that now a C-based system can at least handle pressure… • …but dealing with memory allocation failure is still very much an unsettled area for Rust (see Rust RFC 2116)
  • 18. Operating systems in Rust since 2015 • Since Reenix’s first efforts, there have been quite a few small systems in Rust, e.g.: Redox, Tifflin, Tock, intermezzOS, RustOS/QuiltOS, Rux, and Philipp Oppermann’s Blog OS • Some of these are teaching systems (intermezzOS, Blog OS), some are unikernels (QuiltOS) and/or targeted at IoT (Tock) • These systems are all de novo, which represents its own challenges, e.g. forsaking binary compatibility with Linux and fighting Second System Syndrome
  • 19. Operating systems in Rust: The challenges • While Rust’s advantages are themselves clear, it’s less clear what the advantage is when replacing otherwise working code • For in-kernel code in particular, the safety argument for Rust carries less weight: in-kernel C tends to be de facto safe • Rust does, however, presents new challenges for kernel development, esp. with respect to multiply-owned structures • An OS kernel — despite its historic appeal and superficial fit for Rust — may represent more challenge than its worth • But what of hybrid approaches?
  • 20. Hybrid approach I: Rust in-kernel components • One appeal of Rust is its ability to interoperate with C • One hybrid approach to explore would be to retain a
 C-/assembly-based kernel while allowing for Rust-based
 in-kernel components like device drivers and filesystems • This would allow for an incremental approach — and instead of rewriting, Rust can be used for new development • There is a prototype example of this in FreeBSD; others are presumably possible
  • 21. Hybrid approach II: Rust OS components • An operating system is not just a kernel! • Operating systems have significant functionality at user-level: utilities, daemons, service-/device-/fault- management facilities, debuggers, etc. • If anything, the definition of the OS is expanding to distributed system that represents a multi-computer control plane — that itself includes many components • These components are much more prone to run-time failure! • Many of these are an excellent candidate for Rust!
  • 22. Hybrid approach III: Rust-based firmware • Below the operating system lurks hardware-facing special- purpose software: firmware • Firmware is a sewer of unobservable software with a long history of infamous quality problems • Firmware has some of the same challenges as kernel development (e.g., dealing with allocation failures), but may otherwise be more amenable to Rust • This is especially true when/where firmware is in user-space and is network-facing! (e.g., OpenBMC)
  • 23. Looking forward: Systems software in Rust • Rust represents something that we haven’t seen in a long time: a modern language that represents an alternative throughout the stack of software abstraction • Despite the interest in operating system kernel implementation, that might not be a good first fit for Rust • Rust allows hybrid approaches, allowing for productive kernel incrementalism rather than whole-system rewrites • Firmware and user-level operating system software are two very promising candidates for implementation in Rust!