13.2 System architectures

 < Free Open Study > 



13.2 System architectures

For the performance evaluation analysis of the operating systems, the computer systems architecture plays a prime role. This section includes the operating system architectures for LINUX 7.2, Windows ME, Windows XP, and Windows NT.

13.2.1 LINUX architecture

Red Hat LINUX 7.2

As part of the larger effort to evaluate the relative performance of LINUX versus several other operating systems, we considered key components of LINUX in order to lay the foundation for this comparison. Here we examine the LINUX policies and parameters used in the last stable version of kernel 2.4. The distribution used for our evaluation is Red Hat LINUX 7.2.

LINUX supports multitasking, which is the ability to have many programs running simultaneously. For example, it is possible to format a disk, download a file from a BBS, and edit in a word processor-all simultaneously.

Task structure and process table

LINUX manages the processes in the system; each process is represented by a task_struct data structure. The task vector is an array of pointers to every task_struct data structure in the system. As processes are created, a new task_struct is allocated from system memory and added into task_vector. The task_struct structures are linked in two ways: as a hash table, hashed by pid, and as a circular, doubly linked list using p->next_task and p->prev_task pointers. The tasks are hashed by their pid value. The hash table is used to quickly find a task by given pid, which uses find_task_pid(). The circular doubly linked list that uses p->next_task and p->prev_task is maintained so that one could go through all tasks on the system easily.

Task flags contain information about the process states, which are not mutually exclusive. The scheduler needs the information in order to decide which process in the system deserves to run. Every process in the system has an identifier. The process identifier is not an index into task_vector; it is simply a number. Each process also has user and group identifiers; these are used to control this process's access to its files and devices in the system.

Links

In a LINUX system no process is independent of any other process. Every process in the system except the initial process, called init, has a parent process. New processes are not created; they are copied, or rather cloned, from previous processes. Every task_struct representing a process keeps pointers to its parents and to its siblings (those processes with the same parent process), as well as to its own child processes. Additionally, all of the processes in the system are held in a doubly linked list, whose root is the init process's task_struct data structure. This list allows the LINUX kernel to look at every process in the system. It needs to do this to provide support for commands such as ps or kill.

Times and timers

The kernel keeps track of each process's creation time as well as the CPU time that it consumes during its lifetime. For each clock tick, the kernel updates the amount of time in jiffies that the current process has spent in system and in user mode. LINUX also supports process-specific interval timers; processes can use system calls to set up timers and to send signals to themselves when the timers expire. These timers can be single-shot or periodic timers.

File system

Processes can open and close files as they wish and the process's task_struct contains pointers to descriptors for each open file as well as pointers to two VFS i-nodes. Each VFS i-node uniquely describes a file or directory within a file system and also provides a uniform interface to the underlying file systems. The field p->fs contains file system information, which, under LINUX, means three pieces of information: root directory's d_entry and mountpoint, alternate root directory's d_entry and mount-point, and current working directory's d_entry and mountpoint.

Virtual memory

Most processes have some virtual memory (kernel threads and daemons do not), and the LINUX kernel must track how that virtual memory is mapped onto the system's physical memory. The fields p->mm and p->active_mm point, respectively, to the process's address space described by the mm_struct structure and to the active address space if the process doesn't have a real one (e.g., kernel threads).

Paging

To approximate a least recently used (LRU) algorithm for page replacement, LINUX finds a process with the most NRU (not recently used) pages to swap pages from. Unlike a standard clock algorithm, which tends to take a few pages from all processes, this will result in taking a large number of pages from a few processes. Sometimes LINUX will deal with this situation by temporarily removing the most victimized process from the pool of concurrently running processes. Different kernels of LINUX handle these details differently.

Kernel 2.4

Kernel 2.4 finds a compromise between kernel 2.0's aging and 2.2's lack of aging. It does so by changing the method of decreasing the age. Age is decreased exponentially as opposed to linearly. This helps prevent one process with a high page-fault rate from getting more than its share of pages and thereby hurting other processes, and it prevents a page that is only referenced once from being given the same wait as a page that is referenced 20 times.

To have memory more efficiently utilized, kernel 2.4 reintroduces the method used in kernel 2.0 for selecting processes to contribute NRU pages. Going through a process list each time, it checks only about 6 percent of the address space in each process to search for NRU pages before it goes to the next process. Similar to kernel 2.0, this method increases the possibility of thrashing.

13.2.2 Windows XP architecture

