1. Gyanastra
  2. Operating Systems
  3. UGC NET: Windows Operating System
  4. Windows File System Memory and Registry
Free lesson, no account needed 16 min read 21 practice questions after it
Asked in past papers4 times
  • UGC NET2014201320122006

Operating Systems · UGC NET: Windows Operating System

Windows File System Memory and Registry

Overview

Windows NT-family systems (Windows NT, 2000, XP, Vista, 7, 8, 10, 11) rest on three mechanisms that this topic examines: the on-disk file system, the virtual memory subsystem, and the registry configuration database.
The file system decides how data and metadata are stored, secured and recovered; memory management decides how virtual addresses map to physical frames and to the paging file; the registry centralises what INI files once held.
The notes use the Windows NT/2000/XP architecture as the reference model because most exam framing is based on it; later versions extend these mechanisms without contradicting them.
You should already know basic paging, file allocation and access-control lists before reading further.

Key concepts

File systems

  • FAT (File Allocation Table): allocation by a table of cluster chains.
    FAT12 (floppies), FAT16 (volume up to 2 GiB as formatted by Windows, file up to 2 GiB), FAT32 (addresses up to 2 TiB, but the Windows 2000/XP/Vista formatter creates at most 32 GiB; maximum file 4 GiB − 1 byte).
    No permissions, no journaling, no compression, no encryption; long names only through VFAT.
  • NTFS (New Technology File System): introduced with Windows NT 3.1 and native to every NT-family Windows.
    It provides journaling, per-object ACLs, per-file compression, EFS (Encrypting File System) encryption, quotas, sparse files, hard links, mount points, alternate data streams, and Unicode names of up to 255 characters.
  • Windows XP and Windows Vista read and write FAT16, FAT32 and NTFS, so a "which file system do they use" question is answered by "all of the above".
  • Disk Management (backed by the Logical Disk Manager) in Windows Vista added built-in shrinking and extending of existing volumes; earlier consumer and NT systems could not shrink a basic volume from the graphical tool.
    Basic disks allow at most four primary partitions under MBR; GPT removes that limit and the 2 TiB disk barrier.

NTFS on-disk structure

  • Master File Table ($MFT): itself a file, an array of file records, normally 1 KiB each, one record per file or directory. Everything is an attribute — $STANDARD_INFORMATION, $FILE_NAME, $DATA, $SECURITY_DESCRIPTOR, $INDEX_ROOT, $INDEX_ALLOCATION, $ATTRIBUTE_LIST. Small attributes are resident inside the record; large ones are non-resident and stored in clusters described by data runs.
  • The first 16 MFT records are reserved system metadata files:
RecordFilePurpose
0$MFTthe Master File Table itself
1$MFTMirrmirror of the first few MFT records
2$LogFilemetadata transaction journal
3$Volumevolume label, NTFS version, dirty flag, serial number
4$AttrDefattribute definitions
5.root directory
6$Bitmapone bit per cluster; 1 means allocated
7$Bootboot sector and bootstrap code
8$BadClussparse file listing clusters known to be bad
9$Securesecurity descriptors shared by many files
10$UpCaseuppercase table used for Unicode comparisons
11$Extenddirectory for $Quota, $ObjId, $Reparse and $UsnJrnl
  • Directories are B+ tree indexes on the file name: a small directory keeps the index in $INDEX_ROOT inside its MFT record, a large one adds $INDEX_ALLOCATION index buffers.
  • Journaling: NTFS writes intended metadata changes to LogFile∗∗beforecommittingthem;afteracrashitreplayscommittedandundoesuncommittedtransactionsatmounttime.Thisgives∗∗metadataconsistency∗∗,notuser−dataintegrity.Theseparate∗∗LogFile** before committing them; after a crash it replays committed and undoes uncommitted transactions at mount time. This gives **metadata consistency**, not user-data integrity. The separate **UsnJrnl change journal merely records that files changed, for backup and indexing, and keeps no old contents.
  • Permissions: each file's security descriptor (with a DACL) is kept mainly in $Secure and referenced by a security ID; rights can name individual users and groups and are inherited from parent directories.
  • Compression is transparent, per file or per folder, and applied in units of 16 clusters with FILE_ATTRIBUTE_COMPRESSED set.
  • Encryption is per file or per folder through EFS with FILE_ATTRIBUTE_ENCRYPTED set. A file cannot be both compressed and encrypted at once; copying an encrypted file to a FAT volume fails because FAT has no EFS.

