0% found this document useful (0 votes)
14 views32 pages

Hadoop

Computer memory is a physical device used to store data, information, or instructions temporarily or permanently, organized into cells with unique addresses. It is essential for storing various types of data and can be classified into primary (RAM and ROM) and secondary memory, with different features such as capacity, access methods, and performance. RAM is volatile and allows read/write operations, while ROM is non-volatile and used for permanent storage, with various types including MROM, PROM, EPROM, EEPROM, and Flash ROM.

Uploaded by

Hiya Paliwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views32 pages

Hadoop

Computer memory is a physical device used to store data, information, or instructions temporarily or permanently, organized into cells with unique addresses. It is essential for storing various types of data and can be classified into primary (RAM and ROM) and secondary memory, with different features such as capacity, access methods, and performance. RAM is volatile and allows read/write operations, while ROM is non-volatile and used for permanent storage, with various types including MROM, PROM, EPROM, EEPROM, and Flash ROM.

Uploaded by

Hiya Paliwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Memory Organization

What is computer memory?


Computer memory is any physical device, used to
store data, information or instruction temporarily
or permanently. It is the collection of storage units
that stores binary information in the form of bits.
The memory block is split into a small number of
components, called cells. Each cell has a unique
address to store the data in memory, ranging from
zero to memory size minus one. For example, if
the size of computer memory is 64k words, the
memory units have 64 * 1024 = 65536 locations or
cells. The address of the memory's cells varies
from 0 to 65535.
Why do we need a computer memory?
In the computer system, we need computer
memory to store various types of data like text,
images, video, audio, documents, etc. We can
retrieve it when the data is required. For example,
when we write and execute any computer program,
it is initially stored in primary memory. If the
processor does not need particular items for a
longer time, the program or data is automatically
saved into the permanent or secondary memory.
Then the data is called from secondary memory to
main memory and performs the execution of codes.
Features of Memory
Following are the different features of the memory
system that includes:
1.Location: It represents the internal or external
location of the memory in a computer. The
internal memory is inbuilt in computer
memory. It is also known as primary memory.
the example of primary memory are registers,
cache and main memory. Whereas, external
memory is the separate storage device from
the computer, such as disk, tape, USB pen
drive.
2.Capacity: It is the most important feature of
computer memory. Storage capacity can vary
in external and internal memory. External
devices' storage capacity is measured in terms
of bytes, whereas the internal memory is
measured with bytes or words. The storage
word length can vary in bits, such as 8, 16 or
32 bits.
3.Access Methods: Memory can be accessed
through four modes of memory.
o DMA: As the name specifies, Direct
Memory Address (DMA) is a method that
allows input/output (I/O) devices to access
or retrieve data directly or from the main
memory.
o Sequential Access Method: The
sequential access method is used in a data
storage device to read stored data
sequentially from the computer memory.
Whereas, the data received from random
access memory (RAM) can be in any
order.
o Random Access Method: It is a method
used to randomly access data from
memory. This method is the opposite of
SAM. For example, to go from A to Z in
random access, we can directly jump to
any specified location. In the Sequential
method, we have to follow all intervening
from A to Z to reach at the particular
memory location.
o Associative Access Method: It is a
special type of memory that optimizes
search performance through defined data
to directly access the stored information
based on a memory address.
4.Unit of transfer: As the name suggests, a unit
of transfer measures the transfer rate of bits
that can be read or write in or out of the
memory devices. The transfer rate of data can
be different in external and internal memory.
o Internal memory: The transfer rate of

bits is mostly equal to the word size.


o External memory: The transfer rate of bit

or unit is not equal to the word length. It is


always greater than a word or may be
referred to as blocks.
5.Performance: The performance of memory is
majorly divided into three parts.
o Access Time: In random access memory,

it represents the total time taken by


memory devices to perform a read or write
operation that an address is sent to
memory.
o Memory Cycle Time: Total time required

to access memory block and additional


required time before starting second
access.
o Transfer rate: It describes the transfer

rate of data used to transmit memory to or


