0% found this document useful (0 votes)
31 views49 pages

L6

The document covers the fundamentals of computer memory, including its categorization into internal and external types, and the memory hierarchy from registers to removable media. It explains various memory types such as cache, main memory, and secondary storage, highlighting their characteristics and roles in computing. Additionally, it discusses volatile vs non-volatile memory, memory access methods, and the implications of memory organization and addressing schemes.

Uploaded by

1457981717
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)
31 views49 pages

L6

The document covers the fundamentals of computer memory, including its categorization into internal and external types, and the memory hierarchy from registers to removable media. It explains various memory types such as cache, main memory, and secondary storage, highlighting their characteristics and roles in computing. Additionally, it discusses volatile vs non-volatile memory, memory access methods, and the implications of memory organization and addressing schemes.

Uploaded by

1457981717
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/ 49

COMP 30660: Computer

Architecture and Organization


(CONV)

Lecture 6: Memory http://www.flickr.com/photos/sarahseverson/

Module Coordinator: Asst. Prof. Madhusanka Liyanage


Lecturer: Dr Bart Siniarski
1
Learning Objectives

• Understand the Concept of Memory


• Understand the Memory Categorization
• Understand the Memory Hierarchy
• Understand relationship between different memory
types

2
Concept of Memory

• The digital computer works on the stored programmed


concept introduced by Von Neumann.
• It uses memory to store information, including
program instructions and data.
• Memory is used to store information in digital form.
• CPU can process the data only stored in the memory.
• Due to several reasons, the computer uses different
types of memories.
• Different types of memory uses at different levels.

3
Von Neumann Memory

4
Memory Categorization

• The memory of computer is broadly categories


into two categories:
– Internal and external
• Internal memory is used by CPU to perform task.
Which is also called as Primary Memory
• External memory is used to store bulk
information, which includes large software and
data. Which is also called as Auxiliary Memory or
Secondary Memory

5
The Memory Hierarchy

The memory hierarchy is given by:


• Register
• Cache Memory
• Main Memory
• Magnetic Disk
• Removable media (Magnetic tape)

6
The Memory Hierarchy

• The total memory


capacity of a computer
can be visualized by
hierarchy of components.
• The memory hierarchy
system consists of all
storage devices
contained in a computer
system from the slow
Auxiliary Memory to fast
Main Memory and to
smaller Cache memory.

7
Register

• Register memory is the smallest


and fastest memory in a
computer.
• It is not a part of the main
memory and is located in the CPU
in the form of registers,
• This is a part of Central Processor
Unit, so they reside inside the
CPU.
• The information from main
memory is brought to CPU and
keep the information in register.
• Due to space and cost
constraints, we have got a limited
number of registers in a CPU.
• These are basically faster devices.

8
Cache Memory

• Cache memory is a storage device placed in between CPU and main memory.
• These are semiconductor memories.
• These are basically fast memory device, faster than main memory.
• We can not have a big volume of cache memory due to its higher cost and
some constraints of the CPU.
• Due to higher cost we can not replace the whole main memory by faster
memory.
• Generally, the most recently used information is kept in the cache memory.
• It is brought from the main memory and placed in the cache memory.
• Nowadays, we get CPUs with internal cache.

9
Main Memory

• Like cache memory, main memory


is also semiconductor memory.
• But the main memory is relatively
slower memory.
• Computer have to first bring the
information (whether it is data or
program), to main memory.
• CPU can work with the information
available in main memory only.
• Main memory is sometimes called
RAM. RAM stands for Random
Access Memory.
• "Random" means that the memory
cells can be accessed in any order.
• However, properly speaking, "RAM"
means the type of silicon chip used
to implement main memory.

10
Magnetic Disk

• This is bulk storage device.


• The computers have to deal with
huge amount of data in many
application.
• The computers do not have
enough semiconductor memory
to keep these information in our
computer.
• On the other hand,
semiconductor memories are
volatile in nature.
• It loses its content once we
switch off the computer.
• For permanent storage,
computers use magnetic disk.
• The storage capacity of magnetic
disk is very high.
11
Removable Media

• It may not be possible to


keep all the information
in magnetic disk.
• So, which ever data the
computer is not using
currently, can be kept in
removable media.
• Magnetic tape is one kind
of removable medium.
• CD is also a removable
media, which is an
optical device.

12
The Memory Hierarchy: Performance
Comparison

13
Internal Memory and External Memory

• Register, cache
memory and main
memory are
internal memory.
• Magnetic Disk,
removable media
are external
memory.

14
Volatile vs Non-Volatile Memory

• Generally,
memory/storage is
classified into 2
categories
• Volatile Memory: This
loses its data, when
power is switched off.
• Non-Volatile Memory:
This is a permanent
storage and does not
lose any data when
power is switched off.