Windows XP Professional is built on the proven code base of Windows NT and Windows 2000, which features a 32-bit computing architecture, as well as a fully protected memory model. Windows XP Professional is designed to allow multiple applications to run simultaneously, while ensuring great system response and stability.

Disk management

Microsoft Windows XP offers two types of disk storage: basic and dynamic.

Basic disk storage

A disk initialized for basic storage is called a basic disk. A basic disk contains basic volumes, such as primary partitions, extended partitions, and logical drives. Additionally, basic volumes include multidisk volumes, which are created by using Windows NT 4.0 or earlier, such as volume sets, stripe sets, mirror sets, and stripe sets with parity. Windows XP does not support this multidisk basic volume.

Dynamic disk storage

A disk initialized for dynamic storage is called a dynamic disk. A dynamic disk contains dynamic volumes, such as simple volumes, spanned volumes, striped volumes, mirrored volumes, and RAID-5 volumes. With dynamic storage, disk and volume management can be performed without the need to restart Windows. Mirrored volumes or RAID-5 volumes cannot be created on Windows XP Professional-based computers. However, a Windows XP Professional-based computer can be used to create a mirrored or RAID-5 volume on remote computers that are running Windows 2000 Server, Windows 2000 Advanced Server, or Windows 2000 Data Center Server.

Storage types are separate from the file system type. A basic or dynamic disk can contain any combination of FAT16, FAT32, or NTFS partitions or volumes.

File systems

Windows XP supports three different file systems: File Allocation Table (FAT); FAT16, FAT32, and NTFS (NT file system); NTFS is the recommended file system. NTFS provides advanced file system features such as security, transacted operations, large volumes, and better performance on large volumes. Such capabilities are not available on either FAT16 or FAT32. Windows XP provides native support for NTFS volumes on such large sizes, while a FAT32 volume is supported only for sizes up to 32 GB. Under Windows XP, NTFS supports a maximum file size of up to the disk size. Windows XP delivers new features (such as support for acquiring and editing video files) that frequently result in creation of files that exceed 4 GB in size. NTFS is a journaling file system. NTFS writes a log of changes being made, which offers significant benefit in cases where a system loses power, experiences an unexpected reset, or crashes. NTFS can quickly return the disk to a consistent state without running CHKDSK. This yields a better user experience and results in fewer support calls.

Memory management

Windows XP, like most modern operating systems, uses virtual memory. Windows XP regularly checks that the memory assigned to a particular application is actually in use and maintains an estimate for each application indicating the amount of memory that could reasonably be taken away without affecting performance. A reserve of memory is kept on hand to be used as needed. When this reserve sinks too low, it is replenished by trimming working sets. These estimates are used as a guideline to determine where memory should be taken from.

Virtual memory is divided among the space taken by the applications, driver code, allocated and mapped data used by the system, and the space used by the system. In Windows, physical memory has page-pooled and non-page-pooled allocations. Non-page-pooled memory is for code that is time critical, such as the Virtual Memory Manager (VMM). Page-pooled memory is mapped to disk files and allows the OS to swap the memory pages out to disk if additional physical memory is needed elsewhere. Pool memory is managed by a system of descriptors, called page table entries (PTE), that incorporates memory page frame numbers which point to physical memory pages. In addition to memory page frame numbers, the PTE contains bits on the use status of the page-in use, dirty, clean, and unused. The memory manager keeps track of page status with page table lists for fetching and reuse.

In the fight between drivers or processes for memory under low-memory conditions, the user often loses. Generally, these conditions are temporary and are relieved when a driver or process frees up its blocks. When a driver or application process needs memory, it asks the system for a memory allocation. The allocation is either provided or denied. In past versions of Windows, allocation routines that must succeed were allowed to force the system to give the driver some memory. Unfortunately, during lean memory times, it could crash the system. To help get past these low times, Windows XP no longer permits drivers to allocate must-succeed requests. If an application or driver uses a must-succeed request, it is denied. All internal Windows XP drivers have been rewritten to avoid the use of must-succeed requests. Third-party drivers will also have to comply to earn signed driver status.

Another step taken by Windows XP for more robust memory handling is I/O throttling. For performance reasons, Windows tries to do as much processing in parallel as possible. However, if memory use gets to the point where there is none left to allocate, Windows will throttle down its processing of memory to one page a time, using the resources it can. While this slows the system, it doesn't crash.

13.2.3 Windows NT architecture

