
Serenity: x86 Unix-like operating system for IBM PC-compatibles - ingve
https://github.com/awesomekling/serenity
======
akling
Hey guys, I'm the author of this project. Surprising to see it on HN but life
is surprising sometimes!

I actually made a little demo video about this system just yesterday if you'd
like to see it running:
[https://www.youtube.com/watch?v=hE52D-zbX3g](https://www.youtube.com/watch?v=hE52D-zbX3g)

~~~
disillusion
Can I share some observations? There are a few things I really love about
this:

\- You kept the end user in mind: You. The GUI looks like a mashup, in a good
way: A Mac OS menu bar, Windows GUI feel and a NextSTEP launcher on top of a
Unix like system. It shows that for every element, instead of simply
recreating whatever system you decided to emulate, you took the parts you
liked best from whatever system and simply recreated that. I haven't looked at
the code too thoroughly, but I can probably find the same mindset there.

\- You kept the scope tight. It's easy to lose sight of the bare minimum MVP,
especially when working on a hobby project. The functionality showcased here
tells me that whenever you started implementation of a feature, you built
exactly what you needed, nothing less, nothing more.

\- You also didn't get bogged down with premature optimizations. Yes, the PNG
renderer is slow. But it does the bare minimum it's supposed to.

But most of all, this takes a crazy amount of time, skills and dedication.
You've probably encountered quite some frustrating moments you had to chew
through, but now you're here, presenting your work. And it's awesome!

~~~
akling
Thank you for these observations, you've just distilled my personal
programming philosophy into three concise points!

If you looked at the code, you would indeed find a similar "take what you like
and leave the rest" style mashup. I spent many years working on WebKit, so you
find a lot of WebKit-style patterns, containers and templates. I also spent
some years working on Qt, so there's a huge bit of that in the GUI library. :)

~~~
ianai
But you rewrote it all from scratch in a “clean room” so as to not incur any
license issues ;)

------
fernly
The README here is a model (or perhaps a superfluity) of modesty. This person
has, apparently, written a complete OS from the metal up to a usable GUI,
single-handed, AND done it in about 6 months -- at least, the oldest commit in
the Kernel branch is October 2018. Well, I'm impressed, anyway.

~~~
shric
Modesty in the comments too :)

[https://github.com/awesomekling/serenity/blob/master/Kernel/...](https://github.com/awesomekling/serenity/blob/master/Kernel/kmalloc.cpp#L1-L4)

/* * Really really _really_ Q&D malloc() and free() implementations * just to
get going. Don't ever let anyone see this shit. :^) */

~~~
tntn
Sorry, what is "Q&D?"

~~~
filmfact
Quick and dirty

------
mysterydip
This is excellent. I was expecting to see a screenshot of a command prompt and
was pleasantly surprised to see GUI and applications.

"the goal here is a marriage between the aesthetic of late-1990s productivity
software and the power-user accessibility of late-2000s *nix" That sounds
right up my alley. Will give this a try!

------
pushpop
I remember when home computing was full of neat hobby OSs. It was fun. Then
somewhere around the last 20 years everyone stopped writing kernels and just
built Linux distros instead (and these days you don’t even see that much
variety in Linux any more either).

Anyhow, this project looks really inspiring. At least from a quick cursory
glance. Looking forward to digging a little deeper tonight.

~~~
fooblat
> (and these days you don’t even see that much variety in Linux any more
> either)

I beg to differ! While I do see that there are a a handful of very popular
distros, there are tons more out there!

Spend a few minutes poking around DistroWatch[0] and see if you don't agree.

0\. [https://distrowatch.com/](https://distrowatch.com/)

~~~
pushpop
I'm not on about quantity of distros, I'm on about _variety_. A thousand
Ubuntu derivatives doesn't add much variation. systemd hasn't helped much here
either because there used to be a lot of variety in how distro's would
implement sysv. There even used to be distros that rolled their own file
system hierarchy.

Some might see the grand unification a good thing for interoperability and
developers - and I don't disagree with them. But it was fun looking at the
different ways different distros would solve the same problem. Whereas now the
biggest difference between a lot of distros is a great deal more superficial.

~~~
fooblat
I agree that the majority of distros are based on debian/ubuntu/fedora but
there are still some significantly different ones out there. The most
interesting/useful of these for me lately has been void linux[0]. It is based
around runit (instead of systemd) and has a very nice native package manager
as well.

0\. [https://voidlinux.org/](https://voidlinux.org/)

~~~
pushpop
I'm not saying there isn't still some distinct ones out there. I'm saying in
there is less variety than there used to be.

 _variety_ is the key description I used. Sure there are few outliers still
but the rest are just systemd + (apt|rpm) and there this really the same as
what Linux was like 20 years ago where even Debian and Redhat were distinctly
different from one another. Even Arch has come into the fold somewhat over the
years.

------
eismcc
Having worked on the Windows kernel team, I can say this impressive stuff. It
seems early enough to pick a specialty for this OS that it could do well that
others may not.

------
snvzz
The author has discussed his system for months in 4chan.

~~~
enthdegree
what board/generals?

~~~
patrickmcnamara
The /g/ daily programming threads.

------
nn3
It appears to be extremely bare bone. For example the TCP socket is like UDP
with hard coded IP addresses. It won't handle any packet reordering or lost
packets.

I haven't checked other parts, but if they are like that it would be more a
very elaborate demo than something actually usable.

Still impressive even for a demo.

~~~
akling
Your observations are of course accurate: many parts of the system are indeed
quite bare-bones. I've been trying to bring up a huge number of subsystems in
parallel by building enough of the scaffolding and infrastructure in each area
for a larger system to grow around.

Now for the rest of my life, I will always have something to hack on. :)

~~~
arbie
> Now for the rest of my life, I will always have something to hack on. :)

This is such an inspiring and humbling sentiment!

Thank you for all your hard work on this impressive project.

~~~
ngcc_hk
Totally agree. Hat off.

------
novocaine
This seems pretty incredible as a learning resource just as it is. I can't
quite believe how much is here and how concise it seems - has anyone gotten it
to run?

I really hope the author or someone else writes sone high level documentation!
Just knowing the design decisions would be great!

~~~
akling
Thanks. The design is mostly "discovered" through iteration. I tried making a
few diagrams at one point but in a week they were already outdated, so I've
given up on trying to document until things slow down.

------
tcbawo
Also of note, it appears to be a mostly (if not entirely) C++ codebase.

~~~
0815test
That's too bad. Needs more HolyC! (Rust would also do, in a pinch.)

------
ianai
Very awesome. Love that it’s a new take on a modern OS - including a GUI. I
didn’t think I’d see even an entrant into that sphere from a non-corporate
entity again.

------
hrvach
Respect! This is a very impressive achievement for a single person and
requires a lot of knowledge about operating systems.

------
rambojazz
If, like other people said, this was done in merely 6 months by a single
person, let me bring some skepticism into the thread here. From writing a
bootloader up to a functional UI with various functional user programs is not
a 6-months job, unless you take many shortcuts.

~~~
andyjpb
I've seen it done (multiple times).

I worked for a set top box manufacturer where the lead engineer wrote an OS
and a GUI system, from scratch, for our platform in less than a year. It had a
bunch of syscall personalities. One for vxworks so we could port stuff from
our existing platform and one for Linux so that people could write drivers for
it based on the O'Reilly Linux device drivers book (which was current at the
time). It also had a couple of others for odd things that we needed. It was
_incredibly_ well written. It only took me a couple of weeks to port it to
PowerPC and the first week of that was just phaffing getting my cross compiler
working properly.

