What does HackerNews think of serenity?

The Serenity Operating System 🐞

Language: C++

#2 in C++
#1 in Android
#1 in Mobile
Also worth mentioning SerenityOS https://github.com/SerenityOS/serenity. It’s a very friendly environment and easy to get involved.
"What if we replace POSIX" is an interesting question. I keep coming back to SerenityOS [0] when I think about this topic, a C++ based (hobby) OS that has a POSIX compatible API but also more modern wrappers around common functionality.

Exposing system APIs like ErrorOr (like the Rust Result or the Maybe monad) resolves an entire class of bugs (take fork/kill/-1 as an example [1]) as well as ambiguity like "do I check the return value for the reason, or do I check the magical errno variable?". Dropping general OS compatibility also allows for other changes, like object oriented interaction with the GUI system and other system libraries instead of relying on having the namespacing happen in the name of a function call.

I know SerenityOS won't ever replace any operating system we use today, but it's a nice demonstration of the API features we could all be using.

Sometimes I wish Windows' APIs were more POSIX-like, but Win32 has some pretty useful functions built right into the OS that you'd need to introduce DLL/dependency hell/static compilation for if you're trying to stick to POSIX only APIs. Think common concepts like "the clipboard" or "the current resolution of a display" without needing to link to a library or access a file like /dev/fb0 (is there a /dev/fb1? when do you use it?).

Mobile platforms (Android, iOS) with special lifecycles also allow for things like "the app resumes where you left off" and "the app suspends to disk when the system is under load" natively without requiring developers to build their own save/restore state mechanisms. Imagine having to build a system like that on your average Linux desktop with mere POSIX APIs, you'd go crazy with the complexity required.

Perhaps what programs runnong on Unix-based operating systems really need is a wrapper around POSIX and its low-level implications. GTK and Qt provide many such APIs for free, for example, including stuff like networking and other I/O. GTK comes with its annoying particularities (CSD, and all the other GNOME decisions) and Qt licenses are either VERY free or VERY expensive, making them incompatible with other projects.

With the Linux space transitioning from SystemV+ALSA/Pulse+X11 to systemd+PipeWire+Wayland, perhaps the space is ripe for a new, more modern wrapper library for native languages.

[0]: https://github.com/SerenityOS/serenity

[1]: When fork() fails, the call returns a negative number. When you try to kill() a PID of -1, you kill every process your current UID has the permission to kill. Programs failing to fork, shutting down, and killing what they thought was a fork()ed process can accidentally end up killing all the open applications for a user.

I don't think it's C++'s fault necessarily. The C/C++ ecosystem seems to attract more of a certain type of developer who will tell you to just "get good" at the language so you van decipher their code and use it without a billion memory bugs, but the language doesn't specify any of it.

It's easy to point out an example of unreadable code in any language because every language has their weird programmers. If you stick to modern tools with strict linting and good design, you can write perfectly readable C++ code.

I don't use C++ often, but I find the code over at https://github.com/SerenityOS/serenity to be more legible than many large code bases in other languages.

I support those, and I believe they deserve more:

- SerenityOS [0], they do get some donations, but nothing close to the Linux Foundation, Wikipedia, or Mozilla.

- MikroORM [1] if you'd like to support an ORM for TypeScript in the backend, again some donations, but nothing close to SerenityOS!

[0]: https://github.com/SerenityOS/serenity

[1]: https://github.com/mikro-orm/mikro-orm

Ladybird is the browser being developed for SerenityOS, the "love letter to '90s user interfaces with a custom Unix-like core"[0]

[0] - https://github.com/SerenityOS/serenity

> I want to build a web browser.

Mild nitpick but "web browser" and "rendering engine" and "JavaScript" are different.

Anybody can take WebKit and do some cool stuff on top in the UI and call it a "web browser".

At the end of the day, without patching to the HTML/CSS rendering engine, it's going to perform like every other WebKit based browser, right?