from an external or internal memory
device. Bit transfer can be different for
different external and internal devices.
6.Physical types: It defines the physical type of
memory used in a computer such as magnetic,
semiconductor, magneto-optical and optical.
7.Organization: It defines the physical structure
of the bits used in memory.
8.Physical characteristics: It specifies the
physical behaviour of the memory like volatile,
non-volatile or non-erasable memory. Volatile
memory is known as RAM, which requires
power to retain stored information, and if any
power loss has occurred, stored data will be
lost. Non-volatile memory is a permanent
storage memory that is used to obtain any
stored information, even when the power is off.
Non-erasable memory is a type of memory
that cannot be erased after the manufactured
like ROM because at the time of manufactured
ROM are programmed.
Classification of Memory
The following figure represents the classification
of memory:

Primary or Main Memory


Primary memory is also known as the computer
system's main memory that communicates directly
within the CPU, Auxiliary memory and the Cache
memory. Main memory is used to kept programs
or data when the processor is active to use them.
When a program or data is activated to execute,
the processor first loads instructions or programs
from secondary memory into main memory, and
then the processor starts execution. Accessing or
executing of data from primary memory is faster
because it has a cache or register memory that
provides faster response, and it is located closer to
the CPU. The primary memory is volatile, which
means the data in memory can be lost if it is not
saved when a power failure occurs. It is costlier
than secondary memory, and the main memory
capacity is limited as compared to secondary
memory.
The primary memory is further divided into two
parts:
1.RAM (Random Access Memory)
2.ROM (Read Only Memory)
Random Access Memory (RAM)
Random Access Memory (RAM) is one of the
faster types of main memory accessed directly by
the CPU. It is the hardware in a computer device
to temporarily store data, programs or program
results. It is used to read/write data in memory
until the machine is working. It is volatile, which
means if a power failure occurs or the computer is
turned off, the information stored in RAM will be
lost. All data stored in computer memory can be
read or accessed randomly at any time.

There are two types of RAM:


o SRAM
o DRAM
DRAM: DRAM (Dynamic Random-Access
Memory) is a type of RAM that is used for the
dynamic storage of data in RAM. In DRAM, each
cell carries one-bit information. The cell is made
up of two parts: a capacitor and a transistor. The
size of the capacitor and the transistor is so small,
requiring millions of them to store on a single chip.
Hence, a DRAM chip can hold more data than an
SRAM chip of the same size. However, the
capacitor needs to be continuously refreshed to
retain information because DRAM is volatile. If
the power is switched off, the data store in
memory is lost.

Characteristics of DRAM
1.It requires continuously refreshed to retain the
data.
2.It is slower than SRAM
3.It holds a large amount of data
4.It is the combination of capacitor and
transistor
5.It is less expensive as compared to SRAM
6.Less power consumption
SRAM: SRMA (Static Random-Access
Memory) is a type of RAM used to store static
data in the memory. It means to store data in
SRAM remains active as long as the computer
system has a power supply. However, data is lost
in SRAM when power failures have occurred.
Characteristics of Static Ram
1.It does not require to refresh.
2.It is faster than DRAM
3.It is expensive.
4.High power consumption
5.Longer life
6.Large size
7.Uses as a cache memory

SRAM Vs. DRAM

SRAM DRAM
It is a Static Random- It is a Dynamic Random
Access Memory. Access Memory.
The access time of SRAM is The access time of
slow. DRAM is high.
It uses flip-flops to store It uses a capacitor to
each bit of information. store each bit of
information.
It does not require periodic It requires periodically
refreshing to preserve the refreshing to preserve
information. the information.
It uses in cache memory. It is used in the main
memory.
The cost of SRAM is The cost of DRAM is
expensive. less expensive.
It has a complex structure. Its structure is simple.
It requires low power It requires more power
consumption. consumption.

