Windows 98 includes a core composed of three components — User, Kernel, and Graphics Device Interface (GDI) — as shown in Figure 28.12.
Figure 28.12 Windows 98 core system components
Each of these components includes a pair of dynamic-link libraries (DLLs) one 32-bit and one 16-bit) that provide services for the applications you run. Windows 98 is designed to use 32-bit code wherever it significantly improves performance without sacrificing application compatibility. Windows 98 retains existing 16-bit code where it is required to maintain compatibility or where 32-bit code would increase memory requirements without significantly improving performance. All the Windows 98 I/O subsystems (such as networking and file systems) and device drivers are 32-bit, as are all the memory management and scheduling components, including the Kernel and Virtual Memory Manager.
As shown in Figure 28.13, the lowest-level services provided by the Windows 98 Kernel are implemented as 32-bit code to ensure a high-performance core. Most of the remaining 16-bit code consists of hand-tuned assembly language, delivering performance that rivals some 32-bit code used by other operating systems.
Figure 28.13 Windows 98 core services
Many functions provided by the GDI — which are mostly complex, CPU-intensive functions — have been rewritten as 32-bit code to improve performance. Much of the window management code in the User components (small, fast functions) remains 16-bit, thus retaining application compatibility.
Windows 98 also improves on the MS-DOS and Windows 3.1 environments by implementing many device drivers as 32-bit, protected-mode code. Virtualization drivers in Windows 98 assume the functionality provided by many real-mode, MS-DOS-based device drivers, eliminating the need to load them in MS-DOS. This results in a minimal conventional memory footprint, improved performance, and improved reliability and stability of the system over real-mode device drivers.
The following sections describe the services provided by these core components.
The User component manages input from the keyboard, mouse, and other input devices and output to the user interface (windows, icons, menus, and so on). It also manages interaction with the sound driver, timer, and communications ports.
Windows 98 uses an asynchronous input model for all input to the system and applications. As the various input devices generate interrupts, the interrupt handler converts these interrupts to messages and sends the messages to a raw input thread area, which in turn passes each message to the appropriate message queue. Although each Win32-based thread can have its own message queue, all Win16-based applications share a common one.
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 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 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 gigabytes (GB) in size: 2 GB reserved for program storage and 2 GB for system storage.
Figure 28.14 illustrates where Windows 98 system components and applications reside in virtual memory.
Figure 28.14 Windows 98 virtual memory structure
From top to bottom, here is where system and application components reside in virtual memory:
The Windows 98 virtual memory swap file implementation addresses 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. One of the benefits of a temporary swap file is 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 remained as a hidden file, taking up space, on the hard drive when the user exited Windows.
The swap file implementation in Windows 98 simplifies the configuration task for the user and combines the best of temporary and permanent swap files because of improved virtual memory algorithms and access methods. The swap file in Windows 98 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 98; however, the need to do this is reduced by using system defaults. For more information about swap file configuration options, see Chapter 26, "Performance Tuning."
The Graphics Device Interface (GDI) is the graphical system that manages what appears on the screen. It also provides graphics support for printers and other output devices. It draws graphic primitives, manipulates bitmaps, and interacts with device-independent graphics drivers, including those for display and printer output device drivers.
The graphics subsystem provides graphics support for input and output devices.
For reliability and better performance, Windows 98 uses a 32-bit graphics engine, also known as the device-independent bitmap (DIB) engine. This engine directly controls graphics output to the screen, providing more reliable system performance. It also provides a set of optimized generic drawing functions for monochrome (1-bit), 16-color (4-bit), 256-color (8-bit), 65,535-color (16-bit), and 16,777,215-color (24-bit) graphic devices and supports Bézier curves and paths.
Windows 95 introduced Image Color Matching (ICM) for better color-matching between display and color output devices. Microsoft has enhanced the capability of ICM to provide increased functionality and performance in Windows 98. ICM 2.0 supports more color spaces beyond RGB to CMYK, to device-independent color spaces such as CIELAB, a theoretical color space defined by the Commission Internationale de L'Eclairage (CIE), as well as support for additional colors for processes such as HiFi Color. See Chapter 11 "Printing, Imaging, and Fonts" for more information on ICM.
As with other parts of the operating system, the Windows 98 graphics subsystem includes a universal driver/minidriver model. As illustrated in Figure 28.15, display drivers for Windows 3.1 included hardware-specific instructions, in addition to general instructions for the operating system. Now, all instructions about drawing to the screen or output device are included in the universal display driver. Minidrivers for Windows 98 define only hardware-specific instructions. Minidrivers are available for most leading Super VGA adapters and graphics accelerators, including S3, ATI, Tseng, Paradise, Western Digital, and Cirrus Logic.
Figure 28.15 The 16-bit and 32-bit graphics subsystem driver models
Tip
Problems can result when Windows 98 assumes that a display adapter can support certain functionality that, in fact, it cannot. If this occurs, the side effects might be anything from small display irregularities to system lockup.
To determine whether any performance problems might be related to the display adapter, you can progressively disable enhanced display functionality using the System option in Control Panel. For information, see Chapter 26, "Performance Tuning."
The 32-bit Windows 98 printing subsystem provides performance through smoother background printing and faster return-to-application time. By using background thread processing, the Windows 98 spooler passes data to the printer, as the printer is ready to receive more information.
Windows 98 spools enhanced metafile (EMF) format files rather than raw printer data to ensure quick return-to-application time (up to twice as fast as with Windows 3.1). When spooled, the EMF information is interpreted in the background, and the output is sent to the printer.
The printing subsystem supports Point and Print. When users browse the network to choose the printers they want to use, Windows 98 automatically installs the appropriate printer driver from the Windows 98 or Windows NT server.
Another feature of the Windows 98 printing subsystem is deferred printing. If no printing device is available, the user can still "print" the job. Windows 98 generates the print job and then saves it for output to a print device when one is available. Then, when the user docks the portable computer after returning to the office, the print job that was "printed" begins generating pages at the print device.
The printing subsystem also provides system-level support of bidirectional communication protocols for printers adhering to the Extended Communication Port (ECP) printer communication standard, developed by Microsoft and Hewlett-Packard. This capability allows printers to send unsolicited messages to Windows 98 and to applications. For example, the printer might send an "out of paper" or "printer offline" message. Bidirectional communication enables much more detailed status reporting on a wider variety of information, such as information about a low toner condition, details about a paper jam, instructions related to maintenance needs, and so on. For more information on printing, see Chapter 11 "Printing, Imaging, and Fonts."