Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Text broadcast of CppCast 278: Serenity…

Text broadcast of CppCast 278: SerenityOS

May 27 2021
Author:

Episode 278 of CppCast is an inspiring story how guest Andreas Kling overcame his drug addiction by creating and developing a new open-source operating system in C++. He named it after the Serenity Prayer he learned in rehab – SerenityOS. In this episode, hosts Rob Irving and Jason Turner interview Andreas Kling about his operating system and also discuss QT6 and new C++ podcasts.

0828_cppcast-278/image1.png

Visual Assist

Episode 278 of CppCast was recorded on December 17th, 2020 and was sponsored by Visual Assist. It is the well-known productivity extension for Visual Studio. Visual Assist speeds up development with features like smart navigation, code inspection, and suggestions, powerful refactoring commands, and a whole lot more - even spell checking in comments. Start your free trial at wholetomato.com.

0828_cppcast-278/image2.png

Visual Assist is used by serious C++ developers across the world. It's got great cogeneration. Do you need to implement methods from an interface? What about changing a pointer to a smart pointer? Even an Unreal Engine smart pointer. Adding a symbol you've typed, but haven't declared?

Visual Assist will do these and much more. Plus refactorings - more powerful than the ones included in Visual C++. Or detecting errors in code and suggesting useful corrections. Or navigation - helping you move anywhere in your code and open or locate what you need. Or even the debug extensions.

Visual Assist is written by C++ developers for C++ developers. Includes everything you need and nothing you don't. It has a low UI philosophy. It won't take over your IDE, but will show up and useful. It's there to help. Not to advertise itself. Visual Assist is relied on by the developers building software you've used, whether that's office suites, operating systems or games. Software you use was built with Visual Assist.

Get the same tooling for your own development. Visual Assist supports Unreal Engine 4 and many versions of Visual Studio, including VS 2019 and Community. Get it at wholetomato.com.

CppCast on YouTube

Rob: At the top of every episode we highlight a piece of feedback. This week we got a tweet from Olafur Waage. He wrote, "Wait, wait, wait, video on YouTube? When did that start? I've just been doing the audio from the website."

Olafur probably missed this, but we have been recording video in addition to the audio for, like, the past year and a half.

0828_cppcast-278/image3.png

Jason: Yeah, something like that. That was the specific request from a listener who said that they can comprehend better if they can actually see people talking.

Rob: Well, we'd love to hear your thoughts about the show. You can always reach out to us on Twitter, or email us at feedback@cppcast.com.

And don't forget to leave us a review on iTunes or subscribe on YouTube.

Andreas Kling: background

Rob: Joining us today is Andreas Kling. Andreas has been writing open-source C++ for the last 15 years, working on projects like KDE, Qt, and WebKit. Nowadays, he puts all of his free time into SerenityOS, a new Unix-like operating system with the look and feel of a nineties office computer.

0828_cppcast-278/image4.png

Everything from kernel to web browser is done in C++, and he frequently posts videos of his programming sessions to YouTube and wants to share the joy of programming with the world. Andreas, welcome to the show.

Andreas Kling: Thank you. Good to be here.

Jason: That's an interesting background, KDE, QT, and WebKit. Were those all just hobby projects or was any of that paid work?

Andreas Kling: KDE was a hobby project and then I got picked up by Nokia, so I spent two years there working on Qt. Then I went to Apple and did WebKit for six years. Since then I've left the big tech industry. Nowadays I'm in the small tech industry in Sweden.

Rob: All right, Andreas, we'll start talking about SerenityOS in just a minute, but first we got some news to discuss. So feel free to comment on any of these.

News

New podcasts

Jason: Looks like we are seeing more and more C++ podcasts!

Rob: Yeah. We've recently had Conor on the show, and him and Bryce are starting a podcast (ADSP: The Podcast on Twitter), JF Bastien and Chris Leary have a podcast (TLB hit on Twitter), and, of course, there's cpp.chat. It's great to have more podcast content out there. I wonder if it's partially because of the pandemic that all these new podcasts are springing up.

Jason: I was going to say, there's this kind of level of irony happening here, right?

We've had so many people tell us that they don't have a commute anymore, so they don't have time to listen to CppCast. But since they're all home, I guess they have time to create their own podcast.