Windows memory management

  • The Virtual Memory Manager (VMM), part of the executive, owns each process's virtual address space, maps virtual pages to frames or to the paging file (pagefile.sys), and implements demand paging with 4 KiB pages on x86/x64.
  • 32-bit Windows gives each process 4 GiB, split by default into 2 GiB user / 2 GiB kernel (the /3GB switch gives 3 GiB/1 GiB on editions that support it).
    On 64-bit Windows, a 32-bit WOW64 process still gets its own 4 GiB address space however large the RAM is.
  • Working set = pages currently resident for a process.
    A page fault means a reference to a page not in the working set, and is a normal event.
    A soft fault finds the page still in RAM (standby or transition list) and needs no disk I/O; a hard fault reads it from the pagefile or a mapped file.
  • Frame states are kept on lists: active/valid (in working sets), standby (clean, still valid, trimmed out), modified (dirty, must be written before reuse), free (contents undefined), zero (pre-zeroed, ready to hand out).
  • Kernel memory is split into paged pool (pageable) and nonpaged pool (never paged out).
  • Hibernate (ACPI state S4) copies RAM to hiberfil.sys and powers off; on resume the session returns exactly as left, and no application is closed. Sleep (S3) keeps RAM powered; hybrid sleep does both.
  • The VMM is not portable: page tables, context-switch code and address translation are processor-specific. The HAL hides bus and interrupt-controller details, but the kernel and VMM still carry architecture-dependent code.

Windows NT architecture layers

  • HAL (Hardware Abstraction Layer): lowest software layer; hides processor and bus differences, programs DMA and the interrupt controller.
  • Kernel: thread scheduling and dispatching, interrupt and exception handling, multiprocessor synchronisation, dispatcher objects (mutex, event, semaphore).
  • Executive: object manager, VMM, I/O manager, cache manager, process manager, security reference monitor, power and Plug-and-Play managers, configuration manager (which implements the registry).
  • Environment subsystems (user mode): Win32/WOW64, POSIX — start processes, emulate other operating systems, and convert character-based applications into graphical output.

Registry

  • The Registry is a hierarchical configuration database of hives (files), keys (like folders), subkeys, and values (name + type + data).
    It replaced the plain-text INI files (win.ini, system.ini, per-application .ini files with [sections] and key=value lines) of Windows 3.x and Windows 95.
  • Hive files: SYSTEM, SOFTWARE, SAM, SECURITY and DEFAULT under %SystemRoot%\System32\config, plus NTUSER.DAT (per user, mounted as HKCU) and UsrClass.dat.
Root keyContents
HKEY_LOCAL_MACHINE (HKLM)machine-wide hardware, drivers, services and installed software
HKEY_CURRENT_USER (HKCU)settings of the user currently logged on; a link into HKU
HKEY_CLASSES_ROOT (HKCR)merged view of HKLM\Software\Classes and HKCU\Software\Classes — file associations, COM registration
HKEY_USERS (HKU)all loaded user profiles, including .DEFAULT
HKEY_CURRENT_CONFIG (HKCC)current hardware profile, a view derived from HKLM
  • Value types: REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_DWORD, REG_QWORD, REG_BINARY. Strings are stored as UTF-16.
  • Windows' native "Unicode" is UTF-16: one wide character (WCHAR) is 16 bits. Win32 "W" APIs take UTF-16 strings; NTFS names and registry strings are UTF-16.
    Code points beyond U+FFFF use surrogate pairs of two 16-bit units.
  • Since Windows Vista the registry keeps transaction log⁡s\log s (.LOG1, .LOG2) so hive writes survive a crash; several users can stay signed in because each session keeps its own loaded hive, which is what makes fast user switching possible.

How it works

Opening a file on NTFS — access control and lookup sequence

  1. The application calls CreateFile; the call becomes an I/O request packet, and the object manager creates a file object.
  2. NTFS parses the path component by component; names are case-insensitive but case-preserving because $UpCase supplies the uppercase mapping.
  3. For each component it searches the directory's B+ tree index ($INDEX_ROOT, then $INDEX_ALLOCATION) to get the MFT record number.
  4. The MFT record is read and its attributes parsed; the $DATA stream is located — resident inside the record or non-resident through data runs.
  5. The security reference monitor fetches the security descriptor (through $Secure) and checks the caller's token against the DACL; a missing right yields ACCESS_DENIED.
  6. The object manager returns a handle. All further reads and writes use that handle, and because kernel resources are manipulated only through such objects, the NT kernel is often called object-oriented.
  7. Any metadata change is written to $LogFile before it is applied; user data changes are not journaled.

Resolving a memory reference