15
Memory Access Methods
• Each memory type, is a collection of numerous memory
locations.
• To access data from any memory, first it must be located
and then the data is read from the memory location.
• Following are the methods to access information from
memory locations:
• Random Access:
– Main memories are random access memories, in which each
memory location has a unique address.
– Using this unique address any memory location can be reached
in the same amount of time in any order.
• Sequential Access:
– This methods allows memory access in a sequence or in order.
• Direct Access:
– In this mode, information is stored in tracks, with each track
having a separate read/write head.

16
Cache memory

17
Cache Memory
• Cache memory is a storage device
placed in between CPU and main
memory.
• The present CPU chips contain a few
caches, with L1 being the quickest.
• Each consequent cache is
increasingly slow than L1, and
directions and data are arranged
from main memory to L3 to L2 to L1
to the processor.
• On multicore chips, the L3 cache is
commonly shared among all the
preparing centres.

18
Cache in CPU

19
How the cache actually functions?

21
How the cache actually functions?

22
Locality

• Cache memories are effective


by virtue of the Principle of
Locality.
• CPU tends to access the same
set of memory locations
repetitively over a short period
of time.
• Temporal locality: Recently-
accessed data elements tend to
be accessed again.
• Spatial locality: Accesses tend
to cluster; nearby locations
tend to be accessed soon.
• Sequential locality:
Instructions tend to be
accessed sequentially.

23
Hit Ratio

• The performance of cache memory is measured in


terms of a quantity called hit ratio.
• When the CPU refers to memory and finds the word in
cache it is said to produce a hit.
• If the word is not found in cache, it is in main memory
then it counts as a miss.
• The ratio of the number of hits to the total CPU
references to memory is called hit ratio.
• Hit Ratio = Hit/(Hit + Miss)
• Miss-ratio = 100 – Hit-ratio
• The Miss-penalty is the time required to process a
miss, including the time that it takes to replace a block
of memory plus the time it takes to deliver the data to
the processor. 24
Average Memory Access Time (AMAT)

• Calculate AMAT:
– 1GHz processor
– time for a hit = (cache access time) 1 clock cycle
– miss penalty = 20 clock cycles
– miss rate = 5% (0.05)

Calculate AMAT if miss rate = 10%


What miss rate will give an AMAT of 1.5ns?

25
Main Memory

Main Memory

26
Main Memory

• The memory unit that communicates directly within


the CPU, Auxillary memory and Cache memory, is
called main memory.
• It is the central storage unit of the computer system.
• It is a large and fast memory used to store data during
computer operations.

27
Memory Organization

• The main memory occupies the central position because it is


equipped to communicate directly with the CPU and with
auxiliary memory devices through Input/output processor
(I/O).
• When the program not residing in main memory is needed by
the CPU, they are brought in from auxiliary memory.
• Programs not currently needed in main memory are
transferred into auxiliary memory to provide space in main
memory for other programs that are currently in use. 28
Main Memory

• The main memory of a computer is


semiconductor memory.
• The main memory unit of computer is basically
consists of two kinds of memory:
– RAM: Random Access Memories are volatile in
nature. As soon as the computer is switched off,
the contents of memory are also lost.
– ROM: Read only memories are non volatile in
nature. The storage is permanent, but it is read
only memory.

29
RAM: Random Access Memory

• Several types of RAM are available:


– DRAM: Dynamic RAM, is made of capacitors and
transistors, and must be refreshed every 10~100
ms. It is slower and cheaper than SRAM.
– SRAM: Static RAM, has a six transistor circuit in
each cell and retains data, until powered off.
– NVRAM: Non-Volatile RAM, retains its data, even
when turned off. Example: Flash memory.

30
Virtual memory

• Most modern operating


systems employ a method
of extending RAM capacity,
known as "virtual memory".
• A portion of the computer's
hard drive is set aside for a
paging file or a scratch
partition, and the
combination of physical
RAM and the paging file
form the system's total
memory.
• For example, if a computer
has 2 GB of RAM and a 1
GB page file, the operating
system has 3 GB total
memory available to it.
31
Virtual memory

• When the system runs


low on physical memory,
it can "swap" portions of
RAM to the paging file to
make room for new data,
as well as to read
previously swapped
information back into
RAM.
• Excessive use of this
mechanism results in
thrashing and generally
hampers overall system
performance, mainly
because hard drives are
far slower than RAM.
32
ROM: Read Only Memory

• Several types of ROM are available:


– PROM: Programmable Read Only Memory;
• It can be programmed once as per user
requirements.
– EPROM: Erasable Programmable Read Only
Memory;
• The contents of the memory can be erased and
store new data into the memory.
• In this case, we have to erase whole
information.
– EEPROM: Electrically Erasable Programmable Read
Only Memory
• In this type of memory the contents of a
particular location can be changed without
effecting the contents of other location.
33
Size of Main Memory

• The maximum size of main memory that can be