Advantages of RAM
o It is a faster type of memory in a computer.
o It requires less power to operate.
o Program loads much faster
o More RAM increases the performance of a
system and can multitask.
o Perform read and write operations.
o The processor can read information faster than
a hard disc, floppy, USB, etc.
Disadvantages of RAM
o Less RAM reduces the speed and performance
of a computer.
o Due to volatile, it requires electricity to
preserve the data.
o It is expensive than ROM
o It is unreliable as compared to ROM
o The Size of RAM is limited.
Read-Only Memory (ROM)
ROM is a memory device or storage medium that
is used to permanently store information inside a
chip. It is a read-only memory that can only read
stored information, data or programs, but we
cannot write or modify anything. A ROM contains
some important instructions or program data that
are required to start or boot a computer. It is
a non-volatile memory; it means that the stored
information cannot be lost even when the power is
turned off or the system is shut down.

Types of ROM
There are five types of Read Only Memory:
1.MROM (Masked Read Only Memory):
MROM is the oldest type of read-only
memory whose program or data is pre-
configured by the integrated circuit
manufacture at the time of manufacturing.
Therefore, a program or instruction stored
within the MROM chip cannot be changed by
the user.
2.PROM (Programmable Read Only
Memory):
It is a type of digital read-only memory, in
which the user can write any type of
information or program only once. It means it
is the empty PROM chip in which the user can
write the desired content or program only once
using the special PROM programmer or
PROM burner device; after that, the data or
instruction cannot be changed or erased.
3.EPROM (Erasable and Programmable
Read Only Memory):
It is the type of read only memory in which
stored data can be erased and re-programmed
only once in the EPROM memory. It is a non-
volatile memory chip that holds data when
there is no power supply and can also store
data for a minimum of 10 to 20 years. In
EPROM, if we want to erase any stored data
and re-programmed it, first, we need to pass
the ultraviolet light for 40 minutes to erase the
data; after that, the data is re-created in
EPROM.
4.EEPROM (Electrically Erasable and
Programmable Read Only Memory):
The EEROM is an electrically erasable and
programmable read only memory used to erase
stored data using a high voltage electrical
charge and re-programmed it. It is also a non-
volatile memory whose data cannot be erased
or lost; even the power is turned off. In
EEPROM, the stored data can be erased and
reprogrammed up to 10 thousand times, and
the data erase one byte at a time.
5.Flash ROM:
Flash memory is a non-volatile storage
memory chip that can be written or
programmed in small units called Block or
Sector. Flash Memory is an EEPROM form of
computer memory, and the contents or data
cannot be lost when the power source is turned
off. It is also used to transfer data between the
computer and digital devices.
Advantages of ROM
1.It is a non-volatile memory in which stored
information can be lost even power is turned
off.
2.It is static, so it does not require refreshing the
content every time.
3.Data can be stored permanently.
4.It is easy to test and store large data as
compared to RAM.
5.These cannot be changed accidently
6.It is cheaper than RAM.
7.It is simple and reliable as compared to RAM.
8.It helps to start the computer and loads the OS.
Disadvantages of ROM
1.Store data cannot be updated or modify except
to read the existing data.
2.It is a slower memory than RAM to access the
stored data.
3.It takes around 40 minutes to destroy the
existing data using the high charge of
ultraviolet light.
RAM Vs. ROM
RAM ROM
It is a Random-Access It is a Read Only Memory.
Memory.
Read and write operations Only Read operation can
can be performed. be performed.
Data can be lost in volatile Data cannot be lost in non-
memory when the power volatile memory when the
supply is turned off. power supply is turned off.
It is a faster and expensive It is a slower and less
memory. expensive memory.
Storage data requires to be Storage data does not need
refreshed in RAM. to be refreshed in ROM.
The size of the chip is The size of the chip is
bigger than the ROM chip smaller than the RAM chip
to store the data. to store the same amount
of data.
Types of RAM: DRAM Types of ROM: MROM,
and SRAM PROM, EPROM,
EEPROM

Cache Memory
It is a small-sized chip-based computer memory
that lies between the CPU and the main memory. It
is a faster, high performance and temporary
memory to enhance the performance of the CPU.
It stores all the data and instructions that are often
used by computer CPUs. It also reduces the access
time of data from the main memory. It is faster
than the main memory, and sometimes, it is also
called CPU memory because it is very close to the
CPU chip. The following are the levels of cache
memory.

1.L1 Cache: The L1 cache is also known as the


