Live data from Hacker News

Interview with Andreas Kling of Serenity OS (2022)

corecursive.com

1–10 of 181 posts

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

#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 issue subsequent writes while waiting for fsync. Write barriers have better ergonomics (so, less complex, less buggy database implementations). And they're finer grained - so databases can also run much faster. Seriously, I could rant for hours about this. It drives me nuts.

2. Use event queue like semantics for subscriptions. There's dozens of OS APIs in which the OS exposes some data to applications where the data changes over time. Eg, filesystem watching, USB device insertion/removal, Bluetooth, watching a network device, or a socket, or APIs for htop to see the set of active processes. Each of these APIs has an entirely bespoke - and oftentimes idiosyncratic - API to get changes to that data over time. Sometimes you need to poll and parse a file in procfs. Sometimes there's syscall based APIs. And some of the subscription APIs are just broken sometimes, and they'll fail to notify you about changes sometimes.

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". The kernel then replies with the object's current state and I get messages notifying my application about changes. We should be able to use the same API for every type of kernel object.

It would also be interesting to try making all userspace programs be wasm bundles and run them in ring0. But I suspect that will run slower on modern hardware compared to using native binaries and context switching. ... Maybe. It might depend on the application.

I think this stuff could be done in linux. Event queue style subscriptions would work especially well with io_uring. But I'm kind of excited by the idea of just noodling myself and seeing where I end up. Making stuff is fun.

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

#3
> creating something strongly influenced by the past, but in a modern way, and in a sort of a high fidelity way with 2020 hindsight

This is a great take on retrocomputing and tech nostalgia.

Thank you Andreas for always being a shining reminder of that innocent love for personal computing I almost lost.

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

#4
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…

Some of the issues can be improved "hackily" by for instance giving a database software exclusive access to two discrete disks - one for the db file, one for the journal.

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

#5
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…

a great place to start is https://wiki.osdev.org/Expanded_Main_Page

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

#6
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…

Do it. Ignore whoever says it's too complicated.

You probably won't supplant Linux with your toy OS for your own research, but for a software engineer, writing a OS is the closest thing we have to the exhilarating feeling of seeing your code affect real hardware. You haven't lived until a bug of your own causes a triple-fault exception that causes a literal system shutdown.

I started this career writing my own tiny OS in my teens (https://github.com/1player/klesh) and for 20 years I've been wanting to go back, with all the experience I have accumulated.

Just don't make it another UNIX, please. We have enough of those already ;)

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

#7
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…

Some of the issues can be improved "hackily" by for instance giving a database software exclusive access to two discrete disks - one for the db file, one for the journal.

Why is this "hacky"? I've long wondered why databases need to be on filesystems, other than simply convenience. If you think about it, a filesystem is, itself, basically a database (not a relational one of course). So it seems like you could improve performance a lot by eliminating the filesystem layer and going straight to direct disk access.

Also, how this would be done would probably change depending on whether you're using a spinning-rust HD or an SSD, or a RAID array.

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

#9
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.

But isn't this just about compiling the system? Not really 'building', ie programming a operating system.

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

#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

Post reply on HN