0% found this document useful (0 votes)
13 views22 pages

9CS 207 - MemoryOrganization

Uploaded by

vinammrata
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)
13 views22 pages

9CS 207 - MemoryOrganization

Uploaded by

vinammrata
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/ 22

27-10-2023

CS 207 Computer Organization and Architecture

Memory Organization

Memory Hierarchy
 The memory unit is an essential component in any
digital computer since it is needed for storing
programs and data
 Not all accumulated information is needed by the
CPU at the same time.
 Therefore, it is more economical to use low-cost
storage devices to serve as a backup for storing the
information that is not currently used by CPU, as
shown in the figure. (next slide)

27-10-2023 2

1
27-10-2023

Memory Hierarchy

27-10-2023 3

Memory Organization
 Main Memory : Memory unit that communicates directly with the
CPU (RAM)
 Auxiliary Memory : device that provide backup storage (Disk Drives)
 Cache Memory : special very-high-speed memory to increase the
processing speed (Cache Memory)
 I/O Processor: It loads and stores data into memory along with the
execution of I/O instructions. It acts as an interface between system
and devices. It involves a sequence of events to executing I/O
operations and then store the results into the memory.
A uxiliary m em o ry
M ag netic
tap es
M ain
I/O p ro cesso r
m em o ry
M ag netic
d isks

C ache
C PU
m em o ry

27-10-2023 4

2
27-10-2023

Memory Hierarchy
 CPU logic is usually faster than main memory access time,
with the result that processing speed is limited primarily by the
speed of main memory.
 The cache is used for storing segments of programs currently
being executed in the CPU and temporary data frequently
needed in the present calculations.
 The typical access time ratio between cache and main memory
is about 1 to 7.
 Auxiliary memory access time is usually 1000 times that of
main memory.

27-10-2023 5

Main Memory
 Most of the main memory in a general purpose
computer is made up of RAM integrated circuits
chips, but a portion of the memory may be
constructed with ROM chips

 RAM– Random Access memory


 Integrated RAM are available in two possible operating
modes, Static and Dynamic
 ROM– Read Only memory

27-10-2023 6

3
27-10-2023

Semiconductor Memories

• Nonvolatile • Volatile memory


memory – SRAM
– DRAM
– ROM
• Asynchronous
– PROM – DRAM
– FPM DRAM
– EPROM
• Synchronous
– EEPROM – SDRAM
– DDR SDRAM
– Flash memory – RDRAM

27-10-2023 7

Random-Access Memory (RAM)


• Static RAM (SRAM)
– Each cell stores bit with a six-transistor circuit.
– Retains value indefinitely, as long as it is kept powered.
– Relatively insensitive to disturbances such as electrical noise.
– Faster and more expensive than DRAM.
– Used in Cache memory and CPU register

• Dynamic RAM (DRAM)


– Each cell stores bit with a capacitor (usually MOS) and transistor/switch.
– Value (charge) must be refreshed every 10-100 ms.
– Sensitive to disturbances.
– Slower and cheaper than SRAM.
– Memory slice density is high.
– Used in most computer as main memory

27-10-2023 8

4
27-10-2023

b
SRAM cell b'
Vsupply

word line

bit line bit line

27-10-2023 9

DRAM cell

word line

bit line

27-10-2023 10

5
27-10-2023

SRAM vs DRAM Summary

Tran. Access
per bit time Persist? Sensitive? Cost Applications

SRAM 6 1X Yes No 100x cache memories

DRAM 1 10X No Yes 1X Main memories,


frame buffers

27-10-2023 11

Typical RAM Configuration

27-10-2023 12

6
27-10-2023

ROM
• ROM : Read Only Memory
– Programmed when manufacturing is in process.
• PROM : Programmable Read Only Memory
– Programmable by user only once
– Flexible and convenient compared to ROM
– Programmed by burning the fuse using high
current pulse

27-10-2023 13

ROM
• ROM is used for storing programs/data that are permanently
resident in the computer and for tables of constants that do not
change, once the production of the computer is completed
• The ROM portion of main memory is needed for storing an
initial program called bootstrap loader, witch is to start the
computer software operating when power is turned off

27-10-2023 14

7
27-10-2023

ROM

Typical RAM Configuration

27-10-2023 15

Memory Address Map


• Memory Address Map is a pictorial representation of assigned
address space for each chip in the system

• To demonstrate an example, assume that a computer system


needs 512 bytes of RAM and 512 bytes of ROM

