FreeBSD re-design as Hybrid Kernel, it it possible?

I've recently began to migrate all my server systems from Ubuntu Linux to FreeBSD. I always liked FreeBSD more and unfortunately got caught up in all the noise Ubuntu was making back in 2007.

I had a thought... With most modern OS's like NT, OSX, and Haiku having a micro/hybrid kernel design as opposed the old monolithic design that Linux and FreeBSD use... I was wondering how long FreeBSD can continue to stay relevant (let alone compete) with this approach. Has anyone even considered the possibility of one day re-designing FreeBSD with a hybrid kernel?
 
I am not a kernel hacker. Would you mind explaining to me what a micro kernel is as well as its impact on what is currently in place. Is this a performance thing?
 
UNIXgod said:
I am not a kernel hacker. Would you mind explaining to me what a micro kernel is as well as it's impact on what is currently in place.
It's a different design of a kernel. FreeBSD (and linux') has a monolithic kernel. This means it's one big chuck of code that contains everything, memory management, process management, drivers etc. A microkernel contains only the bare essentials, memory management, process management and IPC. Everything else, including drivers, is in user space. Both have their advantages and disadvantages.

A hybrid like QNX (OS-X' kernel) tries to take the best of both worlds. It contains a microkernel (the Mach kernel) with some monolithic kernel bits thrown into it (some parts of the FreeBSD kernel).

Torvalds and Tanenbaum had an interesting discussion about micro vs. monolithic.

http://oreilly.com/catalog/opensources/book/appa.html
 
@tuaris

It's just a matter of the amount of cash you want to put for the whole rewrite, of course it's possible, anything is possible with the appropriate amount of resources (cash for developer's time), but will it happen? I do not see it happening it the next 10 years, but who knows later.

Hybrid kernel is not that great, device drivers (the ones that cause most hangs/panics) are still in the kernel: http://en.wikipedia.org/wiki/Hybrid_kernel

The best choice is micro kernel. Check MINIX 3 which uses the BSD license; recently they incorporated pkgsrc/pkgin tandem into the system. They are porting NetBSD's userland also, It's closest to the BSD microkernel available currently.

The MINIX also got funds (about $3.3 USD) from EU for the development:
http://www.executivebrief.com/news/eu-funds-research-on-lightweight-stable-open-source-os/

SirDice said:
A hybrid like QNX (OS-X' kernel) tries to take the best of both worlds. It contains a microkernel (the Mach kernel) with some monolithic kernel bits thrown into it (some parts of the FreeBSD kernel).

You mislead something here mate, OSX uses XNU kernel which is indeed hybrid, but QNX is a operating system with real-time microkernel and has nothing to do with OSX.
 
vermaden said:
You mislead something here mate, OSX uses XNU kernel which is indeed hybrid, but QNX is a operating system with real-time microkernel and has nothing to do with OSX.
You're right, it's XNU. Damn those TLAs!
 
tuaris said:
With most modern OS's like NT, OSX, and Haiku having a micro/hybrid kernel design

Windows NT is a monolithic kernel, just like all of the BSDs, Linux (including Android), HP-UX, Solaris, etc.

Don't know anything about Haiku, but believe it's also monolithic as it is a continuation of BeOS?

Out of your list of "modern OSes", only MacOS X is a hybrid, and just barely.

QNX is pretty much the only successful micro-kernel-based OS on the market today.

IOW, why do you think monolithic kernels are so bad, considering everyone and their dog uses one? :)
 
Been reading about GNU/Hurd. Sound interesting but I imagine there must be a reason it's still never fully made it out of testing.
 
UNIXgod said:
Been reading about GNU/Hurd. Sound interesting but I imagine there must be a reason it's still never fully made it out of testing.

I tend to believe that it is purely due to hardware / driver limitations.

This hurd project is quite cool,
http://www.archhurd.org/

But shows the above limitation when the only video driver available to it is x11-video-vesa

Which is probably one of the main reasons that Windows does so well, in that it has all drivers available to it (though generally in binary forms).

I.e what is the point in a micro-kernel... when I cannot use my nifty phone connectivity suite on it...? :D [/troll]
 
vermaden said:
Duke Nukem Forever has been just released, maybe some day ... ;p

Yes, it was rumored to be running on HURD. So they could not release it untill HURD was ready, but it seems they did some porting in the past. ;)

One point which I think is the most important point which leads to monolithic kernels instead of microkernels is that the design of drivers and subsystems is much easier. It also may be there is a speed penalty involved due to multiple context switches for most calls and the asyncronous working of the drivers which are now seperate processes. It is hard for many developers to get their mind around parallel processings (you can see this in any class about HDLs). Also, the announcement that you can not simply throw a pointer around into the subsystems scares many out of their reserve of clean underwear. This is no problem in a monolithic kernel where that can be done inside the kernel and due to the memory range splitting (3/1 f.e.) even between kernel and user process.

There is a nice video around "inside the MacOS X kernel" which goes into some details about that. Interesting to view.
 
SirDice said:
Nope. But it's not exactly a microkernel or a hybrid either.

http://en.wikipedia.org/wiki/Hybrid_kernel#NT_kernel

Yeah, I really don't buy it, though. The NT kernel is a monolithic (modular) kernel. All the major "kernel" subsystems run in kernel space. Just because it has a bunch of "emulation services" running in userland between the apps and the kernel doesn't make it a hybrid. All the IO, device drivers, video, filesystems, memory management, yadda yadda yadda is running in kernel space.

Next you're going to call Windows 95 a hybrid since it can run 8-bit DOS programs, 16-bit Win16 programs, and 32-bit Win32 programs. :r

Shoot, you may as well classify the FreeBSD kernel as a hybrid as well, since it does the same thing with the Linux subsystem, the IBCS2 (SCO) subsystem, the AOUT subsystem, and the native FreeBSD subsystem, etc.
 
Part of kernel code of Windows 2008 runs in ring1 (Hyper-V). Windows 7 NT kernel runs some stuff split between ring0 and ring3 (sound subsystem).

It would be more beneficial to keep the monolithic architecture, but segmented between ring0, 1 and 2. FreeBSD can already run parts of kernel services in ring3, like FUSE which provides user-mode filesystems implemented through kernel ring0 container subsystem.
 
EU funds research on lightweight said:
Minix started as a research project funded by Google during one of its Summer of Code programs. Minix 3 runs on computers with Pentium 386 or 486 processors and 16MB or RAM, and a minimum or 50MB disk space. Minix is licensed under the Berkeley Software Distribution (BSD) license.

Someone needs to do their homework.
 
sossego said:
Someone needs to do their homework.

Probably supposed to be "Minix 3 started as a research project funded by Google..." They do mention that Minix started in 1987 earlier in the article.
 
randux said:
I don't know about you guys, but $3.30 will get me to write about half a line of code :p

Was that supposed to be thousands, millions, etc? :e
My bad, it supposed to be $3.3 million ;)
 
