Why do some people prefer micro-kernels? How does the kernel structure affect users/devs anyway?
it affects how devs program against the systemit affects users in how security is realized
Have you ever eaten a bag of popcorn?On the next day, you'll usually end up shitting a bunch of lil pop corn kernels (perfectly cooked and all, but just not popped).Same thing happens with kernels and OSes. All OSes pop out of a kernel, but you rarely notice the kernel running everything behind the scenes until shit goes down.
Autists prefer microkernels, and software engineering has always been full of autists. Which is why, since the inception of UNIX and beyond, we always have had kernels with microkernel APIs that "do one thing, and do it well".What autists ignore is that there is a price to pay for every interaction with the kernel. On x64 you have to save user state, switch to ring 0, restore kernel state, copy data from user to kernel (to avoid tampering), then validate data, and *then* do whatever it is you want the kernel to do. But telling the kernel to open a bunch of files, mmap them all into the address space, and close the handles again, all in one ring switch? Impossible.And that's why NT, Linux, and BSD are all legacy, even if they refuse to admit it.
>>107780108If you are loading a bunch of files into memory, the overhead you are describing for system calls is negligible
>>107780198Question: how do normal SSDs differ from NVMes?
>>107780108That's why Windows does windowing and graphics in the kernel. Because if it was a user-space process you double the amount of context switches needed to get anything done. In fact, in NT 3.x the graphics was a user-space process just like the X Server on Linux. But in NT 4.0 it was moved to the kernel.It is definitely a bad architecture from a security point of view, but from the performance PoV it was the right choice.Not that it matters nowadays when they are adding Javascript to the UI. All the effort was wasted.
>>107780279And yet they didn't come up with the idea of batch submissions when NT featured so much else. It would take *until Vulkan* for something similar (command buffers).
>>107780279Is that why XP was so responsive? It's like it acted before I even clicked
>>107780526More likely that they simply had less userspace garbage attached to it. Retrieving and dispatching messages to a window still takes a bunch of mode switches to this day.
>>107777992The microkernel idea is that drivers and other parts of the system that are usually part of the kernel are just regular programs and everything should only have access to the parts of the hardware that it needs. You can limit the permissions of what code does to the bare minimum of what it actually needs, which makes it easier to reduce bugs and makes the system more secure and reliable. Your GPU driver doesn't need to be able to access your entire disk or every process's memory or send information over the internet, just control the GPU.
>>107780939>everything should only have access to the parts of the hardware that it needsNow name hardware on which that is possible. In reality drivers and services all run in a lower-privilege ring and have to constantly switch to kernel level to do anything. At most you can map hardware registers to userspace, but DMA? Interrupts? Page tables themselves?
>>107777992Microkernels are easier to read and audit (there is a mathematical proof of seL4's correctness for example), more reliable and more secure than monokernels. They're mostly used in mission-critical systems where reliability is the top priority, but they also hold a certain appeal for freetards (GNU Hurd, Redox), and one made it into the Nintendo Switch somehow.
>>107782402>a microkernel that does almost nothing has no bugsYeah, good thing bugs in essential userspace drivers and services don't count.Right?
>>107783302Your point?
>>107783641A kernel without features is useless, and a kernel that depends on userspace for everything is slow unless there are no protection rings.
>>107777992>How does the kernel structure affect users/devs anyway?No fucking clue.
Basically you have a bunch of programs on your computer, we'll call them faggots.Then you have the general, we'll call him daddy.Daddy says which faggot is allowed to cum. Some faggots ask for more power. They say harder daddy.
>>107785706ha finally they're improving LLM examples i was getting tired of the library example.
>>107785239The Switch kernel depends on userspace for everything (including the Nvidia drivers), has protection rings, and is pretty fast.
>>107786369Compared to what? The monolithic kernel with a monolithic/batched API that doesn't exist? For decades I've heard that Linux was fast enough.Until NVMes and io_uring.
>>107780108>Which is why, since the inception of UNIX and beyond, we always have had kernels with microkernel APIs that "do one thing, and do it well".UNIX is brain damage and has nothing to do with microkernels or "do one thing, and do it well".>On x64 you have to save user state, switch to ring 0, restore kernel state, copy data from user to kernel (to avoid tampering), then validate data, and *then* do whatever it is you want the kernel to do.This isn't how it's supposed to work on x86. Read about how Intel intended the rings and segments to be used.>But telling the kernel to open a bunch of files, mmap them all into the address space, and close the handles again, all in one ring switch? Impossible.Better operating systems have everything in virtual memory all the time. That's actually how virtual memory was meant to be used.
>>107787742>UNIX is brain damage and has nothing to do with microkernelsYet Minix - which Linux copied its API from - was a microkernel, and proud of it.>Read about how Intel intended the rings and segments to be used.No one gives a fuck about Intel's *intentions*. The dumbasses intended kernels to be never able to go back to real mode until people simply reset the processor via keyboard controller or triple fault.>Better operating systems have everything in virtual memory all the time.Not only does that have absolutely nothing to do with batching requests - showing that you don't even understand the problem domain - but the page cache is also not DMA-able without gratuitous SGL setup. It's why libaio required you to disable the page cache for its files (because it's asynchronicity relied on DMA, not kernel threads).
>>107780526XP was responsive because the graphics system drew directly into the front buffer using hardware accelerated drawing commands. No buffering, no vsync, no compositing. The way the kernel was designed certainly helped, but really the main reason was the direct to front buffer rendering. X11 used to work like this as well.
>>107787924>Yet Minix - which Linux copied its API from - was a microkernel, and proud of it.Linux copied its API from UNIX. Microkernels don't even have anything about files or file systems. There is nothing about files or opening or closing in seL4 or MINIX.https://sel4.systems/Info/Docs/seL4-manual-latest.pdfhttps://wiki.minix3.org/doku.php?id=developersguide:kernelapi>No one gives a fuck about Intel's *intentions*.They're still using it wrong.>Not only does that have absolutely nothing to do with batching requests - showing that you don't even understand the problem domainIt means you don't have to open files or "mmap" anything ever.
>>107788158>Linux copied its API from UNIX.https://en.wikipedia.org/wiki/Linux>Torvalds initially resorted to determining system calls from SunOS documentation owned by the university for use in operating its Sun Microsystems server. He also learned some system calls from Tanenbaum's Minix text.>Torvalds began the development of the Linux kernel on Minix and applications written for Minix were also used on Linux.>They're still using it wrong.Cry more about it. No one gives a fuck about your singular opinion.>It means you don't have to open files or "mmap" anything ever.So how you grant access to these resources?
yall really dumb enough to believe your computers run on corn?
>>107780108MacOS has a micro kernel and it works well
>>107791206>>107787299
>>107791206Microkernels work for Apple, because they can target specific hardware.A monolithic kernel is better for broad, general purpose hardware support.
>>107792743>target specific hardwareLast I checked arm64 still has protection rings - they just call them "exception levels".