the mode bit
The mode bit is a tiny piece of state inside the CPU — conceptually a single bit — that records which mode the processor is in right now: user (often written as 1) or kernel (often written as 0). It is the hardware's answer to a deceptively simple question that must have an instant, trustworthy answer millions of times a second: is the currently running code allowed to do privileged things? Like a wristband at an event that says staff or guest, it is checked at the door of every restricted action.
The bit lives in a special processor register and is consulted by the hardware on every attempt to execute a privileged instruction. If the bit says kernel, the instruction proceeds; if it says user, the hardware refuses and traps to the OS. Crucially, ordinary user code cannot simply set the bit to kernel — that would defeat the entire protection scheme. The bit changes only through controlled hardware events: it flips to kernel automatically when a trap, interrupt, or system call enters the OS, and the kernel flips it back to user (by executing a special return-from-trap instruction) when it hands control back to a program. Some architectures track more than two levels, so the same idea appears as a small current-privilege-level field rather than a literal single bit.
This humble bit is what makes dual-mode operation actually work — without a hardware-protected indicator of the current privilege, none of the user/kernel separation could be enforced. It is the linchpin: every privilege check, every trap, every system call ultimately consults it. And because it can only be changed by the hardware on a controlled entry to the kernel, a user program can never just promote itself to full power, which is precisely the property a secure OS depends on.
On a system call, the trap instruction atomically switches the mode bit from user to kernel as it jumps into the kernel. When the kernel finishes and executes its return instruction, the bit flips back to user — so the program resumes exactly as restricted as before.
One bit, changed only by controlled entries and exits, gates all privilege.
The mode bit must be changeable only by hardware on a trap/interrupt/system-call, never by a plain user instruction. If a user program could write it directly, the entire protection model would collapse.