Live data from Hacker News

Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

mhatta.medium.com

21–30 of 273 posts

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#21
post #17
post #14

Earlier quoted context omitted.

It's not about the code existing, it's about the code being an integral part of a monolithic architecture vs. "servers" facilitating a microkernel design like hurd/mach.

But that is silly? If I have to audit the code for my system running, I would have to audit the code for each of the "servers" as well? If not, why not? To that end, how different is it, actually? And what are the other tradeoffs?

The servers are run in isolated address spaces like processes, taking advantage of MMU protection for more of the low-level facilities.

Ask yourself why it's safer to use FUSE filesystems on Linux when mounting untrusted block devices/image files than the in-kernel filesystem drivers and maybe it'll become clear why this is advantageous.

Or if you're familiar with containers and why that's a good thing, you can think of it as containerizing the kernel's subsystems/drivers.

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#22
post #3

Kind of weird to see linux called out as too big, and then the ack that writing a ton of device drivers is hard and will take time. Isn't that a large part of the source tree? Realizing I haven't even tried compiling a kernel in a long long time. Feels oddly sad to say.

Can get a sense of how long it takes to compile here https://openbenchmarking.org/test/pts/build-linux-kernel surprisingly fast with modern processors.

I love how much things have progressed. I remember I used to have to set up a clean build to run while I was at school so it could be done when I got back. Now it is done within seconds.

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#23
> The GNU Hurd’s hardware support is poor, so trying to run it on modern physical machines is suicide.

> ...one reason for using GNU/Hurd is that the Linux kernel has become too huge

By any chance, are these two statements related? Is it smaller because it lacks the drivers?

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#24
post #23

> The GNU Hurd’s hardware support is poor, so trying to run it on modern physical machines is suicide. > ...one reason for using GNU/Hurd is that the Linux kernel has become too huge By any chance, are these two statements related? Is it smaller because it lacks the drivers?

The drivers aren't part of the microkernel and run with limited privilege. So, yeah, OK, if you wrote all those drivers you'd have a lot of code, but not all of it would have total control of the system. You can't really make a direct comparison.

Linux has a hell of a lot of system calls and weird bells and whistles in non-driver code, too.

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#26
post #17
post #14

Earlier quoted context omitted.

It's not about the code existing, it's about the code being an integral part of a monolithic architecture vs. "servers" facilitating a microkernel design like hurd/mach.

But that is silly? If I have to audit the code for my system running, I would have to audit the code for each of the "servers" as well? If not, why not? To that end, how different is it, actually? And what are the other tradeoffs?

That's the big unknown question with microkernels. It was (in the 90s) a reasonable theory that a microkernel could be much more robust and secure and easy to develop than a monolithic kernel.

It would be more robust because individual services could crash and restart. That could really work for, say, WiFi drivers. It doesn't quite work for disk drivers or the file system, since how do you even restart something without a file system?

It would be more secure because drivers would live in isolated memory spaces. So a non-critical piece like a printer driver couldn't read memory from something more critical like a file system. Part of what changed since microkernels were originally proposed is that drivers are often split into low- and high-level parts. So a printer driver in Linux consists of a standard USB or network driver in the kernel, plus a user-level driver that can be worked on like a microservice. And the WiFi driver is a low-level driver plus wpa_supplicant running at user level. The USB and network drivers are shared with critical services, so you can't easily restart them anyway.

It would be easier to develop because you can restart just the piece you're working on without rebooting the whole kernel. That's a plausible argument, but somewhat undermined by HURD taking 30 years to develop. But there were many other reasons for that.

I guess the way to convince yourself one way or another is to try writing a driver for both.

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#27
post #8
post #3

Kind of weird to see linux called out as too big, and then the ack that writing a ton of device drivers is hard and will take time. Isn't that a large part of the source tree? Realizing I haven't even tried compiling a kernel in a long long time. Feels oddly sad to say.

I agree, it's odd. I don't have anything recent, but back in 2004, the majority of the Linux kernel code was in its drivers: https://dwheeler.com/essays/linux-kernel-cost.html I expect that most of the current Linux kernel code is also for handling hardware (that is, drivers + the code to handle various architectures).

