SerenityOS: Building an Operating System from Scratch
In early February the programming podcast “CoRecursive” explored a unique project to build an operating system entirely from scratch — and how that project grew out of a very personal journey.
The podcast’s host, developer Adam Gordon Bell, began by sharing estimates that building Windows XP took more than 2,000 developers. And yet, Swedish developer Andreas Kling launched a project to build one on his own, coding what Bell describes as resembling an “alternate-world version of the Windows 95 that I grew up using.”
The operating system’s official website even describes SerenityOS as “a love letter to ’90s user interfaces,” but “with a custom Unix-like core.”
Kling told Bell he enjoys reconstructing old ideas using modern development practices and technology. (And he notes the irony that “it’s so much easier today to build a system that looks and feels like something from the year 2000 than it was back then.”)
One 2019 video even shows Kling porting the classic 1993 videogame DOOM to his operating system. An OS update announced in January includes a port of the classic 1998 videogame Half-Life.
On his GitHub profile, Kling describes the project as trying to make Unix fun again.
💁♂️ People who don’t program for fun may sometimes struggle to understand why those of us who do are putting so much time and effort into it.
It’s simple: effort is a universal amplifier!
Effort @ work = better results 👔👍
Effort @ fun = better fun 🤓👍
— Andreas Kling (@awesomekling) February 7, 2022
But it’s also the outgrowth of a long-standing love of programming — and a deep-rooted philosophy that developers should have access to the code for the software they’re using.
How the OS Project Started
In 2011 Kling took a position at Apple that he remembers as “kind of just obsessively working on WebKit and Safari stuff,” working long hours on performance optimizations and benchmark tracking. Kling’s work took him beyond the browser through Apple’s in-house libraries for things like networking and image decoding — “traversing the stack up and down.”
But Apple also exposed Kling to a unique environment, since the company controls its entire stack — now even making its own CPUs, along with its own browser engine, system calls and even the Swift programming language. It’s a world where the components you’re combining together aren’t black boxes but Kling said, “just something made for you by one of your colleagues.”
This gave him a keen appreciation for open source code. Though he’d been using a MacBook when he’d left Apple, he recalled, “I remember getting really frustrated when I couldn’t bring up the source code for stuff anymore … and now I knew how everybody else felt.”
Kling’s thought process went something like this: to view the code of the software you’re using, you shouldn’t have to work at Apple.
“I reasoned that if you just start building these components one by one, eventually you’ll have the full stack and it will just gel together,” he told the podcast’s audience. “So that’s what I started doing.”
Kling’s Patreon page elaborates on his plans: “I’m building an operating system from scratch, based on how computers used to feel to me as a kid.” (He adds that he grew up using Visual Basic on Windows 3.11 before discovering the joy of Unix with Slackware.)
But his project also had another motivation that was much more personal.
A Leftover Dream
“I started building SerenityOS to keep myself busy after finishing a three-month drug addiction rehab program in 2018,” explains the FAQ on Kling’s GitHub profile. There’s a pattern he’s recognized since he was a teenager. “If there was nothing to keep my attention, I would just end up drinking or end up doing drugs,” Kling told Bell.
Going into big tech brought bigger paychecks, Kling acknowledged, “and if you have more money, you can buy bigger and more dangerous drugs.” But after leaving rehab, he’d confronted the same problem. “I really struggled with just coming up with stuff to do,” he told podcast listeners.
Yet with no distractions and a clear head, “I felt like I was on the precipice of some serious productivity,” Kling recalled on the podcast. “If I just had something to sink it into.”
So for six months, he lived in a cheap rented cabin, just to pursue a dream he’d had since his preteen years of writing his own operating system from scratch. “You can even find old Usenet posts from me as a child asking for help writing like, a boot loader,” he said.
Kling directed his energies into this ambitious new OS-building project to get back to the person he’d been before — and to what he’d cared about then. On the podcast, he calls it therapeutic, an interesting effort that filled the days in a healthy way.
“I chose the name SerenityOS because I wanted to always remember the Serenity Prayer,” Kling explained in a blog post last spring. “I was quite worried about my future at the time, and I figured that this name would help me stay on the good path.”
Kling elaborated on that decision in his podcast interview. “The way I was thinking at the time was I need to make something that is so big and beautiful, that I will want to stick around.”
And the project’s contributors feel the same way: “They just want to make something for themselves, something beautiful. And I think that gives us almost kind of a purity of purpose that I enjoy.”
Kling’s blog describes the growing community as “vibrant,” adding, “To say that this has been an amazing journey would be an understatement, yet in many ways, we are still only getting started.”
PSA: Everyone is welcome to work on SerenityOS. You don’t need to ask my permission!
It’s an open source project with 600+ contributors already, and we’re always open for more.
As we say in Sweden: if there’s room in the heart, there’s room for your butt! 🤓🇸🇪🐞
— Andreas Kling (@awesomekling) February 7, 2022
Kling says the project now has more than 600 contributors. This month, he announced another milestone: the OS’s Discord server now has 5,000 members.
Bell ended the interview by asking if Kling found his way back to the energy he’d enjoyed that preceded his addiction. The programmer answered, “I’ve never felt more true to myself than I do lately.”
Kling shares some of his programming sessions on YouTube. “I was very uncomfortable with this at first,” he recalled last year in a blog post. “But I kept at it since I liked the feeling of just being myself and letting people see me, instead of putting on a mask and pretending everything was fine.”
Earlier this month a commenter on Reddit asked whether the project was sustainable: “What happens when he gets a girlfriend and it turns out she would like a man with a reliable income?”
Kling responded that he doesn’t have a specific long-term plan — and said he’d even turned down corporate sponsors “because I don’t want to promote anything I don’t personally use … But even if everyone leaves, I’ll still be here hacking away.”
Besides, he added, “I’ve been married for almost 10 years and my wife is my biggest supporter! She even pushed me to quit my last job so that I could focus on SerenityOS full time.”
Kling’s Patreon account also shows 282 sponsors donating $1,399 a month. There’s another $600 more a month through GitHub Sponsors (and PayPal) — plus about $150 a month from YouTube and another $100 a month from Serenity-themed merchandise, Kling reported last May.
That blog post also announced he was quitting his job to work full-time on SerenityOS. “This isn’t yet enough to fully sustain me and my family, but it’s close enough that I decided it’s time to take a chance and see what happens!” he wrote.
Yet there’s also a larger impact. In a video on his YouTube channel in January, Kling recalled how telling his story on YouTube prompted others to reach out and share their own stories and struggles, which he appreciates because sharing is a key part of the recovery process.
The video ends with a reminder to anyone struggling with similar issues that “you should know that there are millions of people all over the world who have been where you are. And they would probably want to help you if you decide that you don’t want to live like that anymore.”
And Kling adds that they know how to do it, “because somebody showed them how to do it.”
Bell posted on Hacker News this month his appreciation for Kling’s candor: “Big props to Andreas for speaking so candidly about the back story of Serenity. I feel like there are certain things we don’t talk about in tech and that can change.” (To which Kling responded, “I’m definitely a fan of talking more about things that we’ve been hiding from each other.”)
Bell added, “I love the idea that programming, especially side projects, can be a therapeutic thing.”
- GitHub’s Education Stream Team launches New Beginnings, the second season of its Campus TV series.
- Are there clues to technology trends in the content accessed through O’Reilly’s Learning Platform?
- XKCD author announces a new book exploring more absurd hypothetical questions.