Windows OS Architecture Explained: User Mode, Kernel Mode and a Worked I/O Trace

Build a reliable Windows architecture model, then trace one file read across protection modes and calculate its virtual pages, physical endpoints and file blocks.

KnowledgeGate Team

Exam prep & CS education

Updated 21 Nov 20266 min read
Windows OS Architecture Explained: User Mode, Kernel Mode and a Worked I/O Trace

Windows architecture diagrams mix applications, services, subsystem DLLs, the executive, kernel, drivers and hardware, so boundary and responsibility questions become easy to misread. The broader Windows Operating System: Architecture, Processes, Memory and Worked Examples connects processes, services, scheduling, memory and security within the CS Fundamentals path. PhotoIndex.exe supplies the narrower trace: PID 4240, TID 91, handle 0x74, and an 8,192-byte read at virtual address 0x00001003. With 4 KiB units, its unaligned buffer touches three virtual pages while its aligned file range covers two blocks.

Read Windows architecture as two modes and cooperating layers

Read the diagram from top to bottom:

user applications and user-mode services -> Windows API and subsystem support -> protected system-service boundary -> executive managers and kernel -> device drivers and HAL -> hardware

Microsoft Learn's User Mode and Kernel Mode says applications run in restricted user mode. Core components run in kernel mode, where faulty code can affect the whole system. Some drivers run in user mode, so “all drivers are kernel-mode” is too absolute.

Microsoft Learn's Overview of Windows Components, executive library and debugger glossary separate the responsibilities. Executive managers provide higher-level object, security, memory, process, thread and I/O services. The kernel handles scheduling, interrupts, exceptions and multiprocessor synchronisation. The HAL hides platform-specific hardware details. “Hybrid kernel” is shorthand, not a substitute for these names. A layer marks responsibility, not necessarily a separate process.

Windows architecture stack showing user mode above kernel mode, with APIs, executive, kernel, drivers, HAL, hardware, and I/O completion.

Keep process, thread, virtual address and handle separate

Microsoft Learn's About Processes and Threads defines a process as the owner of a private virtual address space, code, handles and security context. A thread is its schedulable execution unit. Threads share process resources but retain their own stacks and execution contexts.

Here, PID 4240 identifies PhotoIndex.exe; TID 91 identifies its caller; 0x00001003 is a virtual address interpreted through that process's mappings; and 0x74 is a handle-table entry, not a pointer or disk address. A validated handle refers to a managed object with access context. Closing or duplicating it changes a process reference, not the file.

Trace I/O as a controlled path, not a jump to disk

TID 91 calls the Windows API, crosses the protected boundary, and has its handle and access checked. I/O and file-system work follows. Cache, driver and hardware work occurs as needed before completion returns to user mode. The exact steps can differ between Windows versions.

Object and security services validate 0x74 and its access. Memory services handle the buffer. I/O services coordinate request and completion. The file system interprets the offset. If TID 91 waits, the scheduler can run another thread.

Three distinctions prevent common errors:

  • A mode switch need not switch processes. The same thread may enter kernel mode and return.

  • A handle is not a filename, pointer or physical sector.

  • API success does not prove hardware I/O, because a cache may satisfy the read.

Do not assume every read pins pages or reaches a disk.

Worked example: three memory pages, two file blocks

Assume fictional data: page size 4 KiB = 4,096 bytes = 0x1000; three present, writable, permitted user pages; buffer start 0x00001003; length 8,192 = 0x2000; file offset 12,288 = 0x3000; and 4 KiB file blocks.

The inclusive final buffer address is:

0x1003 + 0x2000 - 1 = 0x3002

Split the buffer by page:

  • Page 0x1000-0x1FFF: 0x1000 - 0x0003 = 0x0FFD = 4,093 bytes.

  • Page 0x2000-0x2FFF: 4,096 bytes.

  • Page 0x3000-0x3FFF: the final 3 bytes, at 0x3000-0x3002.

Check: 4,093 + 4,096 + 3 = 8,192, so three virtual pages are touched.

