Computer Memory ? Different Types of Memory in Computer With Examples

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

Success Notes 4 U

Computer Memory ? Different Types Of Memory In Computer


With Examples

COMPUTER MEMORY

Memory is an essential element of a computer. Without its


memory, a computer is of hardly any use. Memory plays an
important role in saving and retrieving data. The performance of
the computer system depends upon the size of the memory.
Memory is of following types:

1. Primary Memory / Volatile Memory.


2. Secondary Memory / Non Volatile Memory.

1. Primary Memory / Volatile Memory: Primary Memory is


internal memory of the computer. RAM AND ROM both form part
of primary memory. The primary memory provides main working
space to the computer.The following terms comes under primary
memory of a computer are discussed below:
 Random Access Memory (RAM): The primary storage is
referred to as random access memory (RAM) because it is
possible to randomly select and use any location of the
memory directly store and retrieve data. It takes same time
to any address of the memory as the first address. It is also
called read/write memory. The storage of data and
instructions inside the primary storage is temporary. It
disappears from RAM as soon as the power to the computer
is switched off. The memories, which lose their content on
failure of power supply, are known as volatile memories .So
now we can say that RAM is volatile memory.

 Read Only Memory (ROM): There is another memory in


computer, which is called Read Only Memory (ROM). Again
it is the ICs inside the PC that form the ROM. The storage of
program and data in the ROM is permanent. The ROM
stores some standard processing programs supplied by the
manufacturers to operate the personal computer. The ROM
can only be read by the CPU but it cannot be changed. The
basic input/output program is stored in the ROM that
examines and initializes various equipment attached to the
PC when the power switch is ON. The memories, which do
not lose their content on failure of power supply, are known
as non-volatile memories. ROM is non-volatile memory.

 PROM: There is another type of primary memory in


computer, which is called Programmable Read Only Memory
(PROM). You know that it is not possible to modify or erase
programs stored in ROM, but it is possible for you to store
your program in PROM chip. Once the programmers’ are
written it cannot be changed and remain intact even if power
is switched off. Therefore programs or instructions written in
PROM or ROM cannot be erased or changed.

 EPROM: This stands for Erasable Programmable Read Only


Memory, which overcome the problem of PROM & ROM.
EPROM chip can be programmed time and again by erasing
the information stored earlier in it. Information stored in
EPROM exposing the chip for some time ultraviolet light and
it erases chip is reprogrammed using a special programming
facility. When the EPROM is in use information can only be
read.

 Cache Memory: The speed of CPU is extremely high


compared to the access time of main memory. Therefore the
performance of CPU decreases due to the slow speed of
main memory. To decrease the mismatch in operating
speed, a small memory chip is attached between CPU and
Main memory whose access time is very close to the
processing speed of CPU. It is called CACHE memory.
CACHE memories are accessed much faster than
conventional RAM. It is used to store programs or data
currently being executed or temporary data frequently used
by the CPU. So each memory makes main memory to be
faster and larger than it really is. It is also very expensive to
have bigger size of cache memory and its size is normally
kept small.

 Registers: The CPU processes data and instructions with


high speed; there is also movement of data between various
units of computer. It is necessary to transfer the processed
data with high speed. So the computer uses a number of
special memory units called registers. They are not part of
the main memory but they store data or information
temporarily and pass it on as directed by the control unit.

2. Secondary Memory / Non-Volatile Memory:  Secondary


memory is external and permanent in nature. The secondary
memory is concerned with magnetic memory. Secondary memory
can be stored on storage media like floppy disks, magnetic disks,
magnetic tapes, This memory can also be stored optically on
Optical disks - CD-ROM. The following terms comes under
secondary memory of a computer are discussed below:

 Magnetic Tape: Magnetic tapes are used for large


