Kernel

The Kernel provides base operating system functionality including file I/O services, virtual memory management, and task scheduling. When a user wants to start an application, the Kernel loads the EXE and DLL files for the application.

Exception handling is another service of the Kernel. Exceptions are events that occur as a program runs and that require software outside of the normal flow of control to be run. For example, if an application generates an exception, the Kernel is able to communicate that exception to the application to perform the necessary functions to resolve the problem.

The Kernel also allocates virtual memory, resolves import references, and supports demand paging for the application. As the application runs, the Kernel schedules and runs threads of each process owned by an application.

The Kernel provides services to both 16-bit and 32-bit applications by using a translation process called thunking to map between 16-bit and 32-bit formats. Thunking converts a 16-bit value to its 32-bit equivalent.

Virtual Memory Management

Virtual memory is a term that refers to the fact that the operating system can actually allocate more memory than the computer physically contains. Each process is allocated a unique virtual address space, which is a set of addresses available for the process's threads to use. This virtual address space appears to be 4 GB in size — 2 GB reserved for program storage and 2 GB reserved for system storage.

The following diagram illustrates where Windows 95 system components and applications reside in virtual memory.

From top to bottom, here's where system and application components reside in virtual memory:

Windows 95 Swap File

The Windows 95 virtual memory swap file implementation addresses the problems and limitations imposed in Windows 3.1.

Under Windows 3.1, users had to decide whether to use a temporary swap file or a permanent swap file, how much memory to allocate to the swap file, and whether to use 32-bit disk access to access the swap file. Users benefited from a temporary swap file in that the swap file did not need to be contiguous; Windows allocated space on the hard disk when the user started Windows, and freed up the space when the user exited Windows. A permanent swap file provided better performance; however, it required a contiguous block of space on a physical hard disk, and was static, so it did not free up space when the user exited Windows.

The swap file implementation in Windows 95 simplifies the configuration task for the user and combines the best of temporary and permanent swap files, due to improved virtual memory algorithms and access methods. The swap file in Windows 95 is dynamic; it can shrink or grow, based on the operations that are performed on the system. The swap file can also occupy a fragmented region of the hard disk with no substantial performance penalty. The swap file can also reside on a compressed volume.

You can still adjust the parameters used for defining the swap file in Windows 95; however, the need to do this is reduced by using system defaults. For information about swap file configuration options, see Chapter 17, "Performance Tuning."