280 points · by yarapavan · 3y ago · 266 comments
What does that look like for Hurd?
It's a project that's being built by and for people that care about it.
You might as well ask "How can my local pick-up basketball team find a niche to make money, like NBA players do? Can we all wear more colorful jerseys so TV stations cover us?" No, that's silly, the point of the pick-up basketball team isn't to make money, it isn't to beat a competitor, like the NBA, for sports coverage, it's to hang out with friends and have fun.
That's what many free software projects are like. And if enough people come to hang out and have fun, it might organically become bigger and better, but if you start making it the point of it, it ruins it. If you tell the pick-up basketball people "No, you can't join, you're not photogenic enough", you won't have friends soon. If you start telling hurd developers "We need to take on MS, stop working on that thing you care about, no one else cares about it", the project will die.
* Linux is the de facto kernel used on most servers, has great support and is the third pick after the mainstream kernels for a good reason. It's also usually someone's first introduction to Unix-based systems these days, so there's loads and loads of documentation available (even if the quality of that documentation runs the gamut from "acceptable" to "who wrote this").
* BSDs are rock solid and a great pick if you're targeting reliability. Knowledge on a BSD changes little with the years and that's a big bonus.
* Plan9 is interesting because it provides a unique approach to system design by taking the "everything is a file" approach to its logical limit. That doesn't make the system itself the most useful in the world but it is an excellent system to study and borrow good ideas from.
The main reasons I can see to use Hurd are... ideological opposition to Linux and being a microkernel. While the latter has interesting implications, the usual GNU problem of "we don't try to support any hardware unless it ideologically conforms" really gets in the way of wanting to use it and that's definitely a broader GNU problem but it's a much larger for problem for something as crucial as a kernel.
Also not helping things is that to my understanding, Hurd kind of has a start-stop nature to its development - that is, the project is on life support unless someone starts dissing it, so it picks up back for a few months to show how it's totally alive. Very much more of a spite driven project these days than a legitimate option.
[1] https://www.gnu.org/software/hurd/hurd/documentation/transla...
Is Hurd there? I mean, you obviously don't frame 'success' with an open source system in financial terms, but I would argue that developing a critical development mass is pretty important. Without that, the project will wither and die.
Open source is sort of an "attention economy", so the currency isn't dollars, but developer interest.
Fooling around with something for the joy of learning is a motivator, but I don't know that it's enough to sustain a project, long term.
And Hurd very much is a 'product' in the economic sense, whether it's open source, not for profit, or whatever.
Okay, then tell us why we should care about it when more popular operating systems fit our needs better anyways.
Man, y'all are gonna be so mad when you find out some people work on OSS projects for fun or ideological reasons.
Again, a sentiment that needs repeating far too often here, not everything is about, or for, you.
Linux started this way. If Linux reaches a point where it doesn't fill the needs of its users/developers better, they will pivot to another alternative, and Hurd is one of those future alternatives. See it as future insurance.
I mean, any unique features HURD has, Linux can easily copy, like with FUSE.
The safety benefits are kind of dubious, in that we're not in the 90s anymore, restarting Windows 3 times a day. Modern kernels are very stable as it is, so more stability is barely noticeable.
And we have containers and virtualization.
Linux, (not big and professional like gnu), is not going to win but could find a niche somewhere. Hm, ok.
Linux has a large, large established user base at this point. If you want to attract people to a different platform, you need a compelling reason.
For people just looking to look/experiment/learn/play, 'something new' that's more easily understood because it's small might be enough, but that's unlikely to be a large user base.
Which market segment does linux not totally dominate nowadays? Phones, big servers, embedded devices, HPC... Maybe you could argue desktops? Maybe? Still a very signficant player there however you dice it.
Going back to Linus' original email announcement then apply your framework and you don't predict linux competing anywhere let alone dominating everywhere. How could anyone? Smash Sun, IBM, HP all of them. No chance. None.
The future, it's really hard to predict except in hindsight.
On the IoT space it seems like not everyone is keen in having to deal with GPL and Linux, hence the myriad of FOSS MIT/Apache licensed OSSes that now exist.
Zephyr, NuttX, Mbed, Amazon RTOS, Redox, Tock...
And then there still the commercial alternatives.
Unless one is already depending on it on a daily basis, nobody wants to take over someone else's project.
These projects are all one bus away from becoming the next TempleOS.
https://upload.wikimedia.org/wikipedia/commons/f/f5/Sankey_D...
On the smaller side, Ext4 at just 21,515 lines, and on the larger side, Btrfs at 55,758 lines.
It almost makes me think that writing a new file system in Rust, might actually be a tractable project.
Obviously ext2 is a very outdated filesystem by today's standards, but considering ext3 and ext4 are essentially just some extensions slapped onto ext2, I still didn't expect it.
Another thing I found really impressive was just how resilient e2fsck is. During early development of my ext2 code I frequently mangled the file system in a myriad of weird ways, but no matter how much I broke things, e2fsck was almost always able to restore the file system into a reasonable state.
(For the curious, there is some excellent documentation on the ext2 file system at https://www.nongnu.org/ext2-doc/ext2.html that I mostly used for my implementation of it. Sadly no such thing seems to really exist for ext3/ext4).
It is interesting that the “remainder” chunk of the drivers is so big. Wonder if they need some more categories.
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).
> You think you want a stable kernel interface, but you really do not, and you don't even know it. What you want is a stable running driver, and you get that only if your driver is in the main kernel tree. You also get lots of other good benefits if your driver is in the main kernel tree, all of which has made Linux into such a strong, stable, and mature operating system which is the reason you are using it in the first place.
For Linux, yes. For a microkernel, those are different trees of userspace software.
Not to say, Hurd itself is userspace software, that runs over a microkernel (included on the distribution).
If that were the argument, then the comparison with Linux would be meaningless. Hurd is much bigger than freertos, should everyone switch?
"the GNU/Hurd is Unix(POSIX)-compatible, so most things work"... well that's to be said for MacOS, QNX, etc. In practice, where is the "65% of the Debian archive can be built for the Hurd" figure coming from? I'm sure it can be built in theory, how much does it require source modifications?
And here's the overview on how many packages have successfully been built vs how many have failed: https://buildd.debian.org/status/architecture.php?a=hurd-i38...
The number of packages that can be built have been built; it is not a theoretical number.
At this point I don’t remember the last time I’ve compiled a kernel.
Really, the speed of compilation is such that I understand why so many source distribution methods are as popular as they are now. Feels funny to have come to that point so effectively.
I haven't built my own kernel for more than 15 years, but I probably built more than a dozen before that, each of them re-compiled upon every new release (going back to 0.98).
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.
I imagine there's two pools of Linux users: those that compile their own kernel, probably with only the drivers they use; and those that use distribution kernels, which have a small set of compiled in drivers, and a huge initrd with all the drivers. Neither one of those groups ends up with all of the drivers loaded into memory: the compile their own have a small set, the distro kernel people end up with only the drivers they need loaded; both groups have a relatively small kernel footprint.
This makes no sense. The comparison that matters isn't kernel vs microkernel, its kernel vs microkernel plus all the userland code needed to implement system services. If my program wants to read a file and write to the network, then the code to do that has to be brought to the CPU to run before my program can finish doing that, and it doesn't matter whether that is in the kernel or userland.
And also, what matters for performance is the size of the "hot" code. A lot of code, both on a monolithic kernel and on the userland code implementing system services for a microkernel, is going to be "cold" code which executes rarely. This includes initialization code, shutdown code, most of the error handling code, code to react to uncommon hardware events, and so on.
> If my program wants to read a file and write to the network, then the code to do that has to be brought to the CPU to run before my program can finish doing that, and it doesn't matter whether that is in the kernel or userland.
And given that the essential complexity is the same, it's very likely that the size of the relevant code is similar.
The reason microkernels typically benchmark on syscall (typically IPC) latency is because that is the only truly apples to oranges part that you can't compare between the two. Monolithic kernels have a single context switch, microkernels have two. But microkernels, being micro, are a lot friendlier to caches (less to load and flush), and especially so with dedicated code caches (which do not need to flush on context switch).
Is that important, though? As soon as you start processing any meaningful amount of data, won't your OS be evicted from the cache anyway?
> 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.
I'm not sure this is true. Device drivers are typically compiled as modules, which are only loaded into the kernel if needed. Common wisdom among Linux power users for the last decade or so has been that compiling your own kernel for any tangible performance/memory improvement is basically futile.
Are there exceptions to this that you are aware of, and can elaborate on?
Writable caches yes. However many (most?) modern processors also contain a code-only cache which can be used for OS caching without any need to flush. The raspberry pi 4 can fit many modern microkernels in their tiny immutable cache, so it gains a massive caching benefit by being small.
> Are there exceptions to this that you are aware of, and can elaborate on?
You’re probably right, I was unaware of the extent of the kernel module usage. Regardless, the smallest common kernel in use that I know about is for alpine Linux and that is still at least 100MB, which is dramatically larger than the <1MB microkernels that are typically available.
Too big for what exactly? Because it's clearly not too big to run. It's been running very well for decades, and Hurd has not.
I've known for decades that on paper, microkernels and Hurd should be superior, and I've wondered for nearly as long why then they aren't taking off. If they're so good, they should at least be thriving in some niche where that performance matters, shouldn't they?
And now I hear that even after 3 whopping decades, it still doesn't run on real hardware! Entire operating systems have been born and died in that time.
What is the problem that's making Hurd still not work?
> 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 why is Linux the incumbent when Mach and Hurd were conceived 3 years earlier?
> But that isn't to say that microkernels also have an advantage here.
I would love to believe that, but then why has that advantage not paid off for 30 years?
> With all that being said, I definitely don't think Hurd is the future. A Why not? And is this why nobody has been writing those drivers?
I don't mean to be shitting on Hurd, but it's been really promising for so long, and not delivering, that it's starting to feel like fusion power: always in the future, nearly there, but never quite here.
They (microkernels) thrive in Automobiles, Aircraft, Spacecraft, Security systems (such as hardware encryption devices), Defense Munitions, Embedded Devices, Maritime devices, radar systems, and many other areas. The common thread here is that they are not just resource constrained and performance sensitive, they are also typically very specialized and mostly write-from-scratch.
That last part is the key to understanding why general purpose operating systems mostly use legacy kernels that are decades old. We want to preserve as much as we can from what came before.
> But why is Linux the incumbent when Mach and Hurd were conceived 3 years earlier?
Because Linux worked earlier. Nobody in the GNU ecosystem knew how to develop a microkernel that worked, let alone drivers for a constantly changing target OS.
> I would love to believe that, but then why has that advantage not paid off for 30 years?
Again, they have. Almost all RTOSes are microkernels, and the most popular embedded OSes are microkernels. When you're writing something from scratch, it is always going to be easier with a microkernel. Don't mistake Hurd with the concept of a microkernel. Hurd sucks because it has always sucked. It's bloated, poorly documented, relies on a very janky GNU ecosystem that has already mostly adapted to Linux out of practicality concerns, and there is no ecosystem tooling around it.
But the advantages of microkernels in general are very real. The best one out there in terms of maturity is QNX, and while practically every modern car on the planet runs on it, it's licensing pretty much precludes it from being used as a general purpose OS.
OK then, so, which microkernel provides performance on-par with or better than Linux?
This is a strong claim and some evidence is warranted.
Have you looked at the size of L3 caches lately? You could fit a whole ‘nother OS in one of those.
These days most Linux distros build pretty much any driver as a module that can be built as one. Boot-critical modules (like NVMe drivers) are included in the initramfs so they're available before the disk is mounted.
I agree that Linux is still larger than a microkernel, but very few users have a bloated kernel in RAM due to lack of customizations.
Most users run the distribution's kernel.
I am not going to pretend I have any idea because I have just googled these numbers but it seems to me that an amount of cache could be reserved for the kernel without too much of a hit to applications on what are currently high end machines.
So even if you have a really large monokernal the parts of it that actually get used will be in cache in the parts that aren't used and won't be in cache.
Has other people stated how Michael Colonel is still going to need a lot of user modules to do most of the work that's normally in the monolithic kernel, so it'll probably end up being about the same amount of code that needs to be in cash first, not in cash. The differences is really come down to just call boundaries as I understand it
Process isolation and selinux are things that exist. You even mention it. Turns out, having complete isolation between basically everything in your system is hard. I don't see how microkernels will make that difficulty disappear?
With drivers:
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
C 32699 3332747 2610014 17218820
C/C++ Header 23690 712617 1373965 7109290
Assembly 1336 48534 101884 234314
Without drivers: ---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
C 13200 1031558 951267 5356551
C/C++ Header 13760 300309 535100 1643611
Assembly 1321 47500 100899 230638
Seven million lines without drivers. Linux is huge. I'm sure you'll move the goalposts further though, so what should I do next? Delete most stuff in arch/ and samples/ ?Numbers obtained by running cloc 1.96 on current kernel master.
You can ask for numbers without casting aspersions like that.
This is HN. It is something like a casual conversation. You are free to ask for numbers, other people are free to provide or not provide them, and we should be able to have this conversation without leveling accusations of dishonesty (which the word “feels” does not really temper).
Process isolation actually isn’t fundamentally hard…it’s just hard on a system that wasn’t designed for it. And SELinux doesn’t do what microkernels do. Even with a tightly locked down SELinux configuration, a driver vulnerability can lead to root access. SELinux can protect your userland the same way that microkernels do, but it can’t put your drivers in userland.
For real world use wheen comparing OS you would generally go for other metrics like resource usage, multi threading bottlenecks, throughput of network packet and their processing, context switches(or equivalent) per second, and dozens of other things that would be paragraphs in length before you get to LoC.
Windows had the lead until about 15yrs ago when suddenly iPhone arrived and it propelled apple/Mac (and by association Linux) back into the game.
in recent years the rise in popularity of CLI, microservices (APIs for everything) and remote working/collaborating is indicative of a market shift, away from monolithic, centralized systems and providers (Cloud aside).
Security + Privacy are more so becoming inseparable, for users all around (private, business, orgs, gov).
I particularly like their concept of user-space servers and translators [1] [2]
[1] A translator is simply a normal program acting as an object server and participating in the Hurd's distributed virtual file system.
[2] https://www.gnu.org/software/hurd/hurd/documentation/transla...
You mean Android?
Someday it'll have the fault tolerance of OpenVMS, where it'll somehow keep running when the hardware dies.
And certainly the time is ripe since we have such powerful and capable machines even in the pockets of our pants ... we can certainly waste a little bit of resources to work with more secure layers of abstraction ... yes?
But Hurd has taken so long, I feel like Google Fuschia might dive in and capture everyone's imagination with a more modern and practical implementation of the concept. To be clear ... neither Hurd nor Fuschia are really practical today ... I just feel like its more likely Google might throw a few hundred million at the project if it pans out in the few places its currently being field tested (like in Google Home devices).
> ...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?
Linux has a hell of a lot of system calls and weird bells and whistles in non-driver code, too.
Apparently because it mmaps the entire disk, and under 32 bit CPUs there's not enough address space.
Which is a ridiculous technical limitation. You could have bigger disks than that by the mid 90s.
Come think of it, my Ryzen 9 3950X supports 43 bits of address space which works out to 8TB. So if that limit applies, even the 64 bit version would be limited on modern hardware.
But still, 256 TiB is just a dozen drives these days. Not a very consumer-like configuration, but very much a limit you can run against.
Yes, that was the issue as I recall. But seL4 is an excellent, secure high-performance microkernel. If something is painful to do in L4, it will likely not be faster or more secure running under any other microkernel, and so you should arguably question the wisdom of what you're trying to do.
For the ones not in the know, Mach is an OS designed after the idea of "the network is your environment, not the computer" where it should make little difference if the resources you are accessing is on your computer or not. And "resource" here is really generic, meaning things like files, login information, printers and other periferals, CPU, whatever.
For some reason (maybe related to costs and licensing), people never adopted the idea... and insisted on reimplementing it with unreliable hacks and lots and lots of problems on top of every other OS out there instead of just having it on the OS itself.
I personally think it's a pipe dream, and the way history worked out seems to confirm that.
Truly transparent networking never really worked out anywhere. The better RPC solutions in use, for example, make it very obvious that an RPC is an RPC, instead of looking like a local function call. In file transfer, it has been common to e.g. replace NFS with something HTTP based for quite some time. "Cloud" file systems seem to operate at a much higher layer, preferring external syncing and special high level APIs with only some actual OS support sprinkled in.
For Operating Systems, a lot of Mach breaks down when you want to do things fast and securely.
It's a testament to APIs better being shaped by locality. Roughly and informally spoken, the closer you are to the actual CPU, the more "lightweight" and "direct" your API can and should be. The further you move away, the more resilient you need to become, and the more control and insight you need to give the caller about the actual transport.
To pick two very real extremes as an example: When writing to a register on a local bus, you often just assume it will work. If it doesn't, a panic is sensible (sometimes even worse, like a lockup leading to a watchdog timeout). When trying to invoke a function on another server, obviously that's not acceptable. Then you want to be able to timeout, retry, inspect transport failures, fall back to other servers, configure endpoints, be picky and explicit about payload (and result), and so on and so forth.
The immense cruft necessary for the latter case becomes unnecessary and expensive the more local you are. It affects security, and can even pose chicken and egg problems.
To me, the reason is obvious: what happens when someone unplugs the network cable? This is #1 in the list of distributed computing fallacies (https://en.wikipedia.org/wiki/Fallacies_of_distributed_compu...): "the network is reliable". The other fallacies on that list might also be relevant.
About the same thing that happens when you unplug your corporate Windows machine. You only have cached and local resources.
People insist on using all of that functionality. People also insist on implementing it by hacks everywhere with nothing talking with each other and each part failing for its own reasons.
The network is relatively slow and unreliable. Whenever you access a network resource error handling, asynchronous operations and possible inconsistencies have to be the first things you deal with.
It's gone beyond famous and now it's IN... famous.
Honestly, what's Hurd doing wrong to flounder so hard?
[0] https://github.com/redox-os/redox/releases/tag/0.0.3
just one simple `guix system reconfigure' away!
Guix Hurd on my thinkpad x60: https://todon.nl/@janneke/110451493405777898
yeah, that's real (old, but not ancient) iron.
Enjoy!
TL;DR; Add this
(service hurd-vm-service-type
(hurd-vm-configuration
(disk-size (* 5000 (expt 2 20))) ;5G
(memory-size 1024))) ;1024MiB
GNU Shepherd system service description to your system configuration, and reconfigure; then just do something like sudo herd start childhurd
ssh -p 10022 root@localhost
If you're not using Guix System, you can still download a prebuilt QEMU image from <https://guix.gnu.org/en/download/latest/>: wget -O hurd-latest.img https://ci.guix.gnu.org/search/latest/image?query=spec:images+status:success+system:x86_64-linux+hurd-barebones.qcow2
and do something like: qemu-system-i386 -m 2048 --enable-kvm --hda hurd-latest.img
Enjoy!The GNU/Hurd default terminal can display a JPEG inside the terminal?
https://en.wikipedia.org/wiki/Linux_framebuffer
XTerm can as well, if built with Sixel support:
2. https://sr.ht/~sircmpwn/helios/
Consider how many years and how many developer-hours have probably been spent on Hurd compared to projects like SerenityOS and Haiku.
Hell, even TempleOS seems to have accomplished more. /s
Hell, wouldn't it be cool if there was an official GNU GPL'd RISC-V board, running GNU Hurd?
It was clear there's a severe lack of manpower on the project. I think it'd have to be rewritten in rust or something hip to get new blood today.
I actually think GPL is key in long-term adoption and is part of at least the early part of Linux's success. To prevent fragmentation. To coax commercial entities to contribute. And to generally encourage community development, rather than forks (since forks require distributing source anyways).
But others disagree, and these days Apache/MIT type licenses proliferate.
> * APIC, SMP, and 64bit support was improved a lot: they now do boot a complete Debian system, but some bugs remain to be fixed.
There are use-cases where linux/whatever is used to run a single system across a cluster of hosts. For this, you need a scheduler to dispatch across a set of machines.
There is room to debate whether init should happen at the system level (driven by OS tooling), or at the application level (not driven by OS tooling).
Systemd is bound by single-host assumptions. Hence, systemd is either inadequate (OS tooling) or else too complicated (application driven).
If you wanted to do something in the spirit of systemd (OS tooling), but which was suitable for clusters, the scheduling function would live as a consensus across a grid of hosts. Hosts would have a simple init that joined that consensus at boot and which acted as an agent for the init consensus.
This would scale down to all the use-cases systemd currently covers - you could have a consensus of one.