Date: Mon, 29 Dec 1997 18:58:04 GMT Server: Apache/1.2.4 lock_local/0.1 Last-Modified: Sun, 30 Mar 1997 07:24:30 GMT ETag: "1b497e-55ad-333e152e" Content-Length: 21933 Accept-Ranges: bytes Connection: close Content-Type: text/html X-Pad: avoid browser bug
Applied Computer Technologies, Inc.
Advanced Technology Computer Systems, Peripherals, & Services
Understanding Kinds of Memory
Memory comes in two basic forms, random access memory (RAM) and read-only
memory (ROM). Actually, the name "random access memory" is a
bit misleading, because both kinds of memory are random access; that is,
the CPU can call up any arbitrary address directly without reading sequentially
through lower addresses. RAM is really read-write memory, which the processor
can use as a scratch pad and modify rapidly. ROM is memory that contains
preset instructions and data, often for controlling physical devices like
disk drives associated with the PC.
RAM and ROM
RAM and ROM are the two basic types of memory that you will find in your PC. Both are semiconductor memory found on chips. Forget about the full name of the first kind-random access memory-all the memory in your PC is random access. RAM is read-write memory; ROM, as the full name says, is read-only memory.
ROM is used to hold instructions to control devices, which never change. This is what the BIOS of your PC largely consists of: Instructions for controlling hardware. The hardware is built into the PC, so the BIOS instructions specific to that hardware are likewise built into it, as ROM. If you install a custom video adapter, it includes its own BIOS instructions on ROM, which will replace the built-in instructions every time you boot up the machine. RAM is used for data that come and go. RAM is typically a good deal faster than ROM.
As an analogy, if you walk into a classroom, you will likely see blackboards
as well as printed charts. The charts (depending on the level) may show
letters of the alphabet, formulas, maps, and so forth. They may be continually
referred to during classes, but their contents never change. If they become
out-of-date (and funding allows), they are replaced. The blackboards, on
the other hand, are erased and written over again and again, with important
points from the lecture, exercises, illustrations, and assignments. Plainly,
the contents of the charts and the blackboards differ in kind-the charts
show basic facts that must be on hand in a variety of contexts, and the
blackboards show information of significance at the moment; ROM is like
the charts, and RAM is like the blackboards.
RAM
RAM is the essential memory and occupies up to the first 640K of your PC's address space, as well as anywhere else that the contents of memory may change, such as the video buffer or expanded or extended memory (described in Chapter 2). The RAM that makes up the bulk of your PC's memory is called dynamic RAM, or DRAM, because it must be frequently recharged, or refreshed, to preserve its contents. The recharging steps slow it down somewhat.
RAM chips are organized in banks of nine. When the CPU stores a byte of data, 1 bit from the byte goes into a pigeonhole in each chip of a bank. The ninth chip holds a special parity bit that acts as a check on the correctness of the values in the other eight. when your computer accepts memory in the form of SIPs (single in-line packages) or SIMMs (single in-line memory modules), all the chips in a bank are combined on a single card that you can insert. When you buy chips of a given size rating, the rating gives the number of bytes that a whole bank of these chips will hold. For instance, a bank of 256K chips will hold 256K bytes of data.
Tip:
If you are adding RAM to your PC, there are several things you should note for compatibility and greatest speed. For instance, you should always fill the motherboard or proprietary expansion card of your 80386 or i486 PC before adding memory to an add-on card. This is because the CPU uses a 32-bit data path in addressing motherboard memory, which is much faster than the 16-bit path on the standard PC bus. Also, you must buy chips that can be read and written fast enough for your computer.
Besides this garden variety of RAM, you will encounter some specialized
forms of RAM as you deal with memory management.
Video RAM
The video buffer is a specialized area of memory where the CPU composes in detail the image that appears on your screen. Memory here is specially organized to handle such qualities of the presentation as color, but it occupies part of the address space like other memory. The video buffer starts at 640K, but its size and memory locations depend on the video mode in use.
For instance, a video mode may be either a text mode or a graphics mode. In text mode, the CPU uses a couple of bytes of video buffer space to prescribe what character will appear at any position on your screen and what color it will appear in. The video adapter takes over the task of forming the characters. DOS-based word processors and spreadsheets usually use text mode, which is very fast and demands a relatively small amount of buffer space. As you will learn, if you use text mode exclusively your memory manager may be able to reclaim some address space assigned to the video buffer for conventional memory.
All Windows-based programs, as well as presentation graphics and CAD
programs, use a graphics mode to display images. In this case, the CPU
must specify the color value for each pixel, or dot, on-screen, and demands
on video buffer space are greater.
Cache Memory
Using a cache is a means of speeding access to data by moving them to a fast medium if they are likely to be read or modified soon. For instance, if data have just been read, they are likely to be read again soon, and so are the data that follow them.
The inexpensive DRAM chips used for main memory are not able to keep up with fast 80386 or i486 processors. For this reason, manufacturers often design PCs to include small amounts of expensive SRAM (static RAM, which does not have to be refreshed frequently) as a hardware cache. The presence of a hardware cache should be transparent to your memory manager and not influence its handling of main memory
Another technique for speeding access to memory is interleaving, in which sequential data items are assigned to alternate banks of memory, allowing one bank to be refreshed as the next is being read or modified. Like the hardware cache, this mechanism is handled by low-level hardware and is not something you need to worry about.
Another form of cache memory is a software cache, which is a block of memory assigned to hold data from disk drives. Depending on how often your applications have to access data from disk, an effective cache can speed your work greatly, since memory accesses are much faster than disk accesses. A software cache can be created in extended memory (described in Chapter 2) and justifies having plenty of memory in your computer.
Some disk controllers include caches built onto the card. When these caches are reasonably large (a half-megabyte to several megabytes), they are functionally equivalent to a software cache created in main memory. Software caches are generally just as fast, however, and considerably cheaper.
For now, note the essential difference between the two kinds of cache: the software cache (or the caching disk controller) speeds access to data on the disk by keeping recently used disk data in memory, but the hardware cache (or the on-board cache) speeds access to memory itself by keeping recently used data in yet faster memory. The two classes of cache, in serving different functions, are compatible, and each will speed up your computer. On the other hand, there is generally nothing to be gained by employing two kinds of software cache, or both a software cache and a caching controller, because one only duplicates the efforts of the other; and there is extra overhead. (The software cache will generally prove to be as fast as or faster than the caching controller, as well as quite a bit cheaper.) Some PCs, however, make profitable use of the i486's on-board cache and of an additional hardware cache.
Note that a caching controller on a disk drive is no different in principle
from a software cache in main memory--the cache is simply on the controller
card instead of in main memory. Likewise, the cache incorporated into an
i486 CPU serves the same function as a hardware cache: It speeds access
to data and instructions in main memory.
ROM
As mentioned, memory whose contents cannot ordinarily be modified is read-only memory, or ROM, which usually contains instructions for operating physical devices, including the PC itself.
When you first turn on, reset, or reboot your PC, it is under the control of code in ROM (known as the ROM BIOS) located near the upper end of the basic 1MB address space. Then, additional devices in your computer take over blocks of unused address space to insert the ROM code containing instructions for their specialized uses. For instance, your video adapter will locate its own block of ROM in the area of memory just above that assigned to the video buffer. Hard-disk drives, network adapter cards, and other devices will take over areas between the video ROM area and the ROM BIOS area. Normally, this process will leave open spaces in the memory map--a condition that memory managers exploit heavily.
Not all the memory in your computer occupies this first megabyte. As
you will read in the next chapter, extended memory lies beyond this limit
and expanded memory exists outside the normal PC address space and is read
into the first megabyte on demand, in blocks. Other memory, such as the
CMOS RAM that holds the PC's setup information, is read through an entirely
different CPU subsystem, called the Port I/O system, which also communicates
with devices like serial and parallel I/O cards. Now you're in a position
to understand how these forms of RAM and ROM are placed within the basic
first megabyte of address space.
Understanding Areas of Memory
Figure 1.1 shows the general contents of the first megabyte of memory from the ground up. This section takes a quick look at what these contents are.
Conventional Memory
Also known as base memory, conventional memory is the classic 640K of
address space allocated to RAM for DOS and your applications. If you don't
actually have the full 640K installed in your PC, no upgrade is simpler
or more worthwhile. We'll take a close look at how programs fit into this
area of RAM in the section "Focus on Conventional
Memory."
The Upper Memory Area
The upper memory area (UMA) is the part of the memory map extending from the top of conventional memory up to the 1MB DOS limit--384K all told. Just to make matters confusing, it is sometimes called reserved memory because it is normally reserved for BIOS for devices like video cards, disk controllers, and the PC's ROM itself. What is more confusing, you will sometimes see it called high memory, which makes it easy to confuse with the High Memory Area, described next. You will often see, for instance, the terms High Memory, High RAM, and High ROM in the QEMM documentation; these refer to this area of memory. Figure 1.1 shows BIOS for one device (a hard-disk drive) occupying a slice of the UMA, typical for a simple configuration. Devices may also place RAM in this region for special purposes.
Video RAM
The portion of the memory map immediately above 640K is dedicated to
video RAM, although how much is actually used depends on the current video
mode. As mentioned, your memory manager may be able to free some of this
memory to load your device drivers and TSRs. What is more, if you use text
mode exclusively, the manager may be able to appropriate the first big
chunk of the buffer (which is dedicated to graphics mode) and add it to
conventional memory, giving you more than 700K for your applications.
DOS Memory
DOS memory is the range of memory traditionally available to PC processors,
operating systems, and software, even if you are using the earliest PCs
with their 8086 or 8088 processing chips. It includes space for RAM as
well as ROM and is divided into two main areas: conventional memory and
upper memory. DOS memory is like a metropolitan area: The central city
(with the very low numbered addresses) has the police station, the court;,
and city administration buildings, surrounded by tightly packed businesses,
residences, and parking garages (conventional memory). You pass a park
and reach a video emporium and you're past the city limits; then you drive
past blocks of open fields punctuated by an occasional subdivision or farm
(upper memory). The last suburb is a small hamlet known as high memory-this
may or may not be part of the metropolitan area, depending on whether the
A20 bus line reaches it. (You'll learn more about the A20 line in the next
chapter.) Beyond high memory are the exurbs and the countryside, known
as extended memory; more on this region follows later.
Video ROM
The small area above the video buffer is available for video adapters
(EGA, CGA, or later) to insert their own BIOS code. The routines will then
be here that are actually used when DOS or an application makes a call
to your PC's ROM BIOS for a video function.
The ROM BIOS
The size of the ROM BIOS may vary from one machine to another, but it
typically occupies two slices of address space near the top of the UMA,
beginning at about 980K. Figure 1.1 shows empty spaces above and below
the hard disk code. These separate areas of address space are known as
upper memory blocks (UMBs). They can be filled with RAM and made available
for your TSRs (terminate-and-stay-resident programs) and some other programs
by a process known as remapping.
The High Memory Area
The High Memory Area (HMA) is a bonus space available on most 80286 or later PCs. It exists because of a quirk in the design of Intel CPUs. DOS and PC applications are actually able to use a chip's internal registers to refer to almost 64K more memory (16 bytes short of 64K) than an 8086 or 8088 CPU can address.
Note: An internal register is a small storage area used to manipulate data or to form a memory address.
When a memory manager activates the 21st address line on an 80286 or later chip, this memory becomes usable. You will see this line referred to in documentation as the A20 line (the first line is called AO), and it must be activated by a special device driver included with DOS 5 (HIMEM.SYS) or built into QEMM or 386MAX.
You can load much of DOS 5 itself into the HMA, making more conventional memory available for your applications. Alternatively, the DESQview operating environment is often placed in the HMA.
The HMA marks the beginning of extended memory the region beyond the standard DOS limit that is available only to 80286 or later CPUs.
Focus on Conventional Memory
Figure 1.2 takes a closer look at conventional memory, with its typical uses. Like the previous figure, this one begins with address 0 at the bottom. This figure should give you a sense of the phenomenon known as "RAM cram." Exactly where each element begins in memory depends on numerous factors, but this will give you a notion of the demands on memory
When you think of how demands on conventional memory are proliferating, you can see what a help it would be move some of these memory hogs somewhere else than conventional memory', such as into reserved memory above the 640K limit. This is one of the tasks of a competent memory manager like QEMM or 386MAX.
Copyright 1997. All Logo's Are Trademarks of Their Respective Company. All Right's Reserved
We support free speech on-line.
Page created using Netscape Gold 4.0 by ACT Webmaster at: actpc@appliedcomputer.com
Changes last made on: April 1st, 1997