A hard fault takes its frame from the zero or free list when possible, otherwise from the standby list (clean, no write needed), otherwise from the modified list, whose page must first be written to backing storage.

Where the layers sit

Crash recovery with $LogFile: a log record describing the change is written and flushed; the change is applied to the MFT or $Bitmap; the record is marked committed. After a crash, committed-but-unapplied records are redone and uncommitted records are undone, so the volume mounts consistent without a full scan.

Registry loading: the kernel loads the SYSTEM hive early because it needs driver and service information, then SOFTWARE, SAM and SECURITY; HKCU is mounted when a user signs in and stays mounted for that session.

Figure. Notice that a present page proceeds, while an absent page faults; a standby/transition hit is a soft fault with no disk I/O, otherwise a hard fault reads from pagefile or mapped file, then the working set updates and instruction restarts.
Figure. Notice the order: user applications and environment subsystems sit above the executive, which includes VMM, I/O and object managers, cache, and security; below are the kernel, HAL, and hardware.

Formulas

  • Virtual address space of an nn-bit process: V=2nV = 2^{n} bytes; a 32-bit process has 2322^{32} B =4=4 GiB.
  • Number of pages: N=V/PN = V/P, where P=4096P=4096 B is the page size. For the full 32-bit space, N=232/212=220=1,048,576N=2^{32}/2^{12}=2^{20}=1{,}048{,}576; for the default 2 GiB user half, N=231/212=219=524,288N=2^{31}/2^{12}=2^{19}=524{,}288.
  • One page-table entry per mapped page is needed at the leaf level: entries =N=N (multi-level tables add the upper levels).
  • Volume size == clusters ×\times cluster size; FAT16 allows at most 65,52465{,}524 clusters, FAT32 at most 2282^{28} clusters.
  • MFT size ≈\approx (files ++ 16 system records) ×\times 1024 B, plus index buffers.

Worked examples

Example 1 — statement type (medium).
I. NTFS records intended metadata changes in a log before applying them, so a crash can leave the volume consistent without a full scan.
II. The NTFS change journal stores the previous contents of every user file so any edit can be rolled back.
(a) both true (b) I only (c) II only (d) neither.
Reasoning: I is the definition of NTFS journaling through $LogFile. II confuses $UsnJrnl, which only records that a file changed for backup tools, with a versioning system; NTFS journals metadata only and cannot roll back user data. Answer: (b) I only.

Example 2 — match the list (hard).
List-I: A. $Bitmap, B. $Boot, C. $BadClus, D. $Volume.
List-II: i. Boot sector and bootstrap code; ii. Cluster allocation map; iii. Volume label, version and dirty flag; iv. Clusters known to be bad.
Reasoning: by the reserved-record table, $Bitmap is the allocation map (A-ii), $Boot holds the boot sector (B-i), $BadClus lists bad clusters (C-iv), $Volume stores label, version and dirty flag (D-iii). Answer: A-ii, B-i, C-iv, D-iii.

Example 3 — registry (easy).
Which root key holds the desktop wallpaper and application preferences of the user signed in right now, and which root key is only a merged view rather than a hive of its own?
Reasoning: the signed-in user's settings live under HKEY_CURRENT_USER, a link to HKEY_USERS<SID>. HKEY_CLASSES_ROOT has no separate hive; the system builds it by merging HKLM\Software\Classes with HKCU\Software\Classes. Answer: HKCU for the user; HKCR is the merged view.

Example 4 — numeric (hard, two steps).
A 32-bit Windows machine has 4 GiB RAM and the default address-space split. (a) How many pages form one process's user-mode address space? (b) A process reads a variable whose page is on the standby list — how many disk reads does this cause?

  1. user space =2=2 GiB =231=2^{31} B, page =212=2^{12} B, so pages =231/212=219=524,288=2^{31}/2^{12}=2^{19}=524{,}288.
  2. a standby page is still in RAM and valid, so the access is a soft fault — the page returns to the working set with no disk read.
    Answer: 524,288 pages; 0 disk reads.

Example 5 — assertion and reason (hard).
A: A page fault does not by itself mean the program has a bug.
R: A reference to a page that has left the working set but is still in RAM is served as a soft fault with no I/O.
Reasoning: demand paging makes faults routine; only protection violations or references to unmapped addresses raise an access violation. R states exactly the mechanism that makes A true, so both statements are true and R explains A. Answer: both true, R is the correct explanation of A.

Comparison

