Skip to main content
Be Bitwise

Windows NT Architecture

The Windows Architecture Deep Dive · Windows Programming track

7 min read

In this module

The Design of Windows NT

Windows NT was designed from scratch in the late 1980s by a team led by Dave Cutler — who had previously built VMS at DEC. The goals were portability, security, and extensibility, and those ambitions still visibly shape modern Windows. If you're doing low-level Windows programming, driver development, or security research, this architecture is the bedrock you're standing on.

The Layered Architecture

Windows NT uses a layered design where each layer provides services to the layer above:

The Hardware Abstraction Layer (HAL)

The HAL (hal.dll) is the lowest software layer, sitting directly above the hardware. It provides a consistent interface for:

  • Interrupt controllers: Abstracting APIC, PIC, and other interrupt hardware
  • Timers: Providing consistent time sources across different hardware
  • DMA controllers: Managing direct memory access
  • Processor-specific operations: Cache flushing, TLB management
  • Bus interfaces: PCI, ACPI hardware access

The HAL allows the same Windows kernel binary to run on machines with different hardware configurations. When the kernel needs to access hardware-specific resources, it calls HAL functions rather than touching hardware directly.

Hardware Abstraction Layer

The HAL isolates the kernel from hardware-specific details. This was critical in the early days of Windows NT when it ran on multiple processor architectures (x86, Alpha, MIPS, PowerPC). Today, it primarily abstracts differences between motherboard designs, ACPI implementations, and interrupt controller configurations on x86/x64 and ARM platforms.

The Kernel Layer

The kernel (ntoskrnl.exe, specifically the Ke* functions) is a small, non-pageable component that provides fundamental mechanisms:

Thread Scheduling

The kernel's dispatcher maintains a ready queue of threads organised by priority (0-31). It implements:

  • Preemptive scheduling: Higher-priority threads preempt lower-priority ones
  • Quantum management: Each thread gets a time slice (quantum) before being preempted
  • Processor affinity: Threads can be bound to specific CPUs
  • Ideal processor: The scheduler tracks which processor a thread ran on most recently to maximise cache hits

Synchronisation Primitives

The kernel provides low-level synchronisation objects:

  • Spinlocks: For short critical sections at high IRQL (busy-wait)
  • Dispatcher objects: Events, mutexes, semaphores, timers (can block)
  • Executive resources: Reader-writer locks for longer critical sections
  • Fast mutexes: Optimised mutexes that avoid the dispatcher overhead for the uncontended case

Interrupt and Exception Dispatching

The kernel manages the Interrupt Request Level (IRQL) system:

text
IRQL Levels (simplified):
┌──────────────────────────────────┐
│ HIGH_LEVEL (31) - Machine check│
│ POWER_LEVEL (30) │
│ IPI_LEVEL (29) - Inter-processor│
│ CLOCK_LEVEL (28) - Clock tick │
│ DEVICE IRQL (3-26) - Device ints │
│ DISPATCH_LEVEL (2) - Scheduler │
│ APC_LEVEL (1) - Async proc call│
│ PASSIVE_LEVEL (0) - Normal thread │
└──────────────────────────────────┘

Note: These values are for x86. On x64, the range is 0-15 (e.g., HIGH_LEVEL=15, CLOCK_LEVEL=13, IPI_LEVEL=14).

Code running at a higher IRQL cannot be interrupted by code at a lower IRQL. This hierarchy prevents deadlocks and ensures that critical operations complete without interference.

The Executive Layer

The executive provides the high-level kernel services that implement the Windows API. Each executive component is a collection of functions prefixed with a two-letter abbreviation:

Object Manager (Ob*)

Manages all kernel objects and their namespace. Provides:

  • Object creation, deletion, and reference counting
  • Handle table management
  • Object namespace (\Device\, \BaseNamedObjects\, etc.)
  • Security descriptor attachment

I/O Manager (Io*)

Manages all input/output operations:

  • Device driver loading and management
  • I/O Request Packets (IRPs): The fundamental I/O data structure
  • I/O completion ports
  • Plug and Play integration
  • File system mounting and management
text
Application → CreateFile("C:\file.txt")
│
▼
ntdll.dll → NtCreateFile()
│
▼
I/O Manager:
1. Parse path: \??\C:\file.txt → \Device\HarddiskVolume1\file.txt
2. Create IRP (I/O Request Packet)
3. Send IRP to file system driver (ntfs.sys)
4. ntfs.sys sends IRP to volume manager
5. Volume manager sends IRP to disk driver
6. Disk driver programs hardware
7. Results flow back up the driver stack

Memory Manager (Mm*)

Handles all virtual memory operations:

  • Page table management
  • Working set management (which pages stay in physical RAM)
  • Page fault handling
  • Section objects (memory-mapped files)
  • Modified and standby page lists
  • Memory compression (Windows 10+)

Process Manager (Ps*)

Manages processes and threads:

  • Process and thread creation/termination
  • Job objects (resource limits for groups of processes)
  • Thread context management
  • Image section mapping

Security Reference Monitor (Se*)

Enforces security at the kernel level:

  • Access token validation
  • ACL (Access Control List) checking
  • Privilege management
  • Audit event generation

Every time a process opens a kernel object, the SRM compares the process's access token against the object's DACL to determine if the requested access should be granted.

Key Concept
I/O Request Packets (IRPs)

IRPs are the fundamental data structure for I/O in Windows. When an application performs any I/O operation (file read, network send, device control), the I/O Manager creates an IRP containing the request details and passes it through a stack of drivers. Each driver can process, modify, or pass the IRP to the next driver. This layered IRP model is the foundation of the entire Windows driver architecture.

Plug and Play Manager (Pnp*)

Manages device enumeration and configuration:

  • Device detection and enumeration
  • Driver loading for detected devices
  • Resource allocation (IRQs, memory ranges, I/O ports)
  • Power management integration

Critical System Processes

Several user-mode processes are essential to Windows operation:

SMSS (Session Manager Subsystem)

smss.exe is the first user-mode process created during boot:

  1. Creates the Windows object namespace
  2. Starts the Windows subsystem (win32k.sys, csrss.exe)
  3. Creates initial environment variables
  4. Launches the initial logon session

CSRSS (Client/Server Runtime Subsystem)

csrss.exe handles Win32 subsystem tasks that run in user mode:

  • Console window management
  • Thread creation and deletion tracking
  • Process shutdown ordering
  • Certain DLL mapping operations

CSRSS is genuinely critical — if it terminates, Windows blue-screens on the spot. There is one CSRSS per logon session.

Winlogon and LSASS

  • Winlogon (winlogon.exe): Manages interactive logon sessions, handles Ctrl+Alt+Del (Secure Attention Sequence), and launches the user's shell (explorer.exe)
  • LSASS (lsass.exe): Local Security Authority Subsystem Service. Handles authentication (validating passwords), generates access tokens, and manages security policy. LSASS is a prime target for credential-stealing attacks (e.g., Mimikatz extracts passwords from LSASS memory)

The Subsystem Architecture

Windows NT was designed to support multiple operating system personalities through environment subsystems:

In practice, the Win32 subsystem dominates. The POSIX subsystem was removed in Windows 8.1. Windows Subsystem for Linux (WSL) takes a different approach - WSL 1 translated Linux syscalls to NT equivalents, while WSL 2 runs an actual Linux kernel in a lightweight VM.

The NT architecture underlies all Windows systems programming. Every API call, every driver interaction, every security decision flows through these layers — and understanding that flow is what separates guessing from knowing.