0828_cppcast-278/image5.png

Rob: There is one more new podcast out. And this is from Phil Nash and Anastasia from JetBrains. And their first zero is out now. It's called "No Diagnostic Required". So this means, Phil is doing two different podcasts now, because Phil does cpp.chat with John Kalb still, right?

Jason: Yes. I wonder how consistently Phil and Anastasia are going to release these.

Qt6 release

Rob: So this new article announces that Qt 6.0 has been released. This blog post goes over some of the big changes between Qt 5 and Qt 6.

0828_cppcast-278/image6.png

Jason: I believe the new version also brings the new license that has some people concerned.

Rob: It looks like they changed how they do graphics in Qt 6. Qt 5, I believe, was all OpenGL, and now they're trying to use Meadow, and Vulcan and Direct3D. So I'd imagine you could get much more performance graphics out of Qt 6.

Andreas Kling: Yeah, that's supposed to be one of the selling points of Qt 6, is that they've sort of unified their rendering abstractions to take better advantage of platform APIs.

So now it should be on top of Meadow, Vulcan and all those things. And it's also updated for C++17.

C++20

Rob: So C++20 has officially been published and you can now buy or download the full PDF of the C++20 document. You can probably find a working draft, if you don't want to spend 200 bucks to buy the PDF. Are you going to buy a copy, Jason?

0828_cppcast-278/image7.png

Jason: No. No. I already have of the working draft on my desktop here. What about you Andreas?

Andreas Kling: I'm just going to wait and see what comes out in compilers. I prefer to learn by testing stuff out myself.

Rob: What version of C++ is Serenity written in?

Andreas Kling: It's written in C++20, although I haven't looked too much into what's available. And we are using GCC 10.2, because we do not have dependencies, and nobody depends on us.

We've been using concepts and templative Lambdas. Concepts are very helpful, but they caused problems for people who build on Mac with Clang. I hope Clang will catch up release wise soon.

Jason: Is there any part of SerenityOS that you cannot write in C++?

Andreas Kling: Sure. Yeah, really low level CPU-specific stuff. But it's not too much. Right now we're suffering from the same problem that early Linux had. We targeted x86 processors. Now we want to expand to other architectures, so we have to start abstracting things.

Poncho: how to make an OS

Rob: The next thing we have is a YouTube series by Poncho on how to make an operating system in C++. Andreas, I thought you'd be interested in this one. It looks like you're not the only one working on a C++ operating system.

Andreas Kling: No, indeed. I watched the first video and it looked like a nice tutorial to get started with something like that. I tend to focus more on what comes long after the introductory stuff myself. So there's not too much overlap with what I do. But it is nice to see that people are starting to realize they can build operating systems with C++. For the longest time there's been this meme, that if you're going to do a kernel, you're going to do it in C. It's nice to see people use other languages.

Jason: For our listeners, it appears that the author has given you something of a template to get started with EFI boot code and that kind of thing.

If you are curious, you might check out those templates at the very least.

SerenityOS

Backstory

Rob: So, Andreas, as we mentioned in your bio, you work on SerenityOS. Could you start off by telling us a little bit more about what it is?

0828_cppcast-278/image8.png

Andreas Kling: Sure. SerenityOS is a new desktop operating system that I started writing in modern C++. I started the project in 2018 after completing a three-month-long drug rehab. When I came out of there, I didn't really know what to do with myself and all of my free time.

And I had always kind of wondered what it might be like to build an operating system. So, I just started poking around with some bits and pieces. And it wasn't really an operating system at first. It was an ELF executable loader, and an EXT2 file system parser, and a little GUI library.

At some point I realized that, if I just put a kernel underneath this, it will be like an operating system.

Jason: Just slap a kernel underneath it. It's easy, right?

Andreas Kling: Yeah, exactly. That's how the Serenity operating system was born. I named it after the Serenity Prayer, which I had learned at rehab, [because] I wanted a name that would always remind me to stay on that healthy path.

I didn't know what to expect, so I figured I would just try a bunch of things and see what would stick.

And it turns out that it sticks pretty well. If you just put your heart and soul into something.

Back then I was always worried about relapsing into bad behaviors. So I wanted to build accountability mechanisms for myself. That's why I named the system that way. And it also led me to start uploading videos to YouTube of myself programming and just kind of stream of consciousness talking while doing it.

