Memory Organization Assignment
Memory Organization Assignment
Presented By -
The Memory in a computer is divided into four hierarchies based on the speed as well as use. The processor
moves from one level to another based on its requirements. The four hierarchies in the memory are internal
memory, main memory, secondary memory, and tertiary memory.
(RAM, ROM)
Main Memory
(Hard Disks,
Secondary Memory etc.)
(Magnetic
Tapes, Optical
Tertiary Memory disks, etc.)
Size
Access Time
Memory Units in Computer System:
1. Cache memory temporarily stores frequently used instructions and data for quicker
processing by CPU
3. Secondary memory is the memory with high storage capacity and data and programs
are not lost from it when system is turned off.
As it has become possible to place more and more circuits on a chip over time, CPU
has got even faster.
On the other hand, new technology is being used to increase the capacity of memory
instead of improving the speed.
This factor has caused the increased gap between main memory and CPU
Hence when a CPU issues a command that requests memory access, it does not get the memory
unit it wants right away. Instead, it has to wait for some number of CPU cycles for the
memory to serve the request. Thus reducing the system’s performance.
Hence, to bridge this gap scientists have introduced a smaller and faster memory unit between CPU
and RAM termed as Cache Memory. Thus making a hierarchy of memory.
Arrangement of Memory Units in System:
● At the bottom, there are cheap storage devices (Tertiary Memory) with large amount
of memory, like the optical disks or the magnetic tape. Their access time is quite
large and access speed is quite slow.
● A level up, there is Secondary memory. It has much larger storage and lesser cost
as compared to primary memory. Example - Hard Disks. Their access speed is slow
and access time is large.
● The access time of secondary memory is usually 1000 times that of main memory.
● Higher up, there is a Primary memory {RAM and ROM}, which has medium capacity
and speed. Their access speed is faster than secondary memory.
● At the top rests cache and registers, both of which are very fast but has small
capacities. Their access speed is fastest.
● The access time between cache memory and main memory is about 1 is to 7~10
CACHE MEMORY
Cache Memory is a special very high speed memory.It is used to speed up and
synchronizing with high speed CPU.
Cache memory is costlier than main memory but economical than CPU registers.
Cache memory is an extremely fast memory type that acts as a buffer between RAM
and the CPU.
It holds frequently requested data and instructions so that they are immediately
available to the CPU when needed.
Cache memory is used to reduce the average time to access data from the Main
memory.
The cache is a smaller and faster memory which stores copies of the data from
frequently used main memory locations.
When the CPU need to access the memory it first search in cache.If found it
is read.
If the word is not found it is read from main memory and a block of data is
transferred from main memory to cache which contains the word.
If the word is found in cache,it is said hit. If the word is not found it is
called miss.
Cache memory
512 X 12
6 bits 9 bits
Tag Index
32K X 12 512 X 12
00 000 Cache memory
Main memory
Octal 000
address Address=9 bits
Octal Address=15 bits
address Data=12 bits Data=12 bits
77 777 777
Mapping Techniques
The transformation of data from main memory to cache is known as mapping
process.Three types of mapping process are:
1.Associative mapping
2.Direct mapping
3.Set-associative mapping
Associative Mapping
Fastest and most flexible cache organization uses associative memory.
It stores both address and content of memory word.
Address is placed in argument registers and memory is searched for matching
address.
If address is found corresponding data is read.
If address is not found, it is read from main memory and transferred to cache.
If the cache is full,an address-word pair must be displayed.
Various algorithm are used to determine which pair to displace.some of them are
FIFO(First In First Out),LRU(Least Recently Used)etc.
Associative mapping cache
Argument register
Address Data
01000 3450
02777 6710
22345 1234
Direct Mapping
CPU address is divided into two fields tag and index.
Index field is required to access cache memory and total address is used to
access main memory.
If there are 2^k words in cache and 2^n words in main memory, then n bit
memory address is divided into two parts k bits for index field and n-k bits
for tag field.
When CPU generates memory request,index field is used to access the cache.
Tag field of the CPU address is compared with the tag in the word read.If
the tag match, there is a hit.
If the tag does not match ,word is read from main memory and updated in the
cache.
This example uses the block size of 1.
It can be also implemented for block size of 8 words.
The index field is divided into two parts: block field and word field.
In 512 word cache there are 64 blocks of 8 words each
Every time miss occur entire block of word is transferred from main memory
to cache.
Direct mapping cache organization
Memory Memory data
address
00000 1220 Index Tag Data
Address
000 00 1220
00777 2340
01000 3450
777 02 6710
01777 4560
02777 6710
010
Block 1 Index
017
770
Block 63 02
777
02 6710
Set Associative Mapping
In direct mapping two words with the same index in their address but with
different tag values cannot reside in cache memory at the same time.
In this mapping each data word is stored together with its tag and number of
tag data items in one word of cache is said to form a set.
When a miss occur and the set is full, one of the tag data item is replaced
with new value using various algorithm.
Two way set associative mapping cache
Valid bit of word is set whenever the word is read from main memory and
updated to cache.
EEPROM (Electrically The data can be erased by applying an electric field, with no
erasable programmable need for ultraviolet light. We can erase only portions of the
read-only memory)
chip.
MROM(Mask ROM) – is masked off at the time of production. Like other types of
ROM, mask ROM cannot enable the user to change the data
stored in it. If it can, the process would be difficult or slow.
VIRTUAL MEMORY
DEFINITION:-
• Virtual memory is a memory management technique where
secondary memory can be used as if it were a part of the main
memory.
• Virtual memory frees up RAM by swapping data that has not been used
recently over to a storage device, such as a hard drive or solid-state drive (SSD).
Example:
A business owner might use their computer’s virtual memory system when running
multiple applications at once. For example, the user might try to load their email in
their browser window while also running a word processing software, a shift
scheduling software and a content management system at the same time. Since
the computer needs to run several programs at once, it might adjust its memory
usage to optimize its ability to open the user’s email application while maintaining
the operations of the other software programs.
To open the user’s email, the computer’s operating system (OS) may have to initiate
its memory management unit (MMU) to search for the page or segment table
containing the virtual or physical address for the process that can open the email
application. Once located, the OS can either move the application to the computer’s
RAM to open the application, or it can access the application if it’s already stored in
RAM. If the RAM is near its limit, the computer may move another file from the RAM
to another storage space to reduce its RAM usage.
Snapshot of a virtual memory management
system :-
Let us assume 2 processes, P1 and P2, contains 4 pages each. Each page size is
1 KB. The main memory contains 8 frame of 1 KB each. The OS resides in the first
two partitions. In the third partition, 1st page of P1 is stored and the other frames
are also shown as filled with the different pages of processes in the main memory.
The page tables of both the pages are 1 KB size each and therefore they can be fit
in one frame each. The page tables of both the processes contain various
information that is also shown in the image.
The CPU contains a register which contains the base address of page table
that is 5 in the case of P1 and 7 in the case of P2. This page table base
address will be added to the page number of the Logical address when it
comes to accessing the actual corresponding entry.
Types of virtual memory:- Paging and Segmentation
• That means that there will always be a small amount of memory wasted,
except in the unusual case where a process requires exactly a whole number of
pages.
• As these small chunks build up, fewer and fewer segments of useful size
can be allocated.
• And if the OS does start using these small segments then there are a
huge number to keep track of, and each process will need to use many
different segments, which is inefficient and can reduce performance.
The benefits of using virtual memory:-
The advantages to using virtual memory include:-
• It can handle twice as many addresses as main memory.
• It frees applications from managing shared memory and saves users from
having to add memory modules when RAM space runs out.
• Data must be mapped between virtual and physical memory, which requires
extra hardware support for address translations, slowing down a computer further.
When a computer requires storage, RAM is the first used. Virtual memory,
which is slower, is used only when the RAM is filled.
The key characteristics of memory devices or
memory system are as follows:
1. Location
2. Capacity
3. Unit of Transfer
4. Access Method
5. Performance
6. Physical type
7. Physical characteristics
8. Organization
1. Location:
It deals with the location of the memory device in the computer system.
There are three possible locations:
● CPU : This is often in the form of CPU registers and small amount of
cache
● Internal or main: This is the main memory like RAM or ROM. The CPU
can directly access the main memory.
● External or secondary: It comprises of secondary storage devices like
hard disks, magnetic tapes. The CPU doesn’t access these devices
directly. It uses device controllers to access secondary storage devices.
2. Capacity:
The capacity of any memory device is expressed in terms of:
i)word size ii)Number of words
● Word size: Words are expressed in bytes (8 bits). A word can
however mean any number of bytes. Commonly used word
sizes are 1 byte (8 bits), 2bytes (16 bits) and 4 bytes (32 bits).
● Number of words: This specifies the number of words
available in the particular memory device. For example, if a
memory device is given as 4K x 16.This means the device has
a word size of 16 bits and a total of 4096(4K) words in
memory.
3. Unit of Transfer:
It is the maximum number of bits that can be read or written into
the memory at a time. In case of main memory, it is mostly equal to
word size. In case of external memory, unit of transfer is not limited
to the word size; it is often larger and is referred to as blocks.
4. Access Methods:
It is a fundamental characteristic of memory devices. It is the
sequence or order in which memory can be accessed. There are
three types of access methods:
● Random Access: If storage locations in a particular memory
device can be accessed in any order and access time is
independent of the memory location being accessed. Such
memory devices are said to have a random access
mechanism. RAM (Random Access Memory) IC’s use this
access method.
● Serial Access: If memory locations can be accessed only in a
certain predetermined sequence, this access method is called
serial access. Magnetic Tapes, CD-ROMs employ serial
access methods.
● Semi random Access: Memory devices such as Magnetic
Hard disks use this access method. Here each track has a
read/write head thus each track can be accessed randomly but
access within each track is restricted to a serial access.
5. Performance:
The performance of the memory system is determined using three
parameters
● Access Time: In random access memories, it is the time
taken by memory to complete the read/write operation from
the instant that an address is sent to the memory. For
non-random access memories, it is the time taken to position
the read write head at the desired location. Access time is
widely used to measure performance of memory devices.
● Memory cycle time: It is defined only for Random Access
Memories and is the sum of the access time and the additional
time required before the second access can commence.
● Transfer rate: It is defined as the rate at which data can be
transferred into or out of a memory unit.
6. Physical type: Memory devices can be either
semiconductor memory (like RAM) or magnetic surface memory
(like Hard disks).
7.Physical Characteristics:
● Volatile/Non- Volatile: If a memory devices continues hold
data even if power is turned off. The memory device is
non-volatile else it is volatile.
8. Organization:
● Erasable/Non-erasable: The memories in which data once
programmed cannot be erased are called Non-erasable
memories. Memory devices in which data in the memory can
be erased is called erasable memory.
E.g. RAM(erasable), ROM(non-erasable).
References
❏ M.M Mano,Computer System Architecture, PHI
❏ https://www.Wikipedia.org
❏ https://www.geeksforgeeks.org
❏ https://www.javatpoint.com