Monolithic
Programs lean on the kernel for many services: a file system, which turns file names into disk blocks, drivers, the code that talks to each device, plus scheduling and memory. The big design question is which of these run in kernel mode.
A monolithic kernel puts every service in kernel mode, as one big program. The file system and the drivers share its memory and call each other like ordinary functions. Linux and xv6 are built this way.
read() traps into the kernel: crossing 1. The file system works out which disk block holds the first 5 bytes of notes.txt and calls the disk driver directly. It is a plain function call: no crossing, no message.
The driver reads the block from the disk. The file system copies "hello" into buf, and return-from-trap takes the program back to user mode: crossing 2. read() returns 5. Two crossings in all.
Now give the driver a bug: a bad pointer, an address aimed at the wrong memory. It runs in kernel mode, so nothing stops it from wrecking kernel memory. The whole kernel fails, every program stops with it, and the computer must reboot.
Microkernel
A microkernel keeps only what truly needs kernel mode: scheduling, memory and passing messages. The file system and the driver move out to user mode and run as ordinary processes, called servers.
Now read() sends a message. The program traps into the kernel (crossing 1). The kernel copies the message to the file server and switches to it, back in user mode (crossing 2).
The file server finds the disk block, but it cannot call the driver directly: the driver is another process. So it sends a second message through the kernel (crossings 3 and 4). The driver reads the block from the disk.
The bytes travel back as two reply messages, driver to file server and file server to program, each through the kernel. read() returns 5 again, but four messages made 8 crossings, against 2.
Give the driver the same bad pointer. It is a user-mode process now, so it can only damage its own memory. The kernel ends it; the kernel and every other program keep running. MINIX 3 then starts a fresh copy of the driver.
Choosing
Monolithic kernels are fast, because the parts call each other directly. Microkernels are small and keep failures apart, at the cost of more messages. Real systems mix both, and experts still argue which is better.
What happens
;; step 1/11 · services services the operating system provides: file system file names -> blocks on the disk disk driver code that knows how to work one device scheduling which program runs next memory who may use which memory kernel mode full control, no safety net user mode limited, must ask the kernel design question: how much runs in kernel mode?
The crossing counts are for this simple model: one read() and the user-mode/kernel-mode switches its messages need. They leave out the disk interrupt and how a user-mode driver reaches its device, which differs between systems. Many systems sit in between. Linux is monolithic but loads drivers as modules at run time, straight into kernel space (init_module). Some microkernel systems run a few servers in kernel mode for speed.