Zare said:
Part of kernel code of Windows 2008 runs in ring1 (Hyper-V). Windows 7 NT kernel runs some stuff split between ring0 and ring3 (sound subsystem).

It would be more beneficial to keep the monolithic architecture, but segmented between ring0, 1 and 2. FreeBSD can already run parts of kernel services in ring3, like FUSE which provides user-mode filesystems implemented through kernel ring0 container subsystem.

Is this "ring" concept supported outside of x86/amd64? Last time I checked my PPC/MIPS/HPPA/Sparc/... docs I did not come across that concept. Nailing down the kernel on one architecture would be a Bad Idea IMHO.
 
SirDice said:
They do, but it's not called rings but cpu modes. Most modern processors support this concept.

http://en.wikipedia.org/wiki/CPU_modes
Sorry, I am also some kind of fossil. When I was young, CPUs could only afford two modes, when they were lucky ;)
The usage of user mode and system/supervisor/kernel/whatevermode is not the point I wanted to make. The point was that depending on more than these two modes being available is a problem. I am used to call it the user mode or kernel mode, not ring.
But it would be possible to have more levels with a little trick (see here) using part of the PC as the ring number. So it seems to be possible to emulate more than one level without too much trouble, but when it comes to areas with this kind of stability reqirements, I am dead conservative.
 
Crivens said:
The usage of user mode and system/supervisor/kernel/whatevermode is not the point I wanted to make. The point was that depending on more than these two modes being available is a problem. I am used to call it the user mode or kernel mode, not ring.
For this same reason most operating systems only use ring0 and ring3 on i386. Even Windows.
 
My two points about this discussion:
  1. "hybrid kernel" is just market speak for "we wanted to use a microkernel but couldn't get it right, so we changed it"
  2. There is a reason why the only microkernel OS with a certain commercial success (QNX) didn't take off; it is past its heyday in the real world today (QNX was great when all machines had limited memory - 4, 8 or 64 MB and you could load only the drivers you needed for that particular server)
Oh, and I believe FreeBSD will change when it needs to (it has been doing so for a long time already). So far the changes have been good (i.e. concepts or ideas with real value) or needed (for some time at least - I'm thinking about HAL here).
 
Back
Top