The Executive

NT's Executive subsystems make up the most important layer in kernel mode, and they perform most of the functions traditionally associated with operating systems. The subsystems have separate responsibilities and names. NT doesn't assign Executive subsystems to different processes; NT doesn't place the Executive subsystems in different image files.

Object Manager

The Object Manager is one of the NT's Executive subsystems. Other Executive subsystems use the Object Manager to define and manage objects that represent resources. The Object Manager performs object-management duties that include identification and reference counting.

Virtual Memory Manager

The Virtual Memory Manager has two main duties: to create and manage address maps for processes and to control physical memory allocation. NT 4.0 implements a 32-bit (4-GB) address space; however, applications can directly access only the first 2 GB. The 2-GB to 4-GB portion of the address space is for the kernel-mode portions of NT, and it doesn't change. The Virtual Memory Manager implements demand-paged virtual memory, which means it manages memory in individual segments, or pages. In x86 systems, a page is 4,096 bytes. The Virtual Memory Manager has advanced capabilities that implement file memory mapping, memory sharing, and copy-on-write page protection. NT uses file memory mapping to load executable images and DLLs efficiently. Copy-on-write is an optimization related to memory sharing in which several programs share common data that each program can modify individually. When one program writes to a copy-on-write page that it shares with another program, the program that makes the modification gets its own version of the copy-on-write page to scribble on. The other program then becomes the original page's sole owner. NT uses copy-on-write optimization when several applications share the writeable portions of system DLLs.

I/O Manager

The I/O Manager is responsible for integrating add-on device drivers with NT. Device drivers, which are dynamically loaded kernel-mode components, provide hardware support. A device driver controls a specific type of hardware device by translating the commands that NT directs to the device into device-specific commands that manipulate the hardware to carry out the commands. The I/O Manager supports asynchronous, packet-based I/O. The I/O Manager supports 64-bit file offsets and layered device drivers. Using 64-bit offsets lets NT's file systems address extremely large files and lets disk device drivers address extremely large disks. Layering lets device drivers divide their labor.

Cache Manager

The Cache Manager works closely with the Virtual Memory Manager and file system drivers. The Cache Manager maintains NT's global (shared by all file systems) file system cache. The working-set tuner assigns physical memory to the file system cache. The NT cache is file oriented rather than disk-block oriented.

Process Manager

The Process Manager in NT wraps the kernel's process object and adds to it a process identifier (PID), the access token, an address map, and a handle table. The Process Manager performs a similar operation on the kernel's thread object, adding to it a thread identifier (TID) and statistics. These statistics include process and thread start and exit times and various virtual-memory counters.

The kernel

NT's kernel operates more closely with hardware than the Executive does, and it contains CPU-specific code. NT's thread scheduler, called the dispatcher by NT's developers, resides in the kernel. The dispatcher implements 32 priority levels: 0-31. The dispatcher reserves priority level 0 for a system thread that zeros memory pages as a background task. Priority levels 1 through 15 are variable (with some fixed priority levels) and are where programs execute; priority levels 16 through 31 are fixed priority levels that only administrators can access. The NT dispatcher is a preemptive scheduler. The CPU's time is divided into slices called quanta. When a thread runs to the end of its quantum and doesn't yield the CPU, the dispatcher will step in and preempt it or schedule another thread of equal priority that is waiting to run. NT implements most synchronization primitives in the kernel. The kernel implements and manages its own object types, and kernel objects represent NT's synchronization primitives.

13.2.4 Windows ME architecture

The team documented the architecture based on Windows 98, because Millennium is based on the architecture of Windows 98 and sufficient data are unavailable on Windows Millennium.

Memory management

In Windows 98, memory is accessed using a 32-bit linear addressing scheme. A 32-bit addressing system can access up to 4 GB of memory. Thus, in Windows 98, when an application attempts to access memory, it simply specifies a 32-bit memory address. (The minimum allocation of virtual memory is one 4-KB page.)

Windows 98's Virtual Memory Manager (VMM) controls allocating physical and logical memory. When you launch a new application, the Virtual Memory Manager initializes the virtual address space. Windows 98's VMM can address up to 4 GB, including space on your system's hard drives, so now programmers can write programs to exploit large amounts of memory without worrying about the type of memory or the amount of memory available.

Windows 98's Virtual Memory Manager provides this large, virtual memory space to applications via two memory management processes: paging and mapped file I/O.

Paging