onboard, internal, or primary cache. It is built
with the help of the CPU. Its speed is very
high, and the size of the L1 cache varies from
8 KB to 128 KB.
2.L2 Cache: It is also known as external or
secondary cache, which requires fast access
time to store temporary data. It is built into a
separate chip in a motherboard, not built into
the CPU like the L1 level. The size of the L2
cache may be 128 KB to 1 MB.
3.L3 Cache: L3 cache levels are generally used
with high performance and capacity of the
computer. It is built into a motherboard. Its
speed is very slow, and the maximum size up
to 8 MB.

Advantages of Cache Memory


1.Cache memory is the faster memory as
compared to the main memory.
2.It stores all data and instructions that are
repeatedly used by the CPU for improving the
performance of a computer.
3.The access time of data is less than the main
memory.
Disadvantage of Cache Memory
1.It is very costly as compared to the Main
memory and the Secondary memory.
2.It has limited storage capacity.
Register Memory
The register memory is a temporary storage
area for storing and transferring the data and
the instructions to a computer. It is the smallest
and fastest memory of a computer. It is a part
of computer memory located in the CPU as the
form of registers. The register memory is 16, 32
and 64 bits in size. It temporarily stores data
instructions and the address of the memory that
is repeatedly used to provide faster response to
the CPU. Characteristics of Cache Memory

Cache memory

 Cache memory is an extremely fast memory


type that acts as a buffer between RAM and
the CPU.
 Cache Memory holds frequently requested
data and instructions so that they are
immediately available to the CPU when
needed.
 Cache memory is costlier than main
memory or disk memory but more
economical than CPU registers.
 Cache Memory is used to speed up and
synchronize with a high-speed CPU.
Cache Memory

Levels of Memory
 Level 1 or Register: It is a type of memory

in which data is stored and accepted that are


immediately stored in the CPU. The most
commonly used register is Accumulator,
Program counter, Address Register, etc.
 Level 2 or Cache memory: It is the fastest

memory that has faster access time where


data is temporarily stored for faster access.
 Level 3 or Main Memory: It is the
memory on which the computer works
currently. It is small in size and once power
is off data no longer stays in this memory.
 Level 4 or Secondary Memory: It is
external memory that is not as fast as the
main memory but data stays permanently in
this memory.
They represent the subsequent categories:
Cache size, Block size, Mapping function,
Replacement algorithm, and Write policy.
These are explained as following below.

 Cache Size: It seems that moderately tiny


caches will have a big impact on
performance.
 Block Size: Block size is the unit of
information changed between cache and
main memory. As the block size will
increase from terribly tiny to larger sizes,
the hit magnitude relation can initially
increase as a result of the principle of
locality. The high chance that knowledge
within the neck of the woods of a
documented word square measure
possible to be documented within the
close to future. As the block size increases,
a lot of helpful knowledge square measure
brought into the cache. The hit magnitude
relation can begin to decrease, however,
because the block becomes even larger
and also the chance of victimization the
new fetched knowledge becomes but the
chance of reusing the information that
ought to be abstracted of the cache to form
area for the new block.
 Mapping Function: When a replacement
block of data is scan into the cache, the
mapping performs determines that cache
location the block will occupy. Two
constraints have an effect on the planning
of the mapping perform. First, once one
block is scan in, another could be replaced.
We would wish to do that in such the
simplest way to minimize the chance that
we are going to replace a block which will
be required within the close to future. A
lot of versatile the mapping perform, a lot
of scopes we’ve to style a replacement
algorithmic rule to maximize the hit
magnitude relation. Second, a lot of
versatile the mapping perform, a lot of
advanced is that the electronic equipment
needed to look the cache to see if a given
block is within the cache.
 Replacement Algorithm: The
replacement algorithmic rule chooses, at
intervals, the constraints of the mapping
perform, which block to interchange once
a replacement block is to be loaded into
the cache and also the cache already has
all slots full of alternative blocks. We
would wish to replace the block that’s
least possible to be required once more
within the close to future. Although it’s
impossible to spot such a block, a fairly
effective strategy is to interchange the
block that has been within the cache
longest with no relevance. This policy is
spoken because of the least-recently-used
(LRU) algorithmic rule. Hardware
mechanisms square measure required to
spot the least-recently-used block
 Write Policy: If the contents of a block