• The RAM have 128 byte and need seven address lines, where
the ROM have 512 bytes and need 9 address lines. (PTO)

27-10-2023 16

8
27-10-2023

Memory Address Map ….

• The hexadecimal address assigns a range of hexadecimal equivalent


address for each chip
• Line 8 and 9 represent four distinct binary combination to specify which
RAM we chose
• When line 10 is 0, CPU selects a RAM. And when it’s 1, it selects the
ROM

27-10-2023 17

27-10-2023 18

9
27-10-2023

Problems and Discussion

27-10-2023 19

Associative Memory
 This memory unit allows the accessing the stored data item by the content of
the data rather than by an address, also known as content addressable
memory (CAM).
 This concept reduces the time required to find an item stored in memory.
 When a word is written in an associative memory, no address is given.
 The memory is capable of finding an empty unused location to store the
word.
 When a word is to be read from an associative memory, the content of the
word, or part of the word, is specified. The memory locates all words which
match the specified content and marks them for reading.

20

10
27-10-2023

Associative Memory
 An associative memory is more
expensive than a random access
memory because each cell must have
storage capability as well as logic
circuits for matching its content with
an external argument.
 It is suitable only where the search
time is very important and must be
very short.

Hardware Organization 21

Associative Memory
 An associative memory is more
expensive than a random access memory
because each cell must have storage
capability as well as logic circuits for
matching its content with an external
argument.
 It is suitable only where the search time
is very important and must be very short.
 Argument register (A): It contains the
word to be searched. It has n bits (one for
each bit of the word).
 Key Register (K): This specifies which
part of the argument word needs to be
compared with words in memory. If all
bits in register are 1, The entire word
should be compared. Otherwise, only the
bits having k-bit set to 1 will be
compared.
Hardware Organization 22

11
27-10-2023

Associative Memory
Associative memory array: It contains the words which are to be compared with the
argument word.
Match Register (M): It has m bits, one bit corresponding to each word in the
memory array. After the matching process, the bits corresponding to matching
words in match register are set to 1.

23

Associative Memory

24

12
27-10-2023

Match logic
 Let us include Key register. If Kj = 0 then there is no need to compare Aj and Fij.
 Only when Kj =1, comparison is needed.
 This achieved by ORing each term with Kj.

25

Match logic
 Write operation:
 If the entire memory is loaded with new
information at once prior to search operation then
writing can be done by addressing each location
in sequence.
 Tag register contains as many bits as there are
words in memory.
 It contain 1 for active word and 0 for inactive
word.
 If the word is to be inserted, tag register is
scanned until 0 is found and word is written at
that position and bit is change to 1.
 Read Operation:
 When a word is to be read from an associative
memory, the contents of the word, or a part of
the word is specified.

26

13
27-10-2023

Match logic

27

Cache memory
 If the active portions of the program and data are
placed in a fast small memory, the average memory
access time can be reduced,
 Thus reducing the total execution time of the program
 Such a fast small memory is referred to as cache
memory
 The cache is the fastest component in the memory
hierarchy and approaches the speed of CPU
component.

27-10-2023 28

14
27-10-2023

Cache memory
 When CPU needs to access memory, the cache is
examined
 If the word is found in the cache, it is read from the fast
memory. It is called as a hit.
 If the word addressed by the CPU is not found in the
cache, the main memory is accessed to read the word. It is
called as a miss.
 The performance of cache memory is frequently
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.
 Otherwise, it is a miss
 Hit ratio = hit / (hit+miss)

27-10-2023 29

Cache memory
 The basic characteristic of cache memory is its fast
access time,
 Therefore, very little or no time must be wasted when
searching the words in the cache

27-10-2023 30

15
27-10-2023

Cache organization (Mapping Process)

The transformation of data from main memory to


cache memory is referred to as a mapping process,
there are three types of mapping:
 Associative mapping
 Direct mapping
 Set-associative mapping

27-10-2023 31

Associative Mapping
 Fastest and most flexible.
 Uses an associative memory.
 Stores both the address and content
(data) of the memory word.
 Permits any location in cache to
store any word from main memory.
 A CPU address of 15 bits is place
in the argument register and the
associative memory is searched for
a matching address.
 If the address is found, the
corresponding 12-bit data is read
and sent to the CPU. If not, then the
main memory is accessed for the
same word.
 If the cache is full, an address-data pair must be displaced to make the
room for new pair that is not available in cache (FIFO replacement policy).

16
27-10-2023

Direct Mapping
 Associative memories are expensive compared to RAM because of the