I figured that I had been hiding my whole life and I thought that if I just put myself out there and show my face on the internet, then maybe that will help me not hide so much anymore. And it worked out pretty well. Over time, people started finding the system and finding my YouTube channel and somebody posted it to Hacker News.

And then there were all these people coming in and it was pretty overwhelming. My inbox was a disaster and I still have mail from them that didn't answer. The response to the system has been really great, because, I guess, it has this kind of scrappy can-do attitude that I wanted to build everything myself and not taking any outside dependencies.

The system is completely standalone other than the compiler.

Jason: I was going to say, the compiler? Okay.

Andreas Kling: Not yet. For the first six months or so, it was just me working on the system, but then people started finding it. They saw something they liked about it and they wanted to participate.

So people started sending in patches. And I think we've now had about 225 individual contributors or something like that. And with about 15 or 16 of them with more than a hundred commits. So today it's a fairly active project and it's going really well.

Jason: I find these kinds of, you know, overnight success stories interesting where it usually there's at least six months to five years of hard work and then someone finds out about it. And then it's an overnight success basically.

Andreas Kling: Yeah. I think that's usually how it goes. There was a lot of unglamorous nights in front of the computer, obviously.

But I think something that spoke to people immediately was that I had a video presentation I had made just a couple of days prior to it showing up on Hacker News. So it was very easy to link that and everybody could see the system running. And I guess it was a bit further ahead than you would normally see hobby operating systems.

0828_cppcast-278/image9.png

So it captured people's imagination a little bit. I also think that almost all of us have some sort of love for that late nineties graphical aesthetic cause we all used Windows at one point or another in those days and it has a special place in our hearts. I think that spoke to people a lot.

Jason: And do you do your YouTube videos live stream? Or do you do them prerecorded?

Andreas Kling: They're prerecorded, but I don't edit them.

Jason: The backstory that you shared is, is fascinating to me. It sounds like it has worked. The operating system has been a distraction of sorts or a way for you to put your, your time and energy for you for the last couple of years.

Andreas Kling: Absolutely! It's, it's been really good. I didn't know what to expect, so I figured I would just try a bunch of things and see what would stick.

And it turns out that it sticks pretty well. If you just put your heart and soul into something.

Current state

Rob: So you've been working on the project for about two years now. And you said it's come along a long way. What's its current state and what's on the horizon?

Andreas Kling: Right now it's a multitasking Unix-like operating system.

It boots into a GUI very similar looking to Windows 2000 or macOS 9. It has many desktop applications: file management, image viewing, and a web browser, which is the, the biggest individual application we're working on.

The work is very spread-out - each piece is moving forward a little bit at a time.

It's gotten a lot more stable in the last couple of weeks, because some new people came in and started working on the kernel - synchronization, primitives and generally improving the kernel. A lot of it, I've slapped together trying to get to the next thing.

Jason: I feel like that's the kind of thing, if you're not an expert in it, getting it right is very difficult.

Andreas Kling: Yeah. But it turns out that you can usually get something working pretty well. And then if you're just enthusiastic enough, then eventually you'll attract someone else and they'll come in and do it properly.

I like to keep this philosophy that as long as people are doing the thing that they're specifically interested in, then that's when we get the best software.

Right now we're about maybe 20 - 25 people actively working on it. Everybody has found their own little niche that they are particularly excited about in the system.

We have somebody who's building a shell for it, and we have somebody else working on the kernel. Somebody's really excited about JavaScript spec compliance. And I like to keep this philosophy that as long as people are doing the thing that they're specifically interested in, then that's when we get the best software.

Jason: I didn't realize until we were preparing for this episode that you were working on SerenityOS. I actually have a friend who has been contributing for the last few weeks. He's been working with constexpr.

Andreas Kling: Ah, that would be Lenny. It's one of those things that's clearly helpful and beneficial, but you need that person to come in and be super excited about it, to just go and do it everywhere. And then it's, it's really awesome when that person shows up.

Jason: Well, he said that it's been a very fun experience because like you were saying, as long as the code is clean or whatever, and had provided some benefit you, you accept it. That seemed to be his impression.

