Memory Primer- Giordan on Graphics | 2
RAM is a temporary storage place, which allows data to be fed to the processor
at high speeds. When you buy memory, you actually buy modules, which are
printed circuit boards that have RAM chips mounted on them. The RAM chips
are linked across the boards, and the system sees the cumulative block of
chips as one continuous parking place for information. DRAM is the most
common type of RAM, and its acronym definition gives good understanding
of how RAM works.
It is called Dynamic Random Access Memory. It is dynamic in that it is constantly changing, accessing information as it needs it, then closing it up and going on to something else. It is Random in that the various memory components do not need to be loaded in a linear fashion. Instead, pieces of information can be stacked one upon another like blocks which can be pulled out and discarded, without discarding the entire stack. Another way to picture it is like a deck of cards, where cards can be added to the top or the bottom, or inserted in the middle. Cards can also be withdrawn from any of these areas as well, either to be removed from the deck, or just shuffled to another part
The information in DRAM is not only Dynamic and Randomly accessed, it is
also fast. Todays processors handle information so fast that they
require a steady flow of information to optimize their capabilities. While
hard drives offer plenty of storage space at a low cost per MB, their rotating
parts and small buffering systems are too slow to keep up with the processors
need for input. Because DRAM is solid state (with no moving parts), it can
send data as fast as the processor can keep up with it.
While RAM is fast, it is also volatile, in that when it loses power it
has no way of holding onto the data it is storing. Therefore we need to
pull information from our slow but stable hard drives into memory, which
then handles it at speeds fast enough for the processor to work with it.
Each byte of data is stored in RAM at a specific address, where it can be located by the processor when its needed. The CPU writes information into RAM using a process called Cooperative Multitasking. This allows the DRAM to support multiple applications at one time, allocating portions of space to each program as it is opened. When an application is launched, it communicates with the OS to set aside a block of space in RAM for that applications needs. Within the space allocated to an application are two areas called the stack and the heap. The stack and the heap contains tools, and application resources, as well as permanent and temporary file information. The stack and heap are constantly expanding and contracting, maintaining a balance between the data that a file contains, and the applications tools you can use to modify it.
The stack and heap are in constant flux within an applications allocated RAM space. RAM is an incredible tool: creating multiple spaces for applications and data, each of which continually expand and contract as the data is juggled and manipulated. Not only is the activity on a RAM module extremely fluid, it also is very fast. The current components can transfer data at speeds of 60 billionths of a second. Keep all of this in mind the next time youre tempted to complain about the high cost of memory.
How Does RAM Impact Performance?
Consider the analogy of a basic workspace, such as a drawing board. More
memory lets you create a larger drawing table to work on. This means that
you can lay out more of your project at one time, and work on it all at
once. In addition, you can have more tools, such as markers, brushes, straight
edges, and pencils at your elbow.
If your table is smaller, you may have to go over to the counter when you
need a specific tool, or file some pages away before you get any more. This
process of putting away and getting out is very slow. If your space is extremely
small, you may find that tools and artwork are just too close together and
that your space is cluttered. When this happens, you slow things down even
more, and run the risk of spilling, tearing or smudging the work due to
the close quarters youre working in.
As it is with the drawing board, so it is with RAM. More RAM gives the
stack and the heap more room to operate in. The first thing they do is to
open more resources from the application, and display as much file information
as possible. With less space, the OS has to continuously shuffle information
from your drive to RAM as it is needed. This shuffling is a slow process,
but thats not the whole picture.
When a large amount of space is allocated to RAM, the OS spaces out the various components throughout the RAM stack, which avoids fragmentation. Fragmentation is when the RAM stack forms pockets of unused space as various resources are plugged into and pulled out of the stack. More RAM allows the OS to keep larger blocks of memory open, which is all the more critical when working with large files. When working with smaller amounts of memory, the RAM space can become fragmented more quickly.
Some say that system crashes are a part of life, and that is why we should
save often and be patient. When crashes happen, we usually loose the data
we were working on, back to the previous saved version. This is a clue which
points us to a very important axiom for working on a desktop computer:
and almost all memory related crashes could be avoided if there were more RAM space to work in.
These errors occur in a number of ways. The stack can grow too large, expanding into the heap, crashing the application. In addition, two applications can lay claim to the same RAM address, which would result in a system error. While the OS segments RAM for each application, those segments are not cast in stone, and applications can overlap at times. Giving each app enough space to work in, or working in fewer apps at one time, will significantly reduce RAM related system crashes.