Previous Table of Contents Next


Like a two-level virtual memory, the memory is still used as a buffer. Processors can operate directly only on data in memory, not on the disk. The difference with only one level is that memory is now a cache for all the disk storage, rather than just for a reserved area on the disk. Also, when one user makes a change to a file, the change is instantly available to any other user who is sharing the file.

The downside of single-level store is the requirement for a large address in the computer. The address must be large enough to cover all the disk storage attached to the system. Consider the 32-bit address used in many of today’s systems. A total of 4 GB can be addressed with a 32-bit address. This is nowhere near enough to address all the disk storage that can be attached to even a large PC. So these conventional systems are forced to copy disk data into and out of their relatively small virtual memories.

The System/38 and earlier AS/400 used a 48-bit address to eliminate this restriction. Now the AS/400 uses a 64-bit address, with even more address bits available for future expansion. There is a hardware cost for the additional bits, but this cost is far outweighed by the sharing capabilities and the performance advantages of single-level store.

Persistent Virtual Memory

The AS/400’s address size is much larger than necessary to cover the total disk storage. The reason behind this large address is another characteristic of the single-level store that we call persistence. In Chapter 5, about objects, we introduced this characteristic. An object that has persistence continues to exist in the memory system forever, even after the object has been destroyed. We said this type of object is called a permanent object on the AS/400, and we described how the virtual address space for a permanent object is never reused. When a permanent object is destroyed, we free up all the disk space the object occupied, except for the headers. This disk space is then reused for other objects.

We don’t reuse the virtual address space so we can eliminate security and integrity exposures. If a permanent object is destroyed and the address space is reused for another object, someone who had addressability to the original object through a resolved pointer could address the new object. Because pointers can be stored anywhere in the memory system, most garbage collection schemes to find all the pointers become overly complex. By using a sufficiently large address and not reusing the address space for permanent objects, the AS/400 eliminates the need for garbage collection.

Most conventional virtual memories have no garbage collection problem, but for different reasons. In an early virtual memory scheme (still used for some PC operating systems), each user is given a separate virtual address space. When the user process goes away, so does its virtual memory. There is no way to keep an address to anything in the system. The only place for sharing is the file system, and virtual addressing is not used in the file system.

This early virtual memory implementation of not sharing anything is not acceptable for most multiuser operating systems, such as Unix, and so a variation was defined for these operating systems. Instead of giving the user program direct addressability to the virtual memory, these systems give the program an address that must be translated by the hardware into the virtual address before it can be used. In the PowerPC architecture, we call this address the effective address. As we will see, the use of an effective address does enable some level of memory sharing at the cost of more processor overhead.

The virtual memory in these systems is logically divided into segments, where a segment is a block of contiguous bytes in memory. An effective address identifies one of these segments. A typical implementation of the translation from effective to virtual address uses a few registers (4 to 16) on the processor hardware chip, called segment registers. Each segment register contains the virtual address of one segment in the virtual memory. Some high-order bits in the effective address are used to identify one of the segment registers. The remaining bits in the effective address identify the byte within the segment (called the offset into the segment). Because an effective address contains the offset into a virtual address segment, this type of addressing is sometimes called segment-relative addressing.

A simple way to think about an effective address is to recognize that it is a subset of the larger virtual address. A user program can directly access only a few of the segments in the virtual memory — those whose addresses are loaded into the segment registers. The program can request that the operating system reload the registers, giving the program access to other segments, but the program is still working only with a small piece of the virtual memory. For example, some Intel processors have only four segment registers, which allows access to only four segments at a time, while some early RS/6000 processors used 16 of these registers, which still allows access to only a small part of the total virtual memory.

For the PowerPC architecture, we got rid of the segment registers and replaced them with a special table in memory called a segment table, which gives a user program access to far more segments than does a register implementation. Each entry in the segment table still contains the virtual address of one segment in the virtual memory. The effective address used by a program now identifies an entry in the segment table and the byte offset into the segment. Two programs can share the same virtual address if they use the same segment table entry, or if the same virtual address is stored in more than one segment table entry.

With segment-relative addressing, the user program sees only the effective address and, therefore, cannot store away a virtual address. The effective-to-virtual translation process requires additional overhead, but the virtual addresses are protected and there is no garbage collection problem. Because only the operating system can reload the segment registers, a level of control also exists over which segments a user program can address and share with another program.


Previous Table of Contents Next

Copyright © NEWS/400 Books