https://en.wikipedia.org/wiki/Comparison_of_browser_engines

I know Chromium uses Blink and not WebKit now.

Looks like Ladybird is based on https://en.wikipedia.org/wiki/SerenityOS "LibWeb"

That's all just rendering. You need to hook a JavaScript engine up to the rendering engine as well (with glue to the DOM from what I know?)

Chromium is Blink + V8, right?

Does Ladybird SerenityOS Libweb also do JavaScript?

> Browser with JavaScript, WebAssembly, and more (check the spec compliance for JS, CSS, and WASM)

It does. https://github.com/SerenityOS/serenity https://github.com/SerenityOS/serenity/tree/master/Userland/...

My favourite is SerenityOS: https://github.com/SerenityOS/serenity

Not only is the code itself structured much more pleasantly than I ever suspected possible in C++, huge parts of it were also recorded while they were being written (see https://www.youtube.com/c/AndreasKling) so you can see and hear the process that led to the final product.

Some of the code is quite gnarly, which is to be expected from a repo containing an entire operating system, containing everything from the kernel to a bespoke web browser.

However, as SerenityOS isn't trying to be a UNIX clone, its C++ oriented APIs are a nice breath of fresh air compared to the barebones C that Linux and friends use.

Acorn to Arabella https://youtube.com/c/AcornToArabella: They're building a 38' sailboat from stump to ship, then taking it around the world. Already 223 episodes in and very educational.

Michael Penn https://youtube.com/c/MichaelPennMath: Covering calculus, number theory and more. Classic black board lectures, highly enjoyable.

Andreas Kling https://youtube.com/c/AndreasKling: Livestreaming development on SerenityOS (https://github.com/SerenityOS/serenity)

Ooh, ooh.

I'm on Ubuntu, and it looks like I need to upgrade to 22.04 before I can experience the build process for myself.

https://packages.ubuntu.com/search?suite=all&arch=any&search...

The repo itself is shockingly tiny: https://github.com/awesomekling/ladybird. Looks like it needs https://github.com/SerenityOS/serenity as well. https://github.com/SerenityOS/serenity/tree/master/Userland/... is 100kLoC which is also surprisingly small.

SerenityOS, especially the userland, has always seemed very elegant to me:

https://github.com/SerenityOS/serenity

It's not a tutorial series, but you may get something out of browsing the source for https://github.com/SerenityOS/serenity in the meantime. I'm also curious if there are any recent/relevant C++ OS development guides.
> The HTML and JS specs are absurdly complex to the point where there's basically no hope of anyone implementing them from 0

That's actually being done in the Serenity OS project! HTML renderer, JS interpreter, and Web Browser, from scratch:

https://github.com/SerenityOS/serenity

https://www.youtube.com/playlist?list=PLMOpZvQB55beChggmvk-s...

https://www.youtube.com/playlist?list=PLMOpZvQB55be0Nfytz9q2...

Glad you enjoyed the video!

Just to be clear, while I started the project, it's since been hacked on by hundreds of people (we're well over 500 contributors on GitHub) and it's by no means a solo project anymore! https://github.com/SerenityOS/serenity

yep, for instance a good benchmark would be: how long would it take to build a decent and snappy GUI operating system from scratch with a custom html/css/js engine in $LANGUAGE ?

To give a data point, in 2021-era C++ it's approximately 3 years with a very large part of it being done by a single person (https://github.com/SerenityOS/serenity). How long would that take with python ?

I love hobbiest operating systems! In a world of billions of software projects, it's sad only a small handful are OSes. I really love to watch what the Serenity[0] project is working on and I've been working to get it running on an older computer. However parts are harder to find & the spec requirements are very specific (drivers are hard).

I love the idea of doing more operating system experiments on RPIs just because of the availability & consistency of the platform. You don't have to worry about thousands of drivers for the most part, plus if you're using the RPI 400[1], basically everything is included in the keyboard!