computers like mainframe computers where large volume of
data is stored for a longer time. In PC also you can use
tapes in the form of cassettes. The cost of storing data in
tapes is inexpensive. Tapes consist of magnetic materials
that store data permanently. It can be 12.5 mm to 25 mm
wide plastic film-type and 500 meter to 1200 meter long
which is coated with magnetic material. The deck is
connected to the central processor and information is fed
into or read from the tape through the processor. It’s similar
to cassette tape recorder.

 Magnetic Disk: You might have seen the gramophone


record, which is circular like a disk and coated with magnetic
material. Magnetic disks used in computer are made on the
same principle. It rotates with very high speed inside the
computer drive. Data is stored on both the surface of the
disk. Magnetic disks are most popular for direct access
storage device. Each disk consists of a number of invisible
concentric circles called tracks. Information is recorded on
tracks of a disk surface in the form of tiny magnetic spots.
The presence of a magnetic spot represents one bit and its
absence represents zero bit. The information stored in a disk
can be read many times without affecting the stored data. So
the reading operation is non-destructive. But if you want to
write a new data, then the existing data is erased from the
disk and new data is recorded.  For Example-Floppy Disk.

 Optical Disk: With every new application and software there


is greater demand for memory capacity. It is the necessity to
store large volume of data that has led to the development of
optical disk storage medium. Optical disks can be divided
into the following categories: 

