3 ms·
> Also it's a hybrid kernel written in C++, unlike Linux which is monolithic kernel in C. "Hybrid" doesn't mean anything here. The "hybrid" design claims all t
by tialaramex 5y ago
> Also it's a hybrid kernel written in C++, unlike Linux which is monolithic kernel in C.
"Hybrid" doesn't mean anything here. The "hybrid" design claims all the benefits of a monolithic kernel, without the disadvantages of a microkernel. Huh. Wait, let's read that again. It's a monolithic kernel with better marketing. Even the networking, which in BeOS back in the 1990s was genuinely userspace code - is baked inside the Haiku kernel just like the IP stack in Linux.
C++ is not used very much in Haiku's kernel. This is because the Haiku kernel ABI boundaries are defined in C not C++ and because they're stuck with stuff from last century for compatibility reasons. If you know C++ 20 you will find Haiku's C++ dialect pretty archaic, they don't yet have C++ 11 era smart pointers for example.
In practice, unlike Linux the Haiku kernel has a very 1980s attitude to hardware, it's big on "probing" at boot time for devices, like DOS would have, making it a poor fit for modern intelligent peripherals. As a hack USB is treated a bit differently so that at least it has some sort of "hot plug" like a 1990s PC. Where Haiku tried to go beyond probing they chose something very strange, they focus on capability discovery. So Haiku's thing is, you want a sound device, lets look for a sound device, I can't see one, give up. In Linux, discovery is driven by the peripherals, so this is a PCI controller, let us explore the PCI bus, OK there's a USB controller on it, let's explore the USB bus, OK there's an Intel HDA controller on it, let's explore that, it's a PCM output. We can play sound through that. Haiku's approach might fit well in some other universe, but the Linux strategy matches how your hardware actually works in our universe.
- waddlesplash 5y ago(Haiku developer here.) We have our own homegrown smart pointers and do make plenty of use of them, though we could stand to make more. Already pretty much any short-lived objects (i.e. that have no lifetime beyond the function they are immediately in) are smart-pointer-managed. The "probing" approach needs a rewrite and we know it. Most of that code is confined to about 2-3 files inside the kernel. It will be a big job to fix it, but we won't need to reinvent the world. Eventually I or someone else will probably get around to it, but we haven't needed it yet; the people who need PCI hotplugging will have to do without Haiku for now. (Or they can submit patches :)