Unit-4 Coa
Unit-4 Coa
Unit-4 Coa
Tanya Shrivastava
UNIT – 4
Memory is simply storage. Without memory computer cannot store data for a long time. A memory is
just like a human brain. It is used to store data and instructions. Whenever you need a data with the help
of computer memory you can use it anytime.
When we enter the data into the computer using an input device, the entered information immediately
gets saved in the memory of the Central Processing Unit (CPU), the Memory Unit transmits the data
further to the other parts of the CPU.
Similarly, when the output of our command is processed by the computer, it is saved in the memory unit
before giving the output to the user.
Memory is primarily of two types −
Primary Memory/Main Memory
Secondary Memory
Primary Memory:
Primary memory is also known as internal memory. These types of memories are present inside the
motherboard. For example: RAM, ROM, and CACHE memory are connected inside the motherboard.
Primary memory holds only those data and instructions on which the computer is currently working. It
has a limited capacity. It is divided into three subcategories Cache memory, RAM and ROM.
CACHE MEMORY
Cache memory is smallest and fastest 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 RAM (main
memory). Cache is a primary memory. Cache memory is a temporary memory.
In the figure, data is transfer at slow speed from main memory to cache memory, but cache memory is a
fastest memory, so data is transfer from cache memory to the CPU at very high speed.
L2
CPU CPU CPU
L1 L1 L2
MOTHERBOARD
MOTHERBOARD MOTHERBOARD
Size - Smallest cache Larger than L1 but smaller than L3 Largest cache
Speed - Fastest cache Slower than L1 but faster than L3 Slowest cache
Advantages
Disadvantages
It stores information as long as the It stores information as long as the power is supplied or a few
power is supplied. milliseconds when power is switched off.
Capacitors are not used hence no To store information for a longer time, contents of the
refreshing is required. (no refreshing) capacitor need to be refreshed periodically. (refreshing)
SRAM DRAM
In this bits are stored in voltage form. In this bits are stored in the form of electric energy.
These are used in cache memories. These are used in main memories.
EPROM (Erasable Programmable read-only memory) – multiple times erase and reused with
the help of ultraviolet light.
EEPROM (Electrically erasable programmable read-only memory) – multiple times erase and
reused with the help of electrical charge.
MROM (Mask ROM) – Mask ROM is a kind of read-only memory that 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. MROM cannot modify by user. User cannot change the data store in it.
If it can, the process would be difficult or slow. The very first ROMs were hard-wired devices that
contained a pre-programmed set of data or instructions. These kinds of ROMs are known as masked
ROMs, which are inexpensive.
Secondary Memory
Secondary memory is also known as external memory or non-volatile (permanent memory). These types
of memory are not present inside the motherboard they are externally connected to the system. For
example: CD, pen drive are externally connected to the system. It is slower than the main memory.
These are used for storing data/information permanently.
For example, disk, optical disk like CD, DVD, and magnetic disk like HDD, SSD, floppy disk, memory
storage like memory card, pen drive are secondary memory and externally connected to the system etc.
Sequential Access – Magnetic Tape (Cassetes)
Direct Access:
Optical Disk: CD, DVD, Blu Ray Disc.
Magnetic Disk: Floppy Disc, Zip Disk, HDD, SSD.
Memory Storage Devices – Pen Drive, Memory Card.
Magnetic Tape:
Magnetic audio tape is used to capture speech and music
Magnetic video tape is used to capture video or any movie.
Any video or music will play in a sequential manner.
For example: cassettes
Cassettes are also known as magnetic tape, data is stored in this magnetic coated tape.
Data can be any video, music, speech, voice etc.
Magnetic Disk:
Magnetic disk is a secondary memory.
It is covered with magnetic coating to hold information.
It can store large amount of data.
Data can be read, write and modify easily.
Some of the magnetic disk are: Floppy disk, zip disk, HDD, SSD.
Data can be store in the form of concentric circles. Concentric means center is same but radius
and diameters are different of circles. These concentric circles are known as tracks used to store
data. Data stored in these tracks.
Floppy Disc
Floppy disk has a magnetic coating on it, which is used to store data.
Store less amount of data up to 1.44 MB.
It is packed inside a black protective plastic envelop.
Now they are not used because we need more space.
Zip Disc
To read zip disk we need a zip drive, without zip drive we cannot read zip disk.
Zip disk is an advance version of floppy disk.
It contains more space as compare to floppy disk.
It contains 100 MB and 250 MB of storage.
Now they are not used because we need more space.
ZIP DRIVE
ZIP DISK
Components of HDD:
Plotters: Hard disk consists of one or more circular disks known as plotters. These disk are made up of
metal. Each surface of plotter coated with magnetic coating.
Hard disk drive contains more storage like 1TB, 2TB etc. because it contains multiple disks to store
data.
Both the surface of each disk are capable of storing data except the top and bottom of the disk do not
contain the data only the inner surface of the disk is used to store data.
Outer side of the disk (top surface and bottom surface) do not used to store data only you can store data
inside part of the disk.
Recording Media: made up of magnetic material which is used to store data.
Read/Write Head: used to read and write the data on the disk.
Head Actuator: used to move the read/write head to store data on the disk.
Air filters: cleans the air circulating in the disk.
Spindle: used to spin the plotters, or to hold the plotters.
Motor: spin the hard disk plotters.
Logic board/Digital circuit board: used to control the functioning of hard disk.
Optical Disk
Optical disk is a secondary memory.
It is covered with magnetic coating to hold information.
It can store large amount of data.
Data can be read, write and modify easily.
Some of the optical disk are: CD, DVD, Blu Ray Disk.
Data can be store in the single spiral track with the help of laser.
CD
CD stands for compact disc. It is a secondary memory.
It is a permanent memory; cd is portable means easy to carry.
Used to store data such as software, music, text, document and video or movies.
CD is a removable storage media.
CD storage is 700 MB, CD is 1.2 mm thick and 4.7 inch (12 cm) diameter.
CD is made up of:
Polycarbonate Plastic: hard transparent plastic layer if the disk.
Aluminium: cd is reflective because disc is coated with thin layer of aluminium. Use Red laser
to write data.
Laquer/Acrylic: protect the cd layer, or to protect the data.
Label: enables you to name the cd for identification.
CD types:
CD-ROM Compact Disk-Read Only Memory. Only Read. file stored on CD can only read.
CD-R Compact Disk-Recordable. Record data one time only.Data can be once written
cannot be erased. Read many and write once.
CD-RW Compact Disk-rewriteable. Record and Erase data many times. Data can be read,
write and erase multiple times.
DVD
DVD stands for digital versatile disc or digital video disc. It is a secondary memory.
It is a permanent memory; dvd is portable means easy to carry.
Used to store data such as software, music, text, document and video or movies.
DVD is a removable storage media.
As compare to CD, the DVD contains more storage. 7 more times compare to CD.
DVD storage is 4.7 GB single sided and 8.5 GB double sided DVD is 1.2 mm thick and 4.7 inch
(12 cm) diameter.
DVD is made up of:
Polycarbonate Plastic: hard transparent plastic layer if the disk.
Aluminium: dvd is reflective because disc is coated with thin layer of aluminium. Use Red laser
to write data.
Laquer/Acrylic: protect the dvd layer, or to protect the data.
Label: enables you to name the dvd for identification.
DVD types:
DVD-ROM/DVD+ROM Digital Versatile Disk-Read Only Memory. Only Read. file stored
on DVD can only read.
DVD-R/DVD+R Digital Versatile Disk-Recordable. Record data one time only.Data can be
once written cannot be erased. Read many and write once.
DVD-RW/ DVD+RW Digital Versatile Disk-Rewriteable. Record and Erase data many
times. Data can be read, write and erase multiple times.
Used to store data such as software, music, text, document and video or movies.
BD is a removable storage media.
As compare to CD & DVD, BD contains more storage.
BD data storage is 25 GB single sided and 50, 60, 100,128 GB double sided, BD is 1.2 mm thick
and 4.7 inch (12 cm) diameter.
BD is made up of:
Polycarbonate Plastic: hard transparent plastic layer if the disk.
Aluminium: bd is reflective because disc is coated with thin layer of aluminium. Use Blue laser
to write data.
Laquer/Acrylic: protect the bd layer, or to protect the data.
Label: enables you to name the bd for identification.
BD types:
BD-ROM/BD+ROM Blu Ray Disk-Read Only Memory. Only Read. file stored on BD can
only read.
BD-R/BD+R Blu Ray Disk-Recordable. Record data one time only. Data can be once
written cannot be erased. Read many and write once.
BD-RW/BD+RW Blu Ray Disk-Rewriteable. Record and Erase data many times. Data
can be read, write and erase multiple times.
MEMORY HIERARCHY
The computer memory can be divided into 5 major hierarchies that are based on use as well as speed. A
processor can easily move from any one level to some other on the basis of its requirements. These five
hierarchies in a system’s memory are register, cache memory, main memory, magnetic disc, and
magnetic tape.
Memory Hierarchy, in Computer System Design, is an enhancement that helps in organising the
memory so that it can actually minimise the access time. The development of the Memory Hierarchy
occurred on behaviour of a program known as “Locality of references”.
This Hierarchy Design of Memory is divided into two main types. They are:
External or Secondary Memory
It consists of Magnetic Tape, Optical Disk, Magnetic Disk, i.e. it includes peripheral storage devices
that are accessible by the system’s processor via I/O Module.
1. Registers
Register is an electronic component that is used to hold the information as bits.
Register are used by processor (CPU) to store small amount of data.
A register can be 2 bit register, 4 bit register, 8 bit register, 16 bit register,
32 bit register, 64 bit register etc.
Register provides fast execution, fast accessing, fast fetching.
CPU is a fast processor because it contains registers that provides fast speed.
Register is a collection of various flip-flops.
Flip flop means a single cell that is capable to store a single bit.
1 cell = 1 flip-flop, 1 cell stores 1 bit.
Example: this 8 bit register contains 8 cells or we can say 8 flip-flops.
1 0 1 1 0 1 0 0
Types of Registers are:
2. Cache Memory
Cache memory is smallest and fastest 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 RAM (main
memory). Cache is a primary memory. Cache memory is a temporary memory.
In the figure, data is transfer at slow speed from main memory to cache memory, but cache memory is a
fastest memory, so data is transfer from cache memory to the CPU at very high speed.
3. Main Memory
Main memory is also known as primary or internal memory. These types of memories are present inside
the motherboard. For example: RAM, ROM, and CACHE memory are connected inside the
motherboard. Primary memory holds only those data and instructions on which the computer is
currently working. It has a limited capacity. It is divided into three subcategories Cache memory, RAM
and ROM.
4. Magnetic Disks
Magnetic disk is a secondary memory.
It is covered with magnetic coating to hold information. It can store large amount of data.
Data can be read, write and modify easily. Some of the magnetic disk are: Floppy disk, zip disk,
HDD, SSD.
Data can be store in the form of concentric circles. Concentric means center is same but radius
and diameters are different of circles. These concentric circles are known as tracks used to store
data. Data stored in these tracks.
5. Magnetic Tape
Magnetic audio tape is used to capture speech and music
Magnetic video tape is used to capture video or any movie.
Any video or music will play in a sequential manner.
For example: cassettes
Cassettes are also known as magnetic tape, data is stored in this magnetic coated tape.
Data can be any video, music, speech, voice etc.
A semiconductor is a substance that has specific electrical properties that enable it to help as an
establishment for computers and other electronic devices. Semiconductor is a combination of
conductor and insulator.
Conductors are those substances through which electricity can flow are called conductors. Insulators
are those substances through which electricity cannot flow are called insulators. Some common
conductors are copper, aluminium, gold, and silver. Some common insulators are glass, plastic, rubber,
and wood.
There are mainly two types of semiconductor memory: random-access memory (RAM) and read-only
memory (ROM). RAM is a temporary data storage domain, whereas ROM serves is a permanent
storage.
RAM stands for Random Access Memory. RAM is a primary memory. RAM is volatile memory
means not permanent memory.
It is a read/write memory which stores data until the machine is working. As soon as the
machine is switched off, data is erased.
RAM is volatile, i.e. data stored in it is lost when we switch off the computer or if there is a
power failure.
Provides temporary storage, store only running configurations.
RAM is of two types −
Static RAM (SRAM)
Dynamic RAM (DRAM)
It stores information as long as the It stores information as long as the power is supplied or a few
power is supplied. milliseconds when power is switched off.
Capacitors are not used hence no To store information for a longer time, contents of the
refreshing is required. (no refreshing) capacitor need to be refreshed periodically. (refreshing)
In this bits are stored in voltage form. In this bits are stored in the form of electric energy.
These are used in cache memories. These are used in main memories.
EPROM (Erasable Programmable read-only memory) – multiple times erase and reused with
the help of ultraviolet light.
EEPROM (Electrically erasable programmable read-only memory) – multiple times erase and
reused with the help of electrical charge.
MROM (Mask ROM) – Mask ROM is a kind of read-only memory that 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. MROM cannot modify by user. User cannot change the data store in it.
If it can, the process would be difficult or slow. The very first ROMs were hard-wired devices that
contained a pre-programmed set of data or instructions. These kinds of ROMs are known as masked
ROMs, which are inexpensive.
Error correction is not possible in the 2D But in 2.5D error correction could be
organization. done easily.
In 2D organization memory is divided in the In 2.5D organization the scenario is the same
form of rows and columns (Matrix). Each row but we have 2 different decoders one is a
contains a word, in the memory organization column decoder and another is row decoder.
there is a single decoder a decoder is a Column decoder used to select the column
combinational circuit that contains n input and row decoder is used to select row.
lines and 2n output lines.
Magnetic Tape:
Magnetic audio tape is used to capture speech and music
Magnetic video tape is used to capture video or any movie.
Any video or music will play in a sequential manner.
For example: cassettes
Cassettes are also known as magnetic tape, data is stored in this magnetic coated tape.
Data can be any video, music, speech, voice etc.
Magnetic Disk:
Magnetic disk is a secondary memory.
It is covered with magnetic coating to hold information.
It can store large amount of data.
Data can be read, write and modify easily.
Some of the magnetic disk are: Floppy disk, zip disk, HDD, SSD.
Data can be store in the form of concentric circles. Concentric means center is same but radius
and diameters are different of circles. These concentric circles are known as tracks used to store
data. Data stored in these tracks.
Floppy Disc
Floppy disk has a magnetic coating on it, which is used to store data.
Store less amount of data up to 1.44 MB.
It is packed inside a black protective plastic envelop.
Now they are not used because we need more space.
Zip Disc
To read zip disk we need a zip drive, without zip drive we cannot read zip disk.
Zip disk is an advance version of floppy disk.
It contains more space as compare to floppy disk.
It contains 100 MB and 250 MB of storage.
Now they are not used because we need more space.
ZIP DRIVE
ZIP DISK
Components of HDD:
Plotters: Hard disk consists of one or more circular disks known as plotters. These disk are made up of
metal. Each surface of plotter coated with magnetic coating.
Hard disk drive contains more storage like 1TB, 2TB etc. because it contains multiple disks to store
data.
Both the surface of each disk are capable of storing data except the top and bottom of the disk do not
contain the data only the inner surface of the disk is used to store data.
Outer side of the disk (top surface and bottom surface) do not used to store data only you can store data
inside part of the disk.
Optical Disk
Optical disk is a secondary memory.
It is covered with magnetic coating to hold information.
It can store large amount of data.
Data can be read, write and modify easily.
Some of the optical disk are: CD, DVD, Blu Ray Disk.
Data can be store in the single spiral track with the help of laser.
CD
CD stands for compact disc. It is a secondary memory.
It is a permanent memory; cd is portable means easy to carry.
Used to store data such as software, music, text, document and video or movies.
CD is a removable storage media.
CD storage is 700 MB, CD is 1.2 mm thick and 4.7 inch (12 cm) diameter.
CD is made up of:
Polycarbonate Plastic: hard transparent plastic layer if the disk.
Aluminium: cd is reflective because disc is coated with thin layer of aluminium. Use Red laser
to write data.
Laquer/Acrylic: protect the cd layer, or to protect the data.
Label: enables you to name the cd for identification.
CD types:
CD-ROM Compact Disk-Read Only Memory. Only Read. file stored on CD can only read.
CD-R Compact Disk-Recordable. Record data one time only.Data can be once written
cannot be erased. Read many and write once.
CD-RW Compact Disk-rewriteable. Record and Erase data many times. Data can be read,
write and erase multiple times.
DVD
DVD stands for digital versatile disc or digital video disc. It is a secondary memory.
It is a permanent memory; dvd is portable means easy to carry.
Used to store data such as software, music, text, document and video or movies.
DVD is a removable storage media.
As compare to CD, the DVD contains more storage. 7 more times compare to CD.
DVD storage is 4.7 GB single sided and 8.5 GB double sided DVD is 1.2 mm thick and 4.7 inch
(12 cm) diameter.
DVD is made up of:
Polycarbonate Plastic: hard transparent plastic layer if the disk.
Aluminium: dvd is reflective because disc is coated with thin layer of aluminium. Use Red laser
to write data.
Laquer/Acrylic: protect the dvd layer, or to protect the data.
Label: enables you to name the dvd for identification.
DVD types:
DVD-ROM/DVD+ROM Digital Versatile Disk-Read Only Memory. Only Read. file stored
on DVD can only read.
DVD-R/DVD+R Digital Versatile Disk-Recordable. Record data one time only.Data can be
once written cannot be erased. Read many and write once.
DVD-RW/ DVD+RW Digital Versatile Disk-Rewriteable. Record and Erase data many
times. Data can be read, write and erase multiple times.
BD-ROM/BD+ROM Blu Ray Disk-Read Only Memory. Only Read. file stored on BD can
only read.
BD-R/BD+R Blu Ray Disk-Recordable. Record data one time only. Data can be once
written cannot be erased. Read many and write once.
BD-RW/BD+RW Blu Ray Disk-Rewriteable. Record and Erase data many times. Data
can be read, write and erase multiple times.
ADDRESS MAPPING & REPLACEMENT
Mapping: transfer data from main memory to cache memory is known as mapping. Address mapping is
also known as Cache Memory Mapping.
Address mapping is interpreted if the data in the address space and the memory space are each split into
a collection of fixed sizes. The physical memory is broken down into sets of similar size known as
blocks, which can range from 64 to 4096 words each.
Example − Suppose a page or block consists of 1K words, then address space can be divided into 1024
pages and main memory can be divided into 32 blocks.
Three types of mapping are:
Direct Mapping.
Fully Associative Mapping.
K-way Set Associative Mapping.
Direct Mapping:
The easiest technique used for mapping is known as direct mapping. The direct mapping maps every
block of the main memory into only a single possible cache line. In simpler words, in the case of direct
mapping, we assign every memory block to a certain line in the cache.
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. An address space is split into two parts index field and a tag field.
TAG INDEX
In direct mapping the blocks of main memory is fix in to the cache memory lines. For example:
L0 B0 B0
1Block =
B1
L1 B1 B2 4 words
.
L2 B2
.
L3 B3 .
.
.
Cache Memory = 16 words .
.
1 Line = 4 words B1023
If block is B0,
then k= 0 and n = 4
k mod n => 0 mod 4 = 0
hence the value of k mod n is 0, so block no. B0 of main memory is fix with the L0 line of cache
memory. Because size of block in main memory is 4 words and size of lines in cache memory is
also 4 words.
If block is B1,
then k= 1 and n = 4
k mod n => 1 mod 4 = 1
hence the value of k mod n is 1, so block no. B1 of main memory is fix with the L1 line of cache
memory. Because size of block in main memory is 4 words and size of lines in cache memory is
also 4 words.
So the limitation of direct mapping is the block of main memory is fix into the lines of cache
memory. B0 with L0, B1 with L1 etc.
Hence the blocks of main memory cannot be placed anywhere in the lines of cache memory. For
example B0 placed in L1 0r B1 placed in L2 is not possible.
L0 B1 B0
1Block =
B1
L1 B0 B2 4 words
.
L2 B3
.
L3 B1 .
.
.
Cache Memory = 16 words .
.
1 Line = 4 words B1023
K way set associative mapping is the best mapping as compare to both direct mapping and fully
associative mapping. Because k way set associative mapping is the combination of direct mapping and
fully associative mapping.
K way set associative mapping = direct mapping + fully associative mapping
In k way set associative mapping, only cache memory is divided in to sets, but not the main memory.
K way set associative mapping based on the formula: No. of lines in cache memory
K
For example: in 2 way set associative mapping, K = 2, & no. of lines in cache memory is 4, hence
4/2 = 2, means cache memory is divided into 2 sets: Set 0 and Set 1
For example: in 4 way set associative mapping, K = 4, & no. of lines in cache memory is 4, hence
4/4 = 1
Format of K way set associative mapping
L0 B0 Set 0
L1 B1 Tag Data Address
Set 1
L2 B1 Set 2
Tag Block Words
L3 B0
Set 3
Cache Memory
VIRTUAL MEMORY
Virtual memory is the partition of logical memory from physical memory. This partition supports large
virtual memory for programmers when only limited physical memory is available.
Virtual memory uses both the computer's software and hardware to work. It transfers processes between
the computer's RAM and hard disk by copying any files from the computer's RAM that aren't currently
in use and moving them to the hard disk. By moving unused files to the hard disk, a computer frees up
space in its RAM to perform current tasks, such as opening a new application. If the computer later needs
to use its RAM for a more urgent task, it can again swap files to make the most of the available RAM.
Virtual memory is defined as a memory management method where computers use secondary memory
to compensate for the shortage of physical memory.
Virtual memory provides benefits in terms of costs, physical space, multitasking capabilities, and data
security.
It is a technique that is implemented using both hardware and software. It maps memory addresses
used by a program, called virtual addresses, into physical addresses in computer memory.
Virtual memory is a method that computers use to manage storage space to keep systems running
quickly and efficiently. Using the technique, operating systems can transfer data between different types
of storage, such as random access memory (RAM), also known as main memory, and hard drive or
solid-state disk storage. At any particular time, the computer only needs enough active memory to
support active processes. The system can move those that are dormant into virtual memory until needed.
Allowing users to operate multiple applications at the same time or applications that are larger
than the main memory
Freeing applications from having to compete for shared memory space and allowing multiple
applications to run at the same time
Allowing core processes to share memory between libraries, which consists of written code that
provides the foundation for a program's operations
Improving security by isolating and segmenting where the computer stores information
Improving efficiency and speed by allowing more processes to sit in virtual memory
Lowering the cost of computer systems as you find the right amount of main memory and virtual
memory
Increasing the amount of memory available by working outside the limits of a computer's
physical main memory space
Optimizing central processing unit (CPU) usage
The two ways computers handle virtual memory are through paging and segmenting. Here are some of
the differences between these types of virtual memory:
1. Paging
Paging is a virtual memory technique that separates memory into sections called paging files. When a
computer reaches its RAM limits, it transfers any currently unused pages into the part of its hard drive
used for virtual memory. The computer performs this process using a swap file, a designated space
within its hard drive for extending the virtual memory of the computer's RAM. By moving unused files
into its hard drive, the computer frees its RAM space for other memory tasks and ensures that it doesn't
run out of real memory.
2. Segmenting
Segmentation is another method of managing virtual memory. A segmentation system divides virtual
memory into varying lengths and moves any segments that aren't in use from the computer's virtual
memory space to its hard drive. Like page tables, segment tables track whether the computer stores the
segment in memory or a physical address. Segmentation differs from paging because it divides memory
into sections of varying lengths, while paging divides memory into units of equal size. With paging, the
hardware determines the size of a section, but the user can select the length of a segment in a
segmentation system.
Segmentation is often slower than paging, but it offers the user more control over how to divide
memory and may make it easier to share data between processes. You can customize the segments
based on the machine's purpose and usage.
NUMERICALS
Q. What is the transfer rate of an eight-track magnetic tape whose speed is 120
inches per second and whose density is 1600 bits per inch?
Solution.
Data transfer rate per each track = tape speed x Density of tape.
8 bits = 1 byte.
Hence Data transfer speed per track = 192000 bits / 8 = 24000 Bytes / second.
= 192000 bytes / second = 192 KBytes / second. (∵ 1000 = 1 Kilo for speed calculation)
Q. Consider a cache consisting of 256 blocks of 16 words each for a total of 4096
words and assume that the main memory is addressable by a 16 bits address and it
consists of 4K blocks. How many bits are there in each of TAG, SET, WORD field
for 2-way set associative technique?
Solution.
In a 2-way set associative cache, each block in the cache can store two sets of words from main
memory. The cache in this question has 256 blocks with 16 words each, so there are a total of 512 sets
in the cache (256 blocks x 2 sets/block = 512 sets).
The main memory is addressable by 16-bit addresses, which means it can store 2^16 = 65,536 words.
Since each block in the main memory consists of 4k words, there are 65,536 / 4,096 = 16 blocks in the
main memory.
To determine the number of bits for the tag, set, and word in a 2-way set associative cache, we can use
the following formulas:
Therefore, the cache in this question has 4-bit words, 9-bit sets, and 3-bit tags.
Q. A two way set associative cache memory uses blocks of four words. The cache
can accommodate a total of 2048 words from main memory. The main
memory size is 128K × 32
a) Formulate all pertinent information required to construct the cache
memory. (Tag, index, data, blocks, words)
b) What is the size of cache memory.
Solution.
Now cache memory uses 1 block of 4 words so, total words in cache memory is 1024 words, hence
total number of blocks in cache memory = 1024/4 = 256 blocks = 28 blocks.
17 bits
Block = 8bits
TAG Block Word
1 Block = 4 words = 22 words
7 bits 8 bits 2 bits
Word = 2 bits
a) How many chips are needed & how should their address lines be connected to
provide a memory capacity of 1024*8?
b) How many chips are needed to provide a memory capacity of 16 KB?
Solution.
a) Total no. of chips needed = Total RAM (memory) Size/ one RAM chip size
= 1024*8/ 1024*1
Total no. of chips needed = Total RAM (memory) Size/ one RAM chip size
Q. The logical address space in a computer system consists of 128 segments. Each
segment can have up to 32 pages of 4K words each. Physical memory consists of
4K blocks of 4K words each. Formulate the logical and physical address formats.
Solution.
= 128 x 32 x 4 x 210
= 27 x 25 x 22 x 210 = 224
so we require 24 bits.
= 4 x 210 x 4 x 210
so we need 24 bits.
Address = 16 bits
Data = 16 bits
Index = 10 bits
16 bits address
Tag = Address – Index
TAG 6bits INDEX 10 bits
Tag = 16 – 10 = 6 bits
Block = 8 bits
Tag 6 bits Block 8 bits word 2 bits
1 block = 4 words = 22 words
Word = 2 bits
16 bit address
0
Block 0
Block 1
.
.
.
.
.
Block 255 1023
Cache memory
b) Number of bits are there in each word of cache, Include a valid bit =
23 bits
Given,
Number of blocks in cache memory = 64
Number of blocks in each set of cache = 4
Data is continuously replaced with new data in the cache memory using replacement
algorithm. There are 2 types of replacement algorithm:
FIFO – first in first out. Oldest item is replaced with the latest item.
LRU – least recently used. Item which is least recently used by CPU is removed or
replaced.