Andreas Kling: Yeah, exactly. I don't see any reason to not let people roam free, especially when we don't have any dependencies and we control everything and do not have specific releases.

Features

Jason: So, your JavaScript engine, your lib PNG, or JPEG parser - you're saying all of that is from scratch?

Andreas Kling: That's right. All of it. I started most of the libraries and stuff, but not all of them. By now a lot of other people have started new libraries.

It turns out that you can usually get something working pretty well. And then if you're just enthusiastic enough, then eventually you'll attract someone else and they'll come in and do it properly.

Rob: What hardware are you able to run Serenity on?

Andreas Kling: The short answer is, I don't really know, because I haven't tried that much hardware. We tend to do most of the development on emulators just because it's so convenient.

So the hardware we support really well is whatever QEMU, VirtualBox and MWare emulate.

However, a bunch of people are enthusiastic about this and they have gotten the system running on their random PC boxes that they cobbled together.

And just a couple of days ago someone in the community started working on a hardware compatibility list for the system where he's just adding the individual pieces of hardware that he caught it to boot on. It's a very short list so far, but we're looking forward to expanding on it.

SerenityOS is very, very lacking in terms of hardware drivers. Like it's not an area that we have put much effort into it all. Almost all the effort has been on building out, like userland and just the core of the kernel.

But something that I find very interesting is that while all of the code is original and new, we're using tried and true and proven abstractions: a POSIX-like kernel, an event-loop driven GUI.

Jason: So you've got a file system. You said it's as EXT2?

Andreas Kling: Yeah, that's right.

Jason: Okay. And you said someone's working on a shell. So is there a working shell at the moment?

Andreas Kling: Yeah. We have a working shell and working terminal emulator and everything. We even have a Telnet server.

If you stay on your Telnet session for too long, it might get a little flaky. We're kind of shaking out the problems. And something that has been really cool recently is we started fuzzing a lot of the system. We use our custom fuzzers and Google's OSS-Fuzz.

Jason: Can the operating system host the compiler? If I'm working on the web browser, do I compile it inside Serenity or outside of Serenity?

Andreas Kling: Outside, but we do have a working port, GCC, the bin utils, and everything. So you can compile inside the system if you want to.

Jason: So you haven't ported CLion or whatever?

Andreas Kling: No, I'm building my own IDE. It's called Hack Studio. Until we have a C++ parser, compiling inside SerenityOS is not too convenient. For long running development tasks, I tend to be outside. A couple of weeks ago I did a breakout game in Hack Studio from scratch and I worked in the system the whole time.

0828_cppcast-278/image10.png

Rob: So you talked a little bit about fuzz testing. Do you do any other testing on Serenity?

Andreas Kling: We have a bunch of unit tests that we run. We're using GitHub Actions for our continuous integration. Unfortunately, we're still not booting the system to run the tests, but compiling all of the unit tests for Linux and then running them there.

We have been putting some effort towards making the kernel testable as well. And it's like, we have all of the pieces, but we need somebody to hunker down and actually put them together and make it, make the tests run.

We have all these different tests, so I'm kind of waiting for somebody to pick that up and put them all together.

Jason: So is that the philosophy then that you maintain for yourself when you record your videos?

Andreas Kling: Yeah, absolutely. Because I, I would rather make a video of myself building some insignificant, GUI detail and being really enthusiastic about it than to try to force myself to do something really interesting or advanced.

Something that is important to me is to keep a high quality of graphical interface. That's always something I've felt is lacking in the Linux world that GUI is fragmented and hobbled together from parts that use different frameworks.

Jason: Do you have a Doom port yet?

Andreas Kling: Definitely, although we don't have sound for Doom. We have Quake too.

Jason: Is that because you don't have sound or because the Doom port doesn't have sound?

Andreas Kling: The Doom port that I ported, didn't have sound support.

And I didn't look super closely at how to do that. And then we got Quake running, so that has sound, and then I kind of forgot about Doom.

Sound is one of those things that, I didn't know anything about sound before starting on Serenity. I had to learn a lot just to get that running at all. I am definitely learning so much on this project.

Like, I don't want to give anyone the impression that I know how to do all these things. Cause I don't. I'm just so used to being in over my head at this point that it feels it's normal.

To people who are interested in contributing, I always tell to just build the system and try it out and then see if you find something broken or something that annoys you and then just try to fix it.

