Every few milliseconds, a hardware timer interrupts the CPU. The kernel seizes control, pauses the current process, saves its registers, looks at its list of ready processes, picks the next one, and restores its state. This is called a context switch, and it happens thousands of times per second. The kernel is a time lord, chopping the continuous flow of the clock into discrete slices and distributing them with ruthless fairness (or deliberate priority).
The kernel, with the help of the CPU’s Memory Management Unit (MMU), maintains page tables. These are maps that translate a process’s fake “virtual address” into a real “physical address.” When a process touches a memory location that isn’t mapped— page fault —the kernel wakes up. It might load data from disk (swap), allocate a new physical page, or, if the access was illegal, kill the process with the infamous SIGSEGV (Segmentation Fault).
Hardware is asynchronous. The disk finishes reading. The network card receives a packet. The keyboard is pressed. The kernel must respond to these events in microseconds. what is os kernel
When you call open() , read() , write() , fork() , you are not performing an action. You are making a to the sovereign circuit. And the kernel, if it is in a good mood, will grant it.
The CPU does not know what a “file” is. It does not know what a “network socket” is. It does not know that you have a right to privacy, that two programs shouldn’t write to the same memory location, or that time should be shared fairly among a hundred running tasks. The CPU is a breathtakingly fast idiot, capable only of fetching an instruction, decoding it, executing it, and moving to the next address. Every few milliseconds, a hardware timer interrupts the CPU
The kernel’s most radical act is the invention of concurrency . On a machine with a single core, only one instruction can run at a time. Yet you can listen to music, type a document, and download a file simultaneously. This is a hallucination, induced by the kernel’s scheduler.
To truly understand the kernel, you must abandon the perspective of the user or even the application developer. Instead, you must adopt the perspective of the . The kernel is a time lord, chopping the
The kernel is not really software. It is a .