Live data from Hacker News

Interview with Andreas Kling of Serenity OS (2022)

corecursive.com

41–50 of 181 posts

Re: Interview with Andreas Kling of Serenity OS (2022)

#41
post #2

I'm increasingly tempted to try my hand at making a toy OS - or at least a kernel. There's a few things I desperately want an operating system to do: 1. Have either database-like transactions or (at a minimum) write barriers for file operations. The current filesystem semantics are terrible for databases and other applications which need to not corrupt their data after a crash. fsync() is too heavy, because you can't…

One problem with 2. is that subscribing to changes isn't always good enough, since if you go to act on the changes things may update out from under you regardless. Like, if you react to filesystem events, if a new file is created you might have it get deleted before you even register that it was added and do whatever you wanted with it.

I feel like it should be possible to say "I want to reserve access to this resource when something important happens on it". Or just "I want to reserve access to this resource". Hopefully eliminates TOCTOU races. I guess then there have to be different modes to balance scalability/flexibility.

Re: Interview with Andreas Kling of Serenity OS (2022)

#42
post #29
post #18

Earlier quoted context omitted.

You might enjoy http://synit.org/ , perhaps. Heavily inspired by both Smalltalk and Erlang. (It's my own wee quixotic project btw)

That looks very interesting, thanks for sharing! Somehow I had never heard of it. Time for a Show HN?

Thanks! And good idea. The ideal time would have been early 2023, because things have drifted into bitrot a little already. I'll tidy up and see about showing it off hopefully in the next few days.

Re: Interview with Andreas Kling of Serenity OS (2022)

#43
post #10
post #8

For those looking to try their hand at building an OS, there's Linux From Scratch. https://www.linuxfromscratch.org/ I failed tremendously, but I had a lot of incorrect ideas about what makes an operating system go. The learning experience was worth it, though.

That teaches how to compile Linux kernel and software, not to create an OS out of thin air. The go-to guide for anyone that wants to build their own operating system has always been the OSDev community wiki and forum: https://wiki.osdev.org/Main_Page

It seems to me that OSDev.org is unnecessarily married to the idea of "low level == C": https://wiki.osdev.org/Languages

Would be interesting if someone with knowledge (e.g. David Chisnall) could help clarify whether this seeming of mine is seemly.

Re: Interview with Andreas Kling of Serenity OS (2022)

#45
post #2

I'm increasingly tempted to try my hand at making a toy OS - or at least a kernel. There's a few things I desperately want an operating system to do: 1. Have either database-like transactions or (at a minimum) write barriers for file operations. The current filesystem semantics are terrible for databases and other applications which need to not corrupt their data after a crash. fsync() is too heavy, because you can't…

> I want to try replacing all of that with a simple, unified API which lets you say "tell me the state of and tell me when it changes".

Fuchsia's "Signals" are designed in that direction. You get a "handle" to a resource, and the resource has a 32-bit integer with signal bits that you could subscribe to. The meaning of each bit is different for each type of resource.

(In general operating system terminology, "Signal" means just a message without any payload that would have required any memory allocation. There are many ways to do it, not just the Unix way. Message ports and other abstractions are sometimes built on top of types of signals)

Re: Interview with Andreas Kling of Serenity OS (2022)

#46
post #10

Earlier quoted context omitted.

That teaches how to compile Linux kernel and software, not to create an OS out of thin air. The go-to guide for anyone that wants to build their own operating system has always been the OSDev community wiki and forum: https://wiki.osdev.org/Main_Page

To be fair there is a lot you can do in userland. Graphics protocols, package management, isolation, security etc. And even more can be done by incrementally patching the kernel where needed. It's just that Linux is kind of usable out of the box with just the kernel and /bin/sh. But for other OSes this isn't true, the kernel can expose a vastly different interface than the actual os which users interact with.

I've done every bit of the kernely/cgroupy/bpf/vfio/syscall stuff for a long time and I honestly don't think I could tell you pretty much anything about building an OS.

I actually came into this thread thinking, "damn, I have no idea specifically WHAT I would do/not do if I made an OS, or where to even start" not that I could at all. But I mean feature-wise, etc. Like, it's obviously a ton of apis that you call to invoke things at the system level but I have no idea what to do at the system level. Maybe you just communicate with APIs over there for everything on the motherboard. I know Nvidia has NVAPI I've used that a bunch through their SDK, not more low level. And you start with probably a super baby kernel..

There are also different styles of OS, like windows with the registry which I have broken and fixed thousands of times, and then nix which is pretty much file based. I don't know what else would be better than either of these, I hate the registry thing but maybe it has some huge benefit I haven't figured out.

When I look at C I see heiroglypics. Maybe me learning rust is helping with that. I do really need to learn it for security sake and (live)patching, etc. I write go and ruby so I don't touch memory much.

I'm the same about filesystems. I know a bunch of them and hve done tons of performance testing for SANs etc but couldn't tell you a thing about the lower level, making one, stuff.

edit: lol I guess a lot of this is installing drivers too

Re: Interview with Andreas Kling of Serenity OS (2022)

#47
post #41

Earlier quoted context omitted.

One problem with 2. is that subscribing to changes isn't always good enough, since if you go to act on the changes things may update out from under you regardless. Like, if you react to filesystem events, if a new file is created you might have it get deleted before you even register that it was added and do whatever you wanted with it.

I feel like it should be possible to say "I want to reserve access to this resource when something important happens on it". Or just "I want to reserve access to this resource". Hopefully eliminates TOCTOU races. I guess then there have to be different modes to balance scalability/flexibility.

You can definitely do that, it just means that userspace can now stall access to things unless you're very careful :) Like, one model (often used by EDR, which is why everyone hates them) is that every operation must be "authorized" so it doesn't go through until some evaluation happens. But this means the kernel has to ask a program for every operation, which is slow.

Re: Interview with Andreas Kling of Serenity OS (2022)

#48
post #46

Earlier quoted context omitted.

To be fair there is a lot you can do in userland. Graphics protocols, package management, isolation, security etc. And even more can be done by incrementally patching the kernel where needed. It's just that Linux is kind of usable out of the box with just the kernel and /bin/sh. But for other OSes this isn't true, the kernel can expose a vastly different interface than the actual os which users interact with.

I've done every bit of the kernely/cgroupy/bpf/vfio/syscall stuff for a long time and I honestly don't think I could tell you pretty much anything about building an OS. I actually came into this thread thinking, "damn, I have no idea specifically WHAT I would do/not do if I made an OS, or where to even start" not that I could at all. But I mean feature-wise, etc. Like, it's obviously a ton of apis that you call to in…

I have always found it interesting how people who come from the top down (software -> hardware) get confused by the low level stuff, and myself who came from the bottom up (hardware -> software) gets so confused by non-low-level code. I.e. I have no idea how to write a program for windows, it's totally alien to me and I cannot make sense of the code.

Re: Interview with Andreas Kling of Serenity OS (2022)

#49

> But at least in my case, whenever I tell people about some idea, I kind of tend to lose interest in the idea. So I just went to work on it instead. I think that's great advice.

I read somewhere long ago that there's some chemical released when you talk about your plans, similar to the chemical that gets released when you complete your plan. So when you talk about your ideas, you feel like you've already accomplished them.

Ever since I heard this, I've been protective of what I talk about and it seems to have helped me ship more things than before.

Post reply on HN