within the cache square measure altered,
then it’s necessary to write down it back
to main memory before exchange it. The
written policy dictates once the memory
write operation takes place. At one
extreme, the writing will occur whenever
the block is updated. At the opposite
extreme, the writing happens only if the
block is replaced. The latter policy
minimizes memory write operations
however leaves the main memory in
associate obsolete state. This can interfere
with the multiple-processor operation and
with direct operation by I/O hardware
modules.
Cache Performance
When the processor needs to read or write a
location in the main memory, it first checks
for a corresponding entry in the cache.
 If the processor finds that the memory

location is in the cache, a Cache Hit has


occurred and data is read from the cache.
 If the processor does not find the
memory location in the cache, a cache
miss has occurred. For a cache miss, the
cache allocates a new entry and copies
in data from the main memory, then the
request is fulfilled from the contents of
the cache.
The performance of cache memory is
frequently measured in terms of a quantity
called Hit ratio.
Hit Ratio(H) = hit / (hit + miss) = no. of
hits/total accesses
Miss Ratio = miss / (hit + miss) = no. of
miss/total accesses = 1 - hit ratio(H)
We can improve Cache performance using
higher cache block size, and higher
associativity, reduce miss rate, reduce miss
penalty, and reduce the time to hit in the
cache.
Cache Mapping
There are three different types of mapping
used for the purpose of cache memory which
is as follows:
 Direct Mapping

 Associative Mapping

 Set-Associative Mapping

1. Direct Mapping
 The simplest technique, known as direct

mapping, maps each block of main


memory into only one possible cache line.
or In Direct mapping, assign each memory
block to a specific line in the cache. If a
line is previously taken up by a memory
block when a new block needs to be
loaded, the old block is trashed. An
address space is split into two parts index
field and a tag field. The cache is used to
store the tag field whereas the rest is
stored in the main memory. Direct
mapping`s performance is directly
proportional to the Hit ratio.
 i = j modulo m
 where
 i = cache line number
 j = main memory block number
 m = number of lines in the cache

 Direct Mapping

 For purposes of cache access, each main


memory address can be viewed as
consisting of three fields. The least
significant w bits identify a unique word
or byte within a block of main memory. In
most contemporary machines, the address
is at the byte level. The remaining s bits
specify one of the 2s blocks of main
memory. The cache logic interprets these
s bits as a tag of s-r bits (the most
significant portion) and a line field of r
bits. This latter field identifies one of the
m=2r lines of the cache. Line offset is
index bits in the direct mapping.

 Direct Mapping – Structure

 2. Associative Mapping
 In this type of mapping, associative
memory is used to store the content and
addresses of the memory word. Any block
can go into any line of the cache. This
means that the word id bits are used to
identify which word in the block is needed,
but the tag becomes all of the remaining
bits. This enables the placement of any
word at any place in the cache memory. It
is considered to be the fastest and most
flexible mapping form. In associative
mapping, the index bits are zero.

 Associative Mapping – Structure

 3. Set-Associative Mapping
 This form of mapping is an enhanced form
of direct mapping where the drawbacks of
direct mapping are removed. Set
associative addresses the problem of
possible thrashing in the direct mapping
method. It does this by saying that instead
of having exactly one line that a block can
map to in the cache, we will group a few
lines together creating a set. Then a block
in memory can map to any one of the lines
of a specific set. Set-associative mapping
allows each word that is present in the
cache can have two or more words in the
main memory for the same index address.
Set associative cache mapping combines
the best of direct and associative cache
mapping techniques. In set associative
mapping the index bits are given by the
set offset bits. In this case, the cache
consists of a number of sets, each of
which consists of a number of lines.

 Set-Associative Mapping

 Relationships in the Set-Associative


Mapping can be defined as:
 m=v*k
 i= j mod v

 where
 i = cache set number
 j = main memory block number
 v = number of sets
 m = number of lines in the cache number
of sets
 k = number of lines in each set

 Set-Associative Mapping – S

You might also like