DEV Community

sheosi
sheosi

Posted on

A delightful OS - The kernel

Hi, my name is Sergio, and...

I have a dream, I'm here to tell, about a fantastic new OS...

So yup, I'm one of those that will perfectly spend hours on end to make something just so that it is ✨perfect©️✨. And yeah, this has been for years on my head, so it is almost time to at least write somewhere.

So what do we want to build? An OS, for desktop usage, like the one you are using, which is probably either Linux or Android (let's be honest you are reading a guy's rambling about which pieces would make for a better OS, chances are you are a nerd too). Now, how is this OS? as I like to put it delightful💫, an OS that's snappy, secure, private ... Wait maybe it is better if we define what it is:

  • Performant: The OS must feel snappy, fast as it can be, extracting the juice from your computer, whether it's old with cobwebs or shiny new.
  • Easy to use: It is a desktop, and we've had enough of OS for the savy, if we want people to move here it's gotta be easy (besides, there's a point that even I find it tiring to seSo arch the internet the commands needed for something).
  • Solid as metal (the material not the API): It's not funny when your computer won't boot up because itself thought a good idea to update, or because in the middle of the update stupid electrity went off.
  • Secure and private: My computer, my data, thank you.

Most probably I'll be updating those.

So yup, we know what we want, in a nutshell pretty much what every single of the dozens of user-friendly Linux distributions out there want.

So how are we going to build it?

One option could be to make everything from scratch, but since that effort takes several years of hundreds of engineers to achieve such state and my possible group of engineers ammounts to ... let me count ... one, taking as much done as possible seems like a great idea.

Let's look at the contenders

macOS and Windows

I know, I know, already there, and might not be an option, but they exist, and might be the solution for a lot people, which is fine. I feel like they have their own set of problems, namely tied to a company trying to sell you as much as they can, macOS which was regarded as a holy grail for privacy and non-intrusiveness definetely integrates a lot their own services, and Microsoft ... is trying to put ads everywhere on their OS, plus the whole Recall fiasco ... etc ...

No use then, but let's not forget that macOS puts out an open source of their kernel called Darwin, which could be useful if we didn't had ...

Linux

You knew this was going to happen, Linux is the platform of freedom by default. Most people that are running from macOS and Windows will go into Linux (into one of the thousands available).

You can argue that its bazaar model (in which everyone develops the **ck they want and someone integrates it, which are known as distribution) is broken, that the whole DKMS (third party kernel modules) as a bit of a mess, that Wayland is slow to being develop ...

But it has a lot of good, out of the open source kernels it is the one with the best driver support, it is being tackled by tons of developers (improving it making it better), heck it even has the wonderful, incredible and blazingly fast Rust language in it. There's a lot of interesting things going on there, and it's improving at a nice pace.

FreeBSD and **BSD in general

As I said I don't like leaving stones unturned. So, I'm not just considering Linux but literally everything out there, so what about the BSDs?

The BSDs have in their favour a much more organized model, supposedly more stability, and depending on the flavour better performance on different areas. Focusing on FreeBSD (the one closest to desktop usage), we have some nice things there: people speak of a faster OS, faster network IO, less "dissonance" when using their tools, more stability, compatibility with Linux binaries... also there's ZFS, the end all of filesystems, I'm not going to write about it's coolness here, you can duckduckgo it (am I using duckduckgo instead of google as a verb? yes, we need to raise awereness for other engines), but trust me, IT. IS. COOL.

It's pretty good, however, while the benchmarks do support some of those claims, for me FreeBSD is like another-linux, and has a lot of missing drivers (which is already a problem with Linux, and I can say that confidently, since I am writing this from my Surface device) and the Linux compatiblity layer is yet another layer of things that can (and will) go wrong when people execute their programs, and I'm not saying this out of some theoric possibility, I've seen some reports of people failling to execute programs on more complex scenarios (like Steam or Proton), scenarios which are super useful today.

Regarding ZFS we have other options like btrfs that although not as great, exist and are an option, and we also have openZFS, the Linux version of ZFS (AFAIK not as good, but again an option).

Some might point out the license (GPL vs BSD), and how they consider one to be more free than the other. This is a gasoline topic (one that can sause flames) and I'm not ready for any war, but I'm going to not take it into account, for the actual user there's little difference on those, what's more is that GPL has made some companies to actually make open source software, with great results (like AMD, whose open source driver has better performance and works overall better than it's closed source conterpart), while unfortunately, greed shows no limits, and companies like Sony or Apple have taken BSD software and returned AFAIK, nothing to those code bases.

Finally, I'm ruling out other BSDs, since they aren't targeted for the desktop.

So FreeBSD is not a bad option, but definetely would fragment more the space and/or need much more work, and we are willing to put in work...

Microkernels

As I said no stones unturned. My feeling is that you are proposing people to change something either what they have is broken and doesn't satisfy them of the new thing must have a good compelling reason.

And microkernels have this reason.

For those who dont know what microkernels are. All the other OS are what we call monolithic (or mostly monolithic) and they embed every driver (and other modules) inside of the kernel program itself, even if those modules are loaded per users request they still loaded into the kernel itself, a single bad line in any of them, can make your whole computer say "thanks, enough for today" and ... crash.

Microkernels fix this by making all of those modules regular programs, which present several advantages:

  • A crash is a minor problem: A crash will only bring down that part of the computer not anything else. Plus it can be recovered by realoding the program itself.
  • No difference in between os-provided drivers and third party ones: Since they are all programs and use the same interface, there's not gonnna be any if some third-party offers a kernel module for their driver, it's gonna work easily since the interfaces are stablished.
  • Live updates: Since everything is a normal user space program. Updates could be done live, no more rebooting. The only thing that would require a reboot would be the microkernel itself, which is pretty small (some ammount to 3k lines), so it is reasonable to think that the updates here after a couple of versions would rare, besides live patching could be possible, Linux does it, and I argue that for such a small program it would be even easier.

Which ones to focus on then? There are two names out there that i find most interesting nowadays: RedoxOS (written in Rust, great momentum, interesting concepts, some good projects beneath it) and SculptOS (ability to use multiple, different kernels, interesting sandboxing system ...), I still have to try them out before I can say which one I find more promising as far as desktop goes, but those two are the best candidates I know.

Again, just for the completion there are others like HelenOS, but either they aren't desktop-focused at all or they are too far behind to be even considered.

Is there anything else?

Yeah, there's a lot out there (MenuetOS, HaikuOS, ReactOS, ...) and they are widly interesting, if you are curious, do take a look at them. But for me they fall under the same category as FreeBSD, they would require a ton of work to make them consumer-grade desktop friendly.

The only other concept that's interesting is the one of the distributed OSs, where a bunch of machines are linked together and they can use each other's resources, imagine taking a picture from your computer using your phone's camera, or accessing their files transparently. This super interesting, but the level that we are interested in can be implemented in standard OSs, the only thing that we wouldn't be able to replicate would be things like RAM sharing and programs that work on both devices at the same time, things which are hardly useful since they require connection systems unavailable to consumer-grade devices.

TL;DR

Linux is the one closest to being able to be used, with newer microkernels (Redox and Sculpt) showing promise.

Now, there's still a ton of other questions to be asked on our marvelous OS but for the time being we know how we are going to base it.

Don't agree with something? Would love hear your opinion on a comment. Have a great day!

Top comments (0)