PropertyFAT16FAT32NTFS
Maximum volume (Windows)2 GiB32 GiB as created by Windows; up to 2 TiB addressable256 TiB with 64 KiB clusters
Maximum file size2 GiB4 GiB − 1 byte16 TiB with 4 KiB clusters
JournalingNoNoYes, $LogFile
Per-file ACLsNoNoYes, DACLs in $Secure
Compression / encryptionNo / NoNo / NoYes / Yes
Unicode file namesNo, OEM plus long namesNo, OEM plus long namesYes, UTF-16
Page listContents validDirtyAction before reuse
Active/validyes, in a working setmay bemust be trimmed first
Standbyyes, still in RAMnoreuse at once, or soft-fault back
Modifiedyesyeswrite to backing store, then reuse
Freeundefinednot applicablemust be zeroed before allocation
Zerozeroednohanded out directly
FeatureSleep (S3)Hibernate (S4)Shut down
Power to RAMkeptremovedremoved
Where session livesRAMhiberfil.syslost
Applications closednonoyes

Revision summary

  1. MFT record is normally 1 KiB; record 0 $MFT, 1 $MFTMirr, 2 $LogFile, 3 $Volume, 6 $Bitmap, 7 $Boot, 8 $BadClus, 9 $Secure, 11 $Extend.
  2. Journaling covers metadata only; the change journal records what changed, never old data.
  3. Compression works in 16-cluster units; compression and encryption are mutually exclusive.
  4. XP and Vista support FAT16, FAT32 and NTFS — support questions usually take "all of the above".
  5. 32-bit Windows: 4 GiB per process, 2 GiB/2 GiB default split, 4 KiB pages, so 524,288 user pages.
  6. Soft fault = page still in RAM; hard fault = page read from pagefile or mapped file; a fault is not an error.
  7. Page lists: active, standby (clean and valid), modified (dirty), free (undefined), zero (ready).
  8. Hibernate writes RAM to hiberfil.sys and closes no application; Windows Vista added volume shrink/extend in Disk Management.
  9. Registry roots: HKLM machine, HKCU current user, HKU all users, HKCR merged view, HKCC hardware profile.
  10. INI files are plain text; the registry is a binary hive database, not a single file.
  11. Layers bottom-up: hardware, HAL, kernel, executive, environment subsystems and applications.
  12. The VMM is the classic non-portable part of Windows 2000; UTF-16 wide characters are 16 bits.

Previous-year exam insights

  • Direct one-liners recur on 16-bit Unicode, the meaning of hibernate, INI files as text files, and which file systems XP and Vista support: memorise the standard answers exactly.
  • Match-the-list items on NTFS system files and on Windows memory lists are frequent; learn the reserved-record table and the standby/modified/free/zero definitions cold.
  • Statement I/II items usually test the boundary between $LogFile and user data, and between compression and encryption; one false half is the intended trap.
  • Assertion–reason items on page faults and the 32-bit address space expect "both true, R explains A" only when R states the mechanism, not merely another true sentence.
  • Architecture questions reverse the layers: DMA and interrupt controllers belong to the HAL, thread dispatch and synchronisation to the kernel, VMM/I/O/object manager to the executive, process creation and OS emulation to environment subsystems.
    Some published keys blur HAL and executive wording; answer by the textbook layering.
  • Version questions: Windows Vista brought shrink/extend of existing volumes in Disk Management, and Windows 2000 is the server-class system among the options usually offered.
  • Traps: FAT32's 4 GiB file limit versus its 2 TiB volume limit; the 32 GiB creation limit in Windows; "4 GB address space" surviving even with more RAM installed.

Practice at PARIKSHA

You are ready for the PARIKSHA tests of this sub-topic when you can:

  1. List the first twelve NTFS system files by record number and state each one's purpose.
  2. Explain what $LogFile guarantees and what it does not, and distinguish it from $UsnJrnl.
  3. Describe the attributes of a compressed file and of an encrypted file, and say why both flags cannot be set together.
  4. Trace the steps from CreateFile to a returned handle, naming the object manager, I/O manager, NTFS B+ tree lookup and security check.
  5. Name the five registry root keys and identify the merged view and the hive loaded at logon.
  6. Compute the number of user-mode pages in a default 32-bit process and in a 3 GiB-configured one.
  7. Classify a fault as soft or hard from a description of the page's list and state the I/O cost.
  8. Compare FAT16, FAT32 and NTFS on volume size, file size, journaling, ACLs, compression and encryption.
  9. Order the HAL, kernel, executive and environment subsystems, and assign a given function to the right layer.
  10. State how sleep, hibernate and shutdown differ in terms of RAM, hiberfil.sys and running applications.

Attempt the sub-topic test first; when you score comfortably, move to the subject test.

Pages 1–2 of 2