In contrast, we had another couple of programmers trying to write a web
browser for that platform. After a year they had something that could render
primitive web pages but there was still a good chunk of the web that didn't
work "quite right". After two years they were still in a similar position.

Operating systems are a dark art, and the person who wrote Serenity is very
talented, but OSes are, at least, a tractable and well defined problem.

------
rubyfan
Serenity Now!

~~~
Nux
Insanity later

------
chaoticmass
Are there any pre-built distributions I can just plug into QEMU?

~~~
akling
Here's what I can offer right now: unpack this in serenity/Kernel/ and then
run "./run" in the same directory. Or just start QEMU manually with qemu-
system-i386 -kernel kernel -hda _fs_contents

[https://drive.google.com/file/d/1954ki8wzHT6axoj9vbFKj8XxFK5...](https://drive.google.com/file/d/1954ki8wzHT6axoj9vbFKj8XxFK5DdE4z/view)

~~~
chaoticmass
sweet, thanks!

and it works! Boots in like .1 seconds. Very neat.

One strange thing, in QEMU, the mouse is all crazy and I can't control it in a
usable way. Jumps around.

~~~
akling
That's weird! Maybe it's some confusion between the PS/2 mouse and the PS/2
keyboard both using the same I/O port.. Does it help if you give it a little
keyboard input before the mouse input? What OS are you running QEMU on?

~~~
chaoticmass
I tried giving some keyboard input before using the mouse, no change. I am
using Debian Stretch. If there is a more appropriate venue where you'd prefer
continue this conversation, let me know.

------
simonsays2
This would be quite an accomplishment for one person in six months.

I am skeptical.

------
Narishma
Weird title. Made me think this was for the original IBM PC and its clones but
it seems to require at least a 686 (Pentium Pro). By that time the term IBM PC
compatibles was already obsolete.

~~~
DC-3
This person has made their own fully fledged OS. Discuss that instead of
bikeshedding about terminology.

~~~
jchw
That would be nitpicking not bikeshedding :)

(They do have a point though; IBM PC compatible implies it would run on an IBM
PC...)

~~~
DC-3
It's a form of bikeshedding, in that it involves discussing the superficial
details that are easy to form an opinion about.

~~~
TallGuyShort
Oh my God they're literally bike shedding bike shedding.

~~~
DC-3
I'm obviously gunning for inclusion in webshit weekly :-)