Rust seems like a good way to get people involved as well, because of it's innate following. Excited to give this tutorial a try.

[0] https://github.com/SerenityOS/serenity [1] https://www.raspberrypi.org/products/raspberry-pi-400/

> SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.

For a project that seems to be focused around something visual, it's strange to me that there's not even one screenshot on the home page.

The github page [1] does at least have one.

1. https://github.com/SerenityOS/serenity

edit: the screenshot is now on the home page! That was such a fast turn around.

https://github.com/SerenityOS/serenity folks are building a C++ based OS and they have discord access
>SerenityOS [1]

Graphical Unix-like operating system for x86 computers.

SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.

Roughly speaking, the goal is a marriage between the aesthetic of late-1990s productivity software and the power-user accessibility of late-2000s *nix. This is a system by us, for us, based on the things we like.

[1] https://github.com/SerenityOS/serenity

https://github.com/SerenityOS/serenity 32bit OS being built in modern C++ by a friendly creator and community who regularly streams on Youtube
Surprised that nobody mentioned Serenity yet...

> SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.

> Roughly speaking, the goal is a marriage between the aesthetic of late-1990s productivity software and the power-user accessibility of late-2000s *nix. This is a system by us, for us, based on the things we like.

https://github.com/SerenityOS/serenity

You might like SerenityOS. It's a hobbyist OS with a similar aesthetic and the authors seem to have a lot of fun making it.

https://github.com/SerenityOS/serenity

> First it was C++ (we know how well it did...)

it did well enough that C stdlibs (at least MSVC's, LLVM's) and compilers (... pretty much all the big ones) are implemented in C++ and just export C symbols nowadays, likewise for newer OSes like Fuschia.

SerenityOS (https://github.com/SerenityOS/serenity) was written from scratch in two years in C++ and goes as far as having a custom web browser & JS engine. Where is the equivalent in C ? Where are the C web browsers, C office suites, C Godot/Unity/Unreal-like game engines ? Why is Arduino being programmed in C++ and not C ?

I know ReactOS has a different purpose and they aim to do a clone of Win32 API and kernel but if you feel nostalgic about Windows look and feel and wonder how a UNIX-kernel windows could be there's serenityos[0]

[0]https://github.com/SerenityOS/serenity

Hello friends! It's always nice to see SerenityOS posted. :)

(Note: The serenityos.org website is pretty barebones, there's a lot more information over in the GitHub repo.[1])

I'm the principal author of the system, although it has grown quite a lot since it was first seen on HN back in March of 2019.[2]

The system now has its own HTTPS-capable web browser, JavaScript engine, and many other applications under development. Over 180 people have contributed changes and we there's active daily development.

My most recent project has been adding a userspace x86 emulator [3] to the system that provides the same kind of features as the famous Valgrind.

Happy to answer any questions about the system if anyone has them. Either way, thanks for checking out the system!

[1] https://github.com/SerenityOS/serenity

[2] https://news.ycombinator.com/item?id=19537807

[3] https://twitter.com/awesomekling/status/1285685093961469955

It's not a tutorial channel, but I'd recommend Andreas Kling [1] where he works on Serenity OS [2]. I've learned a lot by watching him solve problems and debug code.

[1] https://youtube.com/c/AndreasKling/ [2] https://github.com/SerenityOS/serenity

> The existence and success of Linux alone seems to contradict your opinion,

you cannot make useful comparisons with "Linux alone".

See for instance SerenityOS (https://github.com/SerenityOS/serenity) : in one year and a few months it went from zero to full-blown C++ OS with graphical shell, userspace, and a dozen apps (https://github.com/SerenityOS/serenity/tree/master/Applicati...)... in 140kloc.

Of course we'll never know how Linux would have turned out if it had started today with modern C and modern computing power, but it does not seem out of this world that C++ is a more productive language than C by a non-negligible amount.