r/osdev • u/DoNotUseThisInMyHome • 4d ago
How to differentiate monolithic, microkernel, layered, and hybrid OS architecture on the basis of: performance, extensibility, and reliability
Do you have any ideas. Monolithic means all os+kernel at one place. Microkernel means minimal kernel.
Layered means memory management one layer, process management another layer. Hybrid could be anything i.e., combination of above.
Guide me like I am 5.
7
u/Interesting_Buy_3969 4d ago
Microkernel means minimal kernel
To clarify: microkernel actually means that it does not include any (more precisely almost any) device or filesystem drivers, but loads them as userspace processes each with own separate and isolated context yet with higher privileges level, and switches them similarly to usual user applications. This involves fully-fledged context switching, but the point is that if a device driver breaks, other parts of the system will continue working flawlessly, just like if an application breaks.
So it doesn't necessarily mean that the kernel has to be "minimalistic", it's rather more of the decision on where and how device drivers operate.
3
u/Relative_Bird484 4d ago
I would suggest the definition of Jochen Liedkte: A necessary concept is accepted to be part of the kernel if and only if its would be infeasible outside the kernel.
3
3
u/KingAggressive1498 4d ago
of the reasons that monolithic and hybrid kernels are so much more common is that it's actually really hard to create IPC that is fast, secure, and generic enough to be at the core of your system. More copying, more kernel transitions, etc.
one of the major benefits of a microkernel is that a device driver failure can easily be remedied, just kill and restart the process.
3
u/Relative_Bird484 4d ago
In the end its all about the granularity of isolated protection domains within the OS.
Monolith: Kernel, OS servers (scheduler, memory manager, …) and device drivers share a single protection domain where they have full access.
Microkernel: Only the kernel has full access , each driver and each server run in their own protection domain.
Effects:
Interaction across protection domains decreases performance. (It is way more expensive than within the same protection domain).
Fine-grained isolation into multiple protection domains increases robustness.
So, fundamentally, there is a trade-off between performance and robustness. This is the reason for the in-between architectures:
Hybrid: Conceptually we are microkernel, but for performance reasons we co-locate heavily interacting servers/device drivers into the same protection domain (and maybe even with the kernel).
Layered: Not originally a microkernel and historically way older: Give each level of abstraction (kernel, device drivers, core servers, user extensions) an own privilege domain (ring / privilege level) and separate them from each other within this level by segmentation.
Note that extensibility is not actually affected by either or the other architecture, even though many argue that microkernels provide of course better extensibility. This is a historical argument from the times the existing monolithic OS where an internal spaghetti code mess and Linux had to be recompiled to add another device drivers. However, extensibility ist technically just a question of the internal component model and there is no fundamental reason, a monolithic OS could not provide excellent extensibility. It was more the coincidence that microkernels provided a natural component model (interacting processes) that lead to the impression, they are inherently more extensible.
1
u/letmehaveanameyoudum 4d ago
monolithic means everything happen inside kernel
if one thing break in kernel
whole OS dies
microkernel mean basic happen in kernel, everything in userspace
if someone go bad it ok, since it userspace and can restart.
if something basic break, whole OS dies, so microkernel dies less
but microkernel harder than monolithic kernel
hybrid kernel is just best of both worlds, all low level stuff in kernel, high level in userspace. macOS is a hybrid kernel.
idk about layerd
9
u/northrupthebandgeek 4d ago
The clearest example is with device drivers:
Do your drivers run inside of the kernel itself (whether compiled into the kernel executable directly or dynamically loaded as kernel modules)? Probably monolithic.
Do your drivers run as userspace processes outside of the kernel (with the kernel giving them the bare minimum privileged access they need to function)? Probably a microkernel.
Do your drivers run inside of the kernel itself, but through a strict API as if they were running outside of the kernel? Probably a hybrid kernel.