added logic associated with each cell.
 The CPU address of 15 bits is divided into two fields. The nine least
significant bits constitute the index field and the remaining six bits form
the tag field.
 The figure shows that main memory needs an address that includes both
the tag and the index bits.
 The number of bits in the index filed is equal to the number of address bits
required to access the cache memory.

Direct Mapping
• Each word in cache consists of the data word and its associated tag. When
a new word is first brought into the cache, the tag bits are stored alongside
the data bits. When the CPU generates a memory request, the index field is
used for the address to access the cache.

17
27-10-2023

Set-Associative Mapping
 In Direct mapping, two words with the same index (their address) but with
different tag values can’t reside in cache memory at the same time.
 Set-associative mapping based cache organization is an improvement over
the direct mapping where each word of cache can store two or more words of
memory under the same index address. Each word in cache consists of the
data word and its associated tag.

Set-Associative Mapping
 An example of a set-associative
cache organization for a set size of
two.
 Each tag requires six bits and each
data word has 12 bits, so the word
length is 2 (6 + 12) = 36 bits.
 An index address of nine bits can
accommodate 512 words. Thus the
size of cache memory is 512 x 36.
 It can accommodate 1024 words of
main memory since each word of
cache contains two data words.
 In general, a set-associative cache
of set size k will accommodate k
words of main memory in each
word of cache.

18
27-10-2023

Virtual Memory
 Virtual memory is a logical concept that permits the user to construct large
programs as though large physical memory were available.
 This concept provides large virtual memory for programmers when only
small physical memory is available.
 Virtual memory is used to give programmers the illusion that they have a
very large memory (totally equal to the auxiliary memory) even though the
computer actually has a small main memory.
 It makes the task of programming easier because the programmer no longer
needs to worry about the amount of physical memory available.

Virtual Memory: Address space and Physical address


 An address used by a programmer
will be called a virtual address,
and the set of such addresses is
called address space.
 An address in main memory is
called a location or physical
address. The set of such space is
known as memory space.
 Mostly, address space is allowed
to be larger than the memory
space in computers with virtual
memory.
 Any program and portion of its
associated data are moved
from/to auxiliary memory into
main memory based on demands
imposed by the CPU.

19
27-10-2023

Virtual Memory: Mapping table


 CPU will reference instructions and data with 20-bit address, but the
information at this address must be taken from physical memory because
access to auxiliary storage from individual words will be prohibitively long.
 For efficient transfers, auxiliary storage moves an entire record to the main
memory. Thus, a table is then needed to map a virtual address of 20 bits to a
physical address of 15 bits.
 This mapping is a dynamic operation, which means that every address is
translated immediately as a word is references by CPU.

Virtual Memory: address mapping using pages


 The address space and the memory space are each divided into groups of fixed
size called as Pages and Blocks.
 If a page or block consists of 1K words, then address space is divided into 1024
pages and main memory is divided into 32 blocks. Portions of programs are
moved from auxiliary memory to main memory in records equal to the size of a
page.

20
27-10-2023

Virtual Memory: Memory mapping table with pages


 The memory page table denotes the
page number and the content of the
word gives the block number where
that page is stored in main memory.
 The CPU references a word in
memory with a virtual address of 13
bits. The three high-order bits of the
virtual address specify a page number
and also an address for the memory
page table.
 If the presence bit is a 1, the block
number thus read is transferred to
the two high-order bits of the main
memory address register.
 If the presence bit in the word read from the page table is 0, it signifies that content
of the word referenced by the virtual address does not reside in main memory.
 A call to the operating system is then generated to fetch the required page from
auxiliary memory and place it into the main memory before resuming the
computation.

Virtual Memory: Page Replacement


• When a page fault occurs in a virtual memory system, it signifies that the page
referenced by the CPU is not in main memory. A new page is then transferred from
auxiliary memory to main memory.
• If main memory is full, it would be necessary to remove a page from memory
block to make room for the new page (Page Replacement).

 FIFO: This algorithm selects for replacement the page that has been in
memory the longest time. It uses an identification number which helps the
operating system keeps track of all pages in the memory in a queue, the
oldest page is in the front of the queue. When a page needs to be replaced
page in the front of the queue is selected for removal.

 LRU: This algorithm works on the assumption that the least recently used
page is a better candidate for removal than the least recently loaded page as in
FIFO. It uses a counter with every page that is in memory. When a page is
referenced, its associated counter is set to zero. It is difficult to implement but
more attractive policy.

21
27-10-2023

27-10-2023 43

22

You might also like