used in any computer is determined by the
addressing scheme.
• A computer that generates 16-bit address is
capable of addressing up to 216 which is equal to
64K memory locations.
• Similarly, for 32 bit addresses, the total capacity
will be 232 which is equal to 4G memory location.

34
Word-addressable vs Byte-addressable

• In some computer, the smallest addressable unit


of information is a memory word and the machine
is called word-addressable.
• In some computer, individual address is assigned
for each byte of information, and it is called byte-
addressable computer.
– In this computer, one memory word contains one
or more memory bytes which can be addressed
individually.

Byte addressable means that every byte has its own


unique address and can be accessed.
Word addressable means that every word has its own
unique address and can be accessed. 35
Byte Addressing

• Byte addressing refers to hardware architectures


which support accessing individual bytes.
• Such computers are sometimes called byte
machines.
• However, the main memory is usually designed to
store and retrieve data in word length quantities.
• Usually, lower bits of the address bus are used to
access byte of the fetched word.

36
Byte Addressing; Example

• Consider, A byte addressable 32-


bit computer, each memory word
contains 4 bytes.
• A possible way of address
assignment is shown in figure.
• Here, the address of a word is
always integer multiple of 4.
• Consider a machine with 32 bit
address bus.
• If the word size is 32 bit, then the
high order 30 bit will specify the
address of a word.
• If we want to access any byte of
the word, then it can be specified
by the lower two bit of the
address bus.

37
Word Addressing

• In computer architecture, word addressing means that


addresses of memory on a computer uniquely identify
words of memory.
• The advantage of word addressing is that more
memory can be addressed in the same number of bits.
• However, almost all modern computer architectures
use byte addressing, and word addressing is largely
only of historical interest.
• A computer that uses word addressing is sometimes
called a word machine.

38
Trade-offs of Minimum Addressable Unit (MAU)
• The size of the minimum addressable unit of memory can
have complex trade-offs.
• Using a larger MAU allows the same amount of memory to
be covered with a smaller address, which can substantially
decrease the memory requirements of a program.
• However, using a smaller MAU makes it easier to work
efficiently with small items of data.
• Suppose a program wishes to store one of the 12 traditional
signs of Western astrology.
• A single sign can be stored in 4 bits.
• Consider a 32-bit computer, each memory word contains 4
bytes.
• If a sign is stored in its own MAU, then 4 bits will be wasted
with byte addressing (50% efficiency), while 28 bits will be
wasted with 32-bit word addressing (12.5% efficiency)
39
Secondary Storage

40
Secondary Storage

• Largest and Slowest and


Least Expensive memory
• Different types available
– Floppy disks
– Flash Drives
– Hard Drives
• HDD: Hard Disk
Drive
• SSD: Solid State
Drive
– RAID

41
Floppy Disks

• A floppy disk or floppy


diskette is a type of disk
storage composed of a thin
and flexible disk of a
magnetic storage medium.
• The first floppy disks,
invented and made by IBM, 8-inch, 5¼-inch, and 3½-inch floppy disks
had a disk diameter of 8
inches.
• 3½-inch floppy disks widely
used
• Floppy disk drives still have
some limited uses,
especially with legacy
industrial computer
equipment.
42
Flash Drives

• AKA, Pen Drive, Thumb


Drive, USB Drive, etc
• Non volatile Memory
• Based on EPROM and
EEPROM technologies.
• Size 8MB — 2 TB
• NAND flash memory

43
Note: NAND a type of non-volatile storage technology that does not require power to retain data.
Hard Disk Drive (HDD)

• A non-volatile
computer storage
device containing
magnetic disks or
platters rotating at
high speeds.
• A secondary storage
device used to store
data permanently.

44
HDD Performance
• Time to access data
– Seek time
• how long it takes the head assembly to travel to
the track of the disk that contains data
– Rotational latency
• desired disk sector may not be directly under
the head when data transfer is requested
– RPM – Revolutions Per inute
• eg 7200 rpm disk, Seek time & Rotational
latency ~ 4ms
– Bit rate – data transfer rate
• ~1Gbit/s
• Fragile
– Head crash

45
SSD - Solid State Drive

• Secondary Storage
– Replacement for HDD?
– HDD form factors (3.5” & 2.5”)
• No moving parts – more durable,
shock resistant
• ~100 times faster than HDD
• Same as in USB flash drives and
memory cards
• NAND flash memory
• Consumes less power, cooler,
quieter
• But of course – more expensive
• 1TB HDD €50 for an HDD, SSD is
Was €250, Now €150 46
RAID (Redundant Array of Independent Disks)

• A data storage virtualization


technology that combines
multiple physical disk drive
components into one or more
logical units
• Support data redundancy and
performance improvement
• Data is distributed across the
drives in one of several ways,
referred to as RAID levels,
depending on the required
level of redundancy and
performance.

47
Summary

• What is the Concept of Memory


• Categorization of the Memory
• Hierarchy of Memory
• Relationship between different memory types

48
Thank You

49

You might also like