1. Compact Disk/ Read Only Memory (CD-ROM


2. Write Once, Read Many (WORM)
3. Erasable Optical Disk

C/IL 102: Notes on Computer Memory/Storage

It may help to first review how quantities of memory/storage are


measured. A bit (which is contraction for "binary digit") is the
smallest unit of data, a single 0 or 1. Recall that computers
represent data (of all kinds, including numbers, characters,
images, and audio) using 0's and 1's. A byte is a unit of eight bits.
A kilobyte (KB) is 210 (approximately one thousand, or 103) bytes,
a megabyte (MB) is 220 (approximately one million, or 106) bytes,
a gigabyte (GB) is 230 (approximately one billion, or 109) bytes,
and a terabyte (TB) is 240 (approximately one trillion, or 1012)
bytes.

One could reasonably ask the question

Where are programs (i.e., software) and data stored?

The premise of the question is that the programs that a computer


executes, and the data that those programs manipulate, must
have some physical manifestation on some kind of storage
medium (or, plural, media) that is part of the computer system (or
accessible by it, at least). This gives rise to the next question:

What kinds of storage devices are found in computer


systems?

The answer may be a bit more involved than you would expect,
because there are a perhaps surprisingly large number of
different kinds of storage devices. The outline below seeks to
identify these and to provide a logical way of organizing them.

Primary (or Main) Memory

 Registers: These are memory cells (typically four or eight


bytes in size) that are part of the processor itself, so that
operations (e.g. addition, comparison, etc.) can be
performed directly upon data stored therein (and usually
within a single clock cycle, which is less than a billionth of a
second!). Indeed, only data items (including instructions) that
are being held in a register can be operated upon by the
processor. Hence, any data item in RAM that is to be used
for some purpose first must be transferred into a register.

In order to keep the electronic circuitry of the processor at a


reasonable level of complexity, the number of registers is
quite small, typically no more than a few dozen.
 Cache: This is a block of very high-speed (and expensive)
memory cells (typically four bytes in length) used for storing
copies of data items also being held in RAM (see below) that
have been accessed very recently or are anticipated to be
accessed in the very near future. Due to its high cost, cache
capacity is typically limited (this is in early 2009) to the
neighborhood of 512KB (one-half MB) to 4MB.

Some processors have multiple levels of cache (usually


referred to as L1 and L2, for example), with L1 being faster
(access within a few clock cycles) but having lower capacity
(e.g., tens of KB) than L2 (access to which requires tens of
cycles).

 Random Access Memory (RAM): This is a block of fairly


high-speed memory cells that are used for storing (portions
of) currently-executing programs and data that those
programs are using. In early 2008, it was typical for a
"desktop" or "laptop" computer to have RAM with a capacity
of between 512MB (0.5GB) and 4GB. The price of RAM at
that time was about $25 per GB.

The term "random" is meant to suggest that the time


required to access any particular memory location in RAM is
independent of which memory location was accessed most
recently. (This is in contrast to accessing the "data" on a
VHS or audio cassette tape, which are "sequential" (rather
than "random") storage devices. Suppose, for example, that
a VHS tape is fully rewound; then to get to the fifth hour of
video stored on that tape, you must fast forward past the first
four hours. On the other hand, if the tape were already at the
beginning of the fourth hour, you could get to the fifth hour
by fast forwarding past only one hour of video.
Regarding the interplay between cache and RAM: Roughly
speaking, whenever the CPU needs to fetch the data
occupying some particular memory cell in RAM, first it looks
in cache to see if a copy is already there. If so, it accesses
that copy in a fraction of the time that would have been
required to access the corresponding cell in RAM. If not, it
accesses the desired cell of RAM; also, anticipating that that
same cell of RAM will need to be accessed again in the near
future, the CPU copies that cell's contents (as well as that of
a block of neighoring cells) into cache (replacing some block
of data items that hasn't been accessed recently).

The introduction of cache is a relatively new development,


motivated by the fact that (as processor and memory
technology has advanced over the years) the ratio between
the time needed to transfer data between RAM and a
register and the time needed to perform an operation on
data (that is necessarily already in a register) has been
steadily growing, to the point where, without cache, the CPU
would be spending the vast majority of its time waiting for
data to be transferred between RAM and registers. This
phenomenon is sometimes referred to as the processor-
memory bottleneck.

The term transitory can be used to describe the kinds of


main memory listed so far. This term is apt because their
intended purpose is not to store anything for long, but rather
to provide fast access to data (and instructions) currently
being used (i.e., related to applications currently running and
whatever data they are using). Because there is no need to
store data in main memory permanently (see exception
below), and because it is cheaper to do so, registers, cache,
and RAM are designed to be volatile, meaning that, absent
a constant application of electrical power, they lose their
contents relatively quickly.
 Read-only Memory (ROM): A small block of (non-volatile)
memory having as one of its purposes to store instructions
that are executed whenever the computer is turned on,
commencing the so-called "boot-strapping" process by which
(crucial components of) the operating system is loaded into
RAM, thereby allowing the computer to begin functioning.
(From this description, it should be fairly clear why it is vital
for ROM to be non-volatile.)

Secondary Storage

The purpose of secondary storage is to store data and programs


on a long-term basis. (Hence, all forms of secondary storage are
non-volatile, meaning that they retain the data stored on them
(for a long period of time) without the need for electrical power.)
As data (or a program) is needed in RAM (e.g., when a program
is called upon to be executed, such as when the user double
clicks upon an icon representing that program), it is copied from
secondary storage into RAM, where it can be accessed quickly.

Among the types of secondary storage media are these:

 Solid-State: For example, flash memory sticks; these


usually are attached to a computer via a USB port and have
a capacity in the hundreds of MB or a few GB's. They are
highly mobile and have largely supplanted floppy disks in
recent times. This kind of storage is widely used in devices
such as PDA's and digital cameras.
 Magnetic Disk: These are disks on which data is recorded
on a set of concentric rings (or "tracks") (see the figure about
4/5-ths of the way through How Hard Disks Work) using
properties of magnetism.
o hard disk: high storage capacity (in early 2008,
typically in the range of 80 to 320 GB) and much
cheaper than RAM (in early 2008, about $0.25 per GB,
which is about 1/100 the price of RAM)
o removable/portable disk: zip disk, disk cartridge, floppy
disk
 Optical Disc: These are discs on which data is represented
by a spiraling track of "pits and lands" (or valleys and bumps,
if you prefer). A laser beam is used to "read" the data on the
surface.
o CD-ROM: "Read Only" (used for distribution of
commercial software, for example) Standard storage
capacity is 640MB.
o CD-R (or CD-WORM): "Write Once, Read Many" times
o CD-RW: rewritable multiple times (but you can't really
delete a file without deleting all of them!)
o DVD: similar to CD, but with significantly larger storage
capacity (4.7GB)
 Magnetic Tape: usually used for making backup copies of
disk (so that if the disk fails, a recent copy of its contents can
be recovered and written onto a new replacement disk) or for
archival storage. Tapes that are kept offline (meaning that
they sit on a shelf and are "mounted" onto a tape drive (by a
human or a robotic device) only when needed) are
sometimes put into the category of tertiary, as opposed to
secondary, storage. Tape drives are what you see spinning
in the background in numerous scenes in movies and TV
shows depicting a large computer.

As for why there are so many varieties of storage devices, it boils


down mostly to considerations of cost, mobility (removability), and
advances in technology.

As a general rule of thumb (and not surprisingly), the cost of


memory/storage (in dollars per unit of storage) varies with the
"speed" of the storage device: the faster the device, the higher the
cost (per MB). For example, main memory costs much more than
an equal quantity of space in secondary storage, by a factor in the
hundreds. (In early 2008, space on a hard disk cost about $0.25
per GB, but RAM was $25 per GB, making RAM about 100 times
as expensive.) Hence, even if RAM were designed to be non-
volatile (and hence suitable for storing data on a long-term basis)
it would be prohibitively expensive to replace hundreds of
gigabytes of hard disk storage space with an equal quantity of
RAM. (Do the calculation: 100GB of RAM would cost about $2500
compared to $25 for 100GB of hard disk space. Hence,
substituting non-volatile RAM for hard disk would increase the
cost of a PC substantially!)

On the other hand, if, in an effort to minimize storage costs, we


reduced main memory to a bare-bones level, we would find that
performance would suffer terribly, because it would be necessary
to store/retrieve data onto/from secondary storage more often,
and the ratio between access times to secondary storage and
main memory is on the order of hundreds of thousands to one.

What is virtual memory?

The purpose of RAM is to store the programs that are currently


running and the data that those programs are processing, so that
instructions and data needed by the CPU can be copied into
registers (where the CPU can actually make use of them) quickly.

However, it often happens that RAM is not large enough to fit all
running programs and their data. To alleviate this situation, many
modern operating systems implement virtual memory, which
basically means that some secondary storage (typically some
segment of a hard disk) is used for holding portions of
programs/data that, logically speaking, are considered to be in
RAM. Whenever the CPU attempts to fetch an instruction or data
item from virtual memory, first it must be confirmed that that
instruction or data item is actually in RAM. If it is, access
proceeds normally. If not, whatever "page" of virtual memory
holds the desired item must first be "swapped" into RAM (from the
disk), replacing some page of data that was already there, which
itself gets written to the disk. The effect of virtual memory, then, is
to, in a sense, make RAM seem much larger than it actually is.

The relationship between RAM and virtual memory is analagous


to that between cache and RAM.

Among the benefits of virtual memory is that it gives programmers


the freedom to develop programs without worrying too much
about how much memory a program (or its data) will occupy.
From the user's point of view, it makes it possible to run lots of
programs simultaneously without having to worry about the
machine "crashing" due to a lack of space in RAM.

Sometimes, when virtual memory is being stretched to its limit,


page swapping becomes so frequent that system performance
degrades very badly. (Note that swapping one page for another is
a very time-consuming operation, which, in the context of an
electronic digital computer, can mean a duration of as little as a
hundredth or thousandth of a second.) This is referred to as
thrashing. Of course, the larger RAM's capacity, the less will be
the need for swapping and hence the less likely that thrashing will
occur. If bouts of thrashing are adversely affecting you, don't buy
a faster CPU. Rather, install more RAM!!

Links to Related Information

 Memory hierarchy (wikipedia)   diagram depicting memory


hierarchy (wikipedia)
 How Hard Disks Work (how stuff works)
 How Computer Memory Works (how stuff works)
 Computer Memory (at programmedlessons.org)

You might also like