First, you sketch out a crappy version of something and make it work and then start iterating on it. Most of the system has been built in that way - just doing it in some crappy way that works and then figuring out what's the nice way of doing this.

Jason: What's the name of your YouTube channel by the way?

Andreas Kling: My YouTube channel is youtube.com/andreaskling.

JavaScript and browser

Jason: So. I want to come back to the browser, because, it's easy for me to believe that a web browser is actually more complicated than your operating system.

Andreas Kling: Serenity's browser is pretty far behind in terms of modern CSS features, but it has bits and pieces from modern specs at the same time. It has a decently competent HTML and CSS engine.

It can do basic pages, but it has very, very noticeable layout flaws. And the JavaScript engine is very slow.

JavaScript is probably the best-tested feature we have because something that happened was, I started building the browser without a JavaScript engine. And people kept asking me, are you going to add a JavaScript support to this browser?

But at some point I realized, okay, maybe it's hard to build a JavaScript engine, but I should probably try because how hard can it really be, right? So I just made a video of me starting to sketch that out. So I just hand wrote an AST in a video, and then made an interpreter walk the AST and run the code.

And something happened to some of my viewers that were JavaScript developers, that they became super excited and wanted to participate in that.

Jason: Wow.

Andreas Kling: It's been really awesome to see people come out of their shell as developers and sort of expand what they thought they could do. And they also brought a lot of nice JS experience and they've built a really nice unit testing framework for us.

And then they keep adding these really nice tests when they make engine changes. And they put me to shame, because I write these simple little unit tests, to test, like the one thing I'm changing and they're coming around with these hundred-line tests. That's very good.

How to contribute

Rob: What is it like to get started if you're interested in contributing to SerenityOS?

Andreas Kling: To people who are interested in contributing, I always tell to just build the system and try it out and then see if you find something broken or something that annoys you and then just try to fix it.

I think one thing I would like to do is to expand people's idea of what an operating system is. Many people think an operating system is a kernel. I think there's so much more to it than that: the kernel, the shell, the userland utilities and all the GUI and everything there, like the JavaScript engine and the web browser and the PNG, JPEG decoders.

I love seeing somebody coming in, working on their little specific thing. And then they just branch out suddenly and jump from JavaScript to kernel. The project allows them to push far outside their comfort zone.

So yeah, if you wanted to work on it, you could do literally anything.

SerenityOS is really open. And just because I can't think of something that's missing doesn't mean that you can't.

Jason: I'm hoping some of our listeners have said, "Oh wow, I've always wanted to... do.. you know, whatever." Is there anything SerenityOS does not have at all yet?

Andreas Kling: Yeah, many things. It doesn't have a PNG writer, a C++ parser for our IDE, OpenGL or 3D capabilities. It has no PDF support and no MP3 decoder. It also doesn't have stuff like 64-bit support in the Kernel. So we run the CPU in 32- bit mode at the moment.

SerenityOS is really open. And just because I can't think of something that's missing doesn't mean that you can't.

Jason: Right. Maybe that gave some listeners some ideas.

Conclusion

Rob: Well, Andreas, it's been really great having you on the show today. SerenityOS sounds like a really fun project. And, and thank you for opening up about what brought you to start work on this project. It's a great story.

Andreas Kling: Yeah. Happy to share.

Rob: And where can people find you online?

Andreas Kling: I'm on Twitter as awesomekling. And you can find the operating system on serenityos.org.

Rob: Thanks so much for listening in, as we chat about C++.

We'd love to hear what you think of the podcast. Please let us know if we're discussing the stuff you're interested in, or if you have a suggestion for a topic, we'd love to hear about that too. You can email all your thoughts to feedback@cppcast.com. We'd also appreciate it if you can like and follow CppCast on Twitter, you can also follow me at @robwirving and Jason at @lefticus on Twitter.

We'd also like to thank all our patrons who help support the show through Patreon. If you'd like to support us on Patreon and you can do so at https://www.patreon.com/CppCast. And of course you can find all that info and the show notes on the podcast website at cppcast.com. Theme music for this episode was provided by podcastthemes.com.

Resources

Podcast

News

Links

Sponsors

Guest



Comments (0)

Next comments next comments
close comment form