Unit 2 - Memory Computer Fundamental KKSU
Unit 2 - Memory Computer Fundamental KKSU
What is Memory:
A memory is just like a human brain. It is used to store data and instructions.
Computer memory is the storage space in the computer, where data is to be
processed and instructions required for processing are stored.
The memory is divided into large number of small parts called cells. Each
location or cell has a unique address, which varies from zero to memory size
minus one.
Example: , if the file has 64k size, then 64 * 1024 = 65536 memory
locations. The address of these varies from 0 to 65535.
A memory unit is the amount of data that the memory can hold. Besides, we
measure this storage capacity in terms of bytes. Moreover, there are different
units of memory as per the requirement.
Nibble
2
A group of 4 bits is called nibble.
Byte
3 A group of 8 bits is called byte. A byte is the smallest unit, which can
represent a data item or a character.
1
Word
A computer word, like a byte, is a group of fixed number of bits
processed as a unit, which varies from computer to computer but is
4 fixed for each computer.
The length of a computer word is called word-size or word length. It
may be as small as 8 bits or may be as long as 96 bits. A computer
stores the information in the form of computer words.
Kilobyte (KB)
1 1 KB = 1024 Bytes (2^10) bytes. Ex: Any small text file can take
2KB to 4 kb size
Megabyte (MB)
1 MB = 1024 KB or 1048576 (2^20) bytes. or 1024^2 = 1,048,576
2 bytes.
Ex: high-resolution JPEG image might range in size from 1-5
megabytes
GigaByte (GB)
3 1 GB = 1024 MB or 1024^3 bytes or 1073741824 (2^30) bytes.
Ex: a standard DVD drive can hold 4.7 GBs of data.
TeraByte (TB)
4 1 TB = 1024 GB or 2^40 bytes.
e.g., a typical internal HDD may hold 2 Terabytes of data
PetaByte (PB)
5
1 PB = 1024 TB or 2^50 bytes. used to measure the total data
stored in large networks or server farms. For example, Internet
2
Giants like Google and Facebook store more than over 100 PBs of
data on their data servers.
Exabyte: (EB)
Zettabyte: (ZB)
Yottabyte: (YB)
3
In general, memory can be divided into primary and secondary memory;
moreover, there are numerous types of memory
4
Memory is primarily of three types −
• Cache Memory
• Primary Memory/Main Memory
• Secondary Memory
Cache Memory
Cache memory is a very high speed semiconductor memory which can
speed up the CPU. It acts as a buffer between the CPU and the main memory.
It is used to hold those parts of data and program which are most frequently
used by the CPU. The parts of data and programs are transferred from the
disk to cache memory by the operating system, from where the CPU can
access them.
Cache memory is placed in between the CPU and the RAM. Cache
memory is a fast memory, faster than the RAM.
When the CPU needs an instruction or data during processing, it first looks in
the cache.
The data and instructions that are required during the processing of data
are brought from the secondary storage devices and stored in the RAM. For
processing, it is required that the data and instructions are accessed from the
RAM and stored in the registers. The time taken to move the data between
RAM and CPU registers is large. This affects the speed of processing of
computer, and results in decreasing the performance of CPU.
Cache memory is a very high speed memory placed in between RAM and CPU.
Cache memory increases the speed of processing.
During processing, CPU first checks cache for the required data. If data is not
found in cache, then it looks in the RAM for data.
5
Cache memory is very expensive, so it is smaller in size. Generally, computers
have cache memory of sizes 256 KB to 2 MB.
The CPU has a built-in Level 1 (L1) cache and Level2 (L2) cache, as shown in
figure In addition to the built-in L1 and L2 cache, some CPUs have a separate
cache chip on the motherboard.
Nowadays, high-end processor comes with built-in L3 cache, like in Intel core
i7. Typically, CPUs have cache size varying from 256KB (L1), 6 MB (L2), to
12MB (L3) cache.
Register
Register are very high-speed storage areas located inside the CPU. After
CPU gets the data and instructions from the cache or RAM, the data and
instructions are moved to the registers for processing.
Registers are manipulated directly by the control unit of CPU during
instruction execution. That is why registers are often referred to as the CPU’s
working memory.
Registers are not referenced by their address, but are directly accessed
and manipulated by the CPU during instruction execution
The data and instructions that require processing must be brought in the
registers of CPU before they can be processed. For example, if two numbers
are to be added, both numbers are brought in the registers, added and the
result is also placed in a register.
6
Some of the important registers in CPU are as follows—
Since CPU uses registers for the processing of data, the number of
registers in a CPU and the size of each register affect the power and speed of
a CPU. The more the number of registers (ten to hundreds) and bigger the
size of each register (8 bits to 64 bits), the better it is.
Primary memory holds only those data and instructions on which the
computer is currently working. It has a limited capacity and data is lost when
power is switched off. It is generally made up of semiconductor device. These
memories are not as fast as registers. The data and instruction required to be
processed resides in the main memory. Primary memory is categorized into
two main types-
7
• Faster than secondary memories.
• A computer cannot run without the primary memory.
CPU interacts with RAM to get the data and instructions for processing.
--RAM provides random access to the stored bytes, words, or larger data
units. This means that it requires same amount of time to access information
from RAM, irrespective of where it is located in it.
--RAM can be read from and written to with the same speed.
--The size of RAM is limited due to its high cost. The size of RAM is measured
in MB or GB.
Data transfer unit size (how much information can be retrieved in one
request).
--RAM affects the speed and power of a computer. More the RAM, the better it
is. Nowadays, computers generally have 512 MB to 4 GB of RAM.
8
(1) Dynamic RAM (DRAM), and
(2) Static RAM (SRAM).
DRAM
is the most common type of memory chip. DRAM is mostly used as main
memory since it is small and cheap.
- It uses transistors and capacitors. The transistors are arranged in a matrix
of rows and columns. The capacitor holds the bit of information 0 and 1. The
transistor and capacitor are paired to make a memory cell. The transistor acts
as a switch that lets the control circuitry on the memory chip read the
capacitor or change its state.
-DRAM gets its name from the refresh operation that it requires to store the
information; otherwise it will lose what it is holding. The refresh operation
occurs automatically thousands of times per second. DRAM is slow because
the refreshing takes time.
SRAM
9
- SRAM uses multiple transistors (four to six), for each memory cell. It does
not have a capacitor in each cell.
- A SRAM memory cell has more parts so it takes more space on a chip than
DRAM cell.
- It does not need constant refreshing and therefore is faster than DRAM.
- SRAM is more expensive than DRAM, and it takes up more space.
- It stores information as long as it is supplied with power.
- SRAM are easier to use and very fast. The access speed of SRAM ranges
from 2– 10 nanosecond.
Characteristic of Static RAM
• Long life
• No need to refresh
• Faster
• Used as cache memory
• Large size
• Expensive
• High power consumption
10
ROM:
ROM stands for Read Only Memory. The memory from which we can only
read but cannot write on it. This type of memory is non-volatile. The
information is stored permanently in such memories during manufacture. A
ROM stores such instructions that are required to start a computer. This
operation is referred to as bootstrap.
The ROM memory chip stores the Basic Input Output System (BIOS). BIOS
provides the processor with the information required to boot the system. It
provides the system with the settings and resources that are available on the
system. BIOS is a permanent part of the computer. It does not load from disk
but instead is stored in a ROM memory chip. The program code in the BIOS
differs from ordinary software since it acts as an integral part of the
computer.
ROM chips are not only used in the computer but also in other electronic items
like washing machine and microwave oven.
Let us now discuss the various types of ROMs and their characteristics.
11
EPROM (Erasable and Programmable Read Only Memory)
EPROM can be erased by exposing it to ultra-violet light for a duration of up to
40 minutes. Usually, an EPROM eraser achieves this function. During
programming, an electrical charge is trapped in an insulated gate region. The
charge is retained for more than 10 years because the charge has no leakage
path. For erasing this charge, ultra-violet light is passed through a quartz
crystal window (lid). This exposure to ultra-violet light dissipates the charge.
During normal use, the quartz lid is sealed with a sticker.
Advantages of ROM
The advantages of ROM are as follows −
• Non-volatile in nature
• Cannot be accidentally changed
• Cheaper than RAMs
• Easy to test
• More reliable than RAMs
12
• Static and do not require refreshing
• Contents are always known and can be verified
Secondary Memory
13
ACCESS TYPES OF STORAGE DEVICES
The information stored in storage devices can be accessed in two ways—
1. Sequential access
2. Direct access
Sequential access means that computer must run through the data in
sequence, starting from the beginning, in order to locate a particular piece of
data. Magnetic tape is an example of sequential access device. Let us suppose
that magnetic tape consists of 80 records. To access the 25th record, the
computer starts from first record, then reaches second, third etc. until it
reaches the 25th record. Sequential access devices are generally slow devices.
Magnetic tape is the common sequential access storage device.
14
unparalleled amounts of data to be mechanically created, stored for
long periods, and rapidly accessed.
Direct access devices are the ones in which any piece of data can be retrieved
in a non-sequential manner by locating it using the data’s address. It accesses
the data directly, from a desired location. Magnetic disks and optical disks are
examples of direct access devices. There is no predefined order in which one
can read and write data from a direct access device. In a magnetic disk
consisting of 80 records, to access the 25th record, the computer can directly
access the 25th record, without going past the first 24 records. Based on
access, magnetic tapes are sequential access devices, and, magnetic disks,
optical disk and magneto-optical disks are direct access devices.
15
ii. Hard Disk Drive (HDD): Hard disk drive comprises a series of circular
disks called platters arranged one over the other almost ½ inches apart
around a spindle. Disks are made of non-magnetic material like
aluminium alloy and coated with 10-20 nm magnetic material. The
standard diameter of these disks is 14 inches, and they rotate with
speeds varying from 4200 rpm (rotations per minute) for personal
computers to 15000 rpm for servers.
Data is stored by magnetizing or demagnetizing the magnetic coating. A
magnetic reader arm is used to read data from and write data to the
disks. A typical modern HDD has a capacity in terabytes (TB).
16
2. Optical Disk: An optical disk is any computer disk that uses optical
storage techniques and technology to read and write data. It is a computer
storage disk that stores data digitally and uses laser beams to read and write
data.
An optical disk consists of a single spiral track that starts from the edge to the
centre of disk. Due to its spiral shape, it can access large amount of data
sequentially, for example music and video. The random access on optical disk
is slower than that of magnetic disk, due to its spiral shape.
The tracks on optical disk are further divided into sectors which are of same
length. Optical disks are generally slower than hard disks.
i. CD Drive: CD stands for Compact Disk. CDs are circular disks that use
optical rays, usually lasers, to read and write data. They are very cheap
as you can get 700 MB of storage space for less than a dollar. CDs are
inserted in CD drives built into the CPU cabinet. They are portable as
you can eject the drive, remove the CD and carry it with you. There are
three types of CDs:
17
o CD-ROM (Compact Disk - Read Only Memory): The
manufacturer recorded the data on these CDs. Proprietary
Software, audio or video are released on CD-ROMs.
ii. DVD Drive: DVD stands for digital video display. DVD is an optical
device that can store 15 times the data held by CDs. They are usually
used to store rich multimedia files that need high storage capacity.
DVDs also come in three varieties - read-only, recordable and
rewritable.
iii. Blu Ray Disk: Blu Ray Disk (BD) is an optical storage media that stores
high definition (HD) video and other multimedia files. BD uses a shorter
wavelength laser than CD/DVD, enabling the writing arm to focus more
tightly on the disk and pack in more data. BDs can store up to 128 GB
of data.
18
Memory vs. storage
The concept of memory and storage can be easily conflated as the same
concept; however, there are some distinct and important differences. Put
succinctly, memory is primary memory, while storage is secondary memory.
Memory refers to the location of short-term data, while storage refers to the
location of data stored on a long-term basis.
19
time because primary memory is volatile, meaning it isn't retained when the
computer is turned off.
The terms memory and storage can be confusing because their usage today is
not always consistent. For example, RAM can be referred to as primary
storage -- and types of secondary storage can include flash memory. To avoid
confusion, it can be easier to talk about memory in terms of whether it is
volatile or nonvolatile -- and storage in terms of whether it is primary or
secondary.
20