Quote:
Memory protection
Windows NT prevents user applications from interfering with NT’s core operating system services (known collectively as the Windows NT Executive) by running these services in a protected layer called Kernel Mode. To understand how and why NT’s Kernel Mode is protected under NT’s design, we must first understand a little about the “ring” protection model used in modern processor design. In the ring architecture model, a CPU (Central Processing Unit) defines different levels or “rings” of execution, each with its own level of privilege and protection. Both Intel and RISC-based processor designs support this design, with RISC-based CPUs supporting two rings, and Intel-based CPUs supporting four. To effectively support both RISC and Intel CPUs, Windows NT uses only two rings in its design, Rings 0 and 3. Of these, Ring 0 (also known as supervisor mode) is the most highly protected ring in which an application or service can run. It is physically impossible for applications running in Ring 3 to interfere with those running in Ring 0.
As we examine Windows NT’s architecture more closely, we see that NT’s Kernel Mode and its services operate in the processor’s Ring 0, whereas user applications (running in NT’s User Mode) run in the processor’s Ring 3. This is what prevents user applications from interfering with core NT operating system services. Instead, these applications are forced to communicate with NT’s low-level services using a message-passing methodology: no direct physical access of the memory space used by these services is allowed. This design makes it virtually impossible for user applications to violate the integrity of the operating system. Although this method of communication between processes provides an enormous increase in overall system reliability, it also incurs some performance penalties due to the overhead of the continual message passing between User and Kernel modes. Each transition from one mode to the other requires a processor context-switch, which in turn burns additional CPU cycles.