Use invented mappings VPN 0x1 -> PFN 0x21, VPN 0x2 -> PFN 0x44, and VPN 0x3 -> PFN 0x2A. The first byte maps to 0x21000 + 0x003 = 0x21003; the last to 0x2A000 + 0x002 = 0x2A002. Microsoft Learn's Virtual Address Space supplies the model. The separated frames prove that virtual contiguity need not mean physical contiguity.

Separately, offset 0x3000 and length 0x2000 give inclusive range 0x3000-0x4FFF: blocks 3 and 4. Pages and file blocks remain different abstractions even when both are 4 KiB.

Split diagram maps an 8,192-byte buffer across three virtual pages and physical frames, then contrasts it with two 4,096-byte file blocks.

Divide work among executive, kernel, drivers and HAL

These Windows-specific names follow Microsoft Learn. One request can involve several components with distinct jobs.

Component

Stable responsibility

Role in the worked trace

Common wrong answer

Object Manager

Managed objects and handles

Resolves 0x74

Handle is a pointer

Security checks

Access decisions

Checks read permission

Driver owns all policy

Memory Manager

Virtual memory

Interprets pages covering 0x1003-0x3002

Virtual page is a frame

I/O Manager

Request and completion coordination

Coordinates 8,192 bytes

It is the file system

Process/Thread Manager

Process and thread lifecycle

Tracks PID 4240, TID 91

Thread equals process

Kernel

Scheduling, interrupts, exceptions

Can schedule another thread while TID 91 waits

Kernel equals the whole OS

File-system or device driver

File or device-facing behaviour

Interprets 0x3000-0x4FFF or serves the device path

Driver decides all security

HAL

Platform-specific hardware abstraction

Connects kernel-facing work to the platform

HAL is an application API

The executive is not a user application. The HAL does not erase every hardware difference.

Understand the architecture trade-offs

If PhotoIndex.exe dereferences an invalid user address, Windows can normally fault that process without allowing access to another process's private memory. User-mode failures are not harmless, but their privilege and failure scope are constrained. A kernel-mode driver corrupting shared memory may affect the whole system.

User mode improves isolation; kernel mode permits protected-resource and hardware coordination. Moving all work to either side changes protection, performance and compatibility. Drivers provide device behaviour, while the HAL separates core components from platform details. Layering improves portability but has limits and overhead.

Practise trace, classify, calculate and reject traps

Questions can ask you to label components by mode, separate executive from kernel and HAL, distinguish process from thread, trace I/O, calculate unaligned pages, or match a manager to a job.

Try these before reading the answers:

  1. Is 0x74 a disk address?

  2. Must a user-to-kernel transition change PID?

  3. How many 4 KiB pages contain 8,192 bytes from 0x1003?

  4. Which physical addresses hold the first and final bytes?

  5. How many 4 KiB file blocks cover offset 0x3000 for length 0x2000?

Answers: (1) No, it is the invented process-local handle. (2) No. (3) Three. (4) 0x21003 and 0x2A002. (5) Two.

Reject these traps: kernel is not the entire OS; executive is not kernel; mode switch is not context switch; thread is not process; handle is not pointer; page is not frame or file block; API completion does not prove disk access; and drivers need not all be kernel-mode. Use OS Basics MCQs for adjacent practice.

Windows architecture in the short version

  • Applications and many services run with user-mode restrictions.

  • Protected system services lead to kernel-mode components.

  • Executive managers provide higher-level OS services.

  • The kernel handles lower-level scheduling and interrupts.

  • Drivers and HAL connect the OS to hardware.

  • Processes own resources, threads execute, and handles refer to managed objects.

Without looking back, use VA 0x1003, length 0x2000, page size 0x1000, mappings 0x1->0x21, 0x2->0x44, 0x3->0x2A, and file offset 0x3000 to recover three pages, endpoints 0x21003 and 0x2A002, and two blocks ending at 0x4FFF.

Use ZERO TO HERO for a semester-oriented CS route or CS Fundamentals for Placements by Sanchit Sir for placement-oriented revision. Redraw both figures and solve the drills before moving on.