Every page of memory falls into one of three categories: page directories, page tables, or page frames. For time-sensitive applications and those with other special memory performance requirements, the VMM enables a user subsystem or process with special privileges to lock selected virtual pages into its working set to ensure that a critical page is not paged out of memory during the application.

In implementing the virtual memory process, Windows 98 creates a hard disk swap file to which it writes information that will not fit into physical (RAM) memory. Windows 98's swap file is dynamic and can shrink or grow based on the operations performed on the system. (The Windows 98 swap file still has to be created during system startup if it doesn't already exist, slowing startup time.)

Mapped file I/O

If an application attempts to load a file larger than both the system RAM and the paging file (swap file) combined, Virtual Memory Manager's mapped file I/O services are used. Mapped file I/O enables the Virtual Memory Manager to map virtual memory addresses to a large file, inform the application that the file is available, and then load only the pieces of the file that the application actually intends to use. Because only portions of the large file are loaded into memory (RAM or page file), this greatly decreases file load time and system resource drainage. It's a very useful service for database applications that often require access to huge files.

Protection

In Windows 98, each type of application-16 bit, 32 bit, or MS-DOS-is protected from the other. The Windows 98 memory system also helps segregate applications from other applications and from their own memory segments. Due to improved protection in Windows 98, a rebellious 16-bit-based application cannot easily bring down the system as a whole, nor can it bring down other MS-DOS applications or 32-bit applications. However, crashing 16-bit applications still can affect other running 16-bit-based applications. Each type of application-16 bit, 32 bit, or MS-DOS-has a corresponding Virtual Machine Manager. Protection improvements also include the use of separate message queues for each running 32-bit application.

Disk and file system overview

Clusters

Windows 98, as with DOS before it, allocates disk space in clusters. A cluster is a group of sectors on a disk. The number of sectors in a cluster varies according to the drive type and partition size. When Windows 98 stores a file on disk, it doesn't store the file on a sector-by-sector basis. Rather, Windows 98 allocates enough clusters to contain the file.

The FAT

With so many clusters on a disk, Windows 98 needs some way to keep track of where each file and directory reside. Essentially, Windows 98 needs to know the starting and ending cluster for each file. The file allocation table, or FAT, provides that information. The FAT contains an entry for every cluster on the disk, and Windows 98 uses the FAT to keep track of which clusters are allocated to which files and directories. The FAT is the key that enables Windows 98 to locate, read, and write files on the disk.

VFAT, CDFS, and VCACHE

Windows for Workgroups introduced VFAT, a virtual installable file system driver that provided a 32-bit interface between applications and the file system. VFAT operates in protected mode, enabling Windows 98 and applications, 16 bit or 32 bit, to access the file system without switching the processor from protected mode to real mode, which significantly improves performance. Working in conjunction with VFAT is a virtual cache called VCACHE, a 32-bit protected-mode disk cache. A disk cache improves file I/O performance by caching recently used data and reading these data from memory rather than disk on subsequent requests for the data. Windows 98 includes a 32-bit protected-mode CD-ROM file system driver, called CDFS. CDFS improves file I/O by enabling applications to read from the CD-ROM drive in protected mode rather than requiring the system to switch to real mode to read the CD.

FAT32

FAT32 gets its name by using a 32-bit addressing scheme instead of a 16-bit one. FAT32 enables the root directory to live anywhere on the disk and be as long as it needs to be. FAT32 also keeps redundant backups of more critical disk information, making FAT32 partitions less susceptible to failure or data corruption. FAT32 uses space more efficiently than FAT16. Its cluster sizes are smaller, because its 32-bit addressing scheme can directly address more of them.

FAT32 has many drawbacks as well as advantages. The first downside of FAT32 as opposed to FAT16 is speed. FAT32 is slightly slower in performing many common file operations. The second downside is backward compatibility. A whole host of applications and procedures will not work with FAT32 partitions. Also, compressed drives cannot be formatted as FAT32, and removable drives should not be formatted as FAT32. Laptops will not be able to perform any suspend-to-disk functions on FAT32 drives, and if the reader's PC supports power management hibernation, it will be turned off if the drive is formatted to FAT32. Finally, a drive using FAT32 cannot have Windows 98 uninstalled.



 < Free Open Study > 



Computer Systems Performance Evaluation and Prediction
Computer Systems Performance Evaluation and Prediction
ISBN: 1555582605
EAN: 2147483647
Year: 2002
Pages: 136

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net