Could one not make the case that maybe device driver support doesn't belong in the kernel itself?

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#28
post #21
post #17

Earlier quoted context omitted.

But that is silly? If I have to audit the code for my system running, I would have to audit the code for each of the "servers" as well? If not, why not? To that end, how different is it, actually? And what are the other tradeoffs?

The servers are run in isolated address spaces like processes, taking advantage of MMU protection for more of the low-level facilities. Ask yourself why it's safer to use FUSE filesystems on Linux when mounting untrusted block devices/image files than the in-kernel filesystem drivers and maybe it'll become clear why this is advantageous. Or if you're familiar with containers and why that's a good thing, you can think…

This... didn't answer my question? For many that are concerned with containers and such, they also have to audit the container process code. Such that, fine, try to use that to inflate the numbers on Linux.

Pointing at literally decades of device drivers as why the size of the code is bad, while acknowledging that it will take time to write device drivers so this will work on a respectable amount of hardware just feels weird.

That all said, please don't take this as a criticism of any of these ideas. I confess seeing Hurd in the headlines gave me a smile. Is nice to see people can still work on many ideas out there. I am only questioning the "size of code bad!" right next to "it will take us a long time to replicate a large portion of the code we just pointed at."

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#29
post #8

Earlier quoted context omitted.

I agree, it's odd. I don't have anything recent, but back in 2004, the majority of the Linux kernel code was in its drivers: https://dwheeler.com/essays/linux-kernel-cost.html I expect that most of the current Linux kernel code is also for handling hardware (that is, drivers + the code to handle various architectures).

Could one not make the case that maybe device driver support doesn't belong in the kernel itself?

Isn't this this mono vs micro kernel debate all over again?

Re: Gnu/Hurd strikes back: How to use the legendary OS in a (somewhat) practical way

#30
post #3

Kind of weird to see linux called out as too big, and then the ack that writing a ton of device drivers is hard and will take time. Isn't that a large part of the source tree? Realizing I haven't even tried compiling a kernel in a long long time. Feels oddly sad to say.

I understand what you're saying, but both are true.

1. Linux is too big. Even if we exclude the drivers, which are a majority of the kernel codebase, linux is still a massive kernel. Most microkernels are small enough to fit in the L3 cache, some are small enough to fit in the L2 cache. Linux, even if we could exclude the drivers, doesn't even come close. This inability to fully cache the kernel ends up negating the primary benefit that monolithic kernels have, which is performance. Linux spends more time bouncing around the cache than a modern microkernel takes to do an extra syscall.

To add to this, unless you are compiling your kernel specifically for your machine, your kernel is going to be a bloated compromise of the set of drivers that your system is most likely to see. That means that you will have dozens, if not hundreds of drivers compiled into your kernel which will never need to be used.

It's also too big in the sense that there are now far too many lines of code to be able to effectively monitor for vulnerabilites. That codebase size won't change when having a microkernel with the same number of drivers, but what will change is the ability of a single vulnerability to compromise your whole system. You have effectively compartmentalized vulnerabilities to their own address space. So in that sense, big codebases are a huge problem for monolithic kernels, but only a small problem for microkernels.

2. It will take time to write a ton of device drivers, simply because most of them aren't written yet. To that extent, Linux most definitely has an incumbent advantage. But that isn't to say that microkernels also have an advantage here. Anyone who has written a driver knows how much the ability to iterate quickly is helpful. Drivers in userspace can be written directly on the system that they will run on, with no virtualization or kernel reboots necessary, and with incredibly fast start/restart/stop. Userspace drivers are dramatically simpler to write, simpler to build, simpler to monitor, simpler to test, and simpler to distribute.

With all that being said, I definitely don't think Hurd is the future. But what could change the world is already out there but not really ready to use at the moment. One possibility would be an open-sourcing of QNX which is an amazing and incredibly mature microkernel OS, possibly the most mature in the world. If there are any bored billionaires out there reading this, please buy QNX from Blackberry and do that. Another possibility would be to put a shit ton of effort behind the SeL4 userspace, which is just too damn hard to do anything practical with at the moment.

Post reply on HN