Co Unit-Iii
Co Unit-Iii
Co Unit-Iii
UNIT-III
Basic concepts of memory system
Introduction: Computer should have a large memory to facilitate execution of programs
that are large and deal with huge amounts of data. The memory should be fast, large, and
inexpensive. Unfortunately, it is impossible to meet all three of these requirements
simultaneously. Increased speed and size are achieved at increased cost.
The maximum size of the memory that can be used in any computer is determined by the
addressing scheme.
For example,
a. a 16-bit computer that generates 16-bit addresses is capable of addressing up to
216 = 64K (65536) memory locations.
b. Similarly, machines whose instructions generate 32-bit addresses can utilize a
memory that contains up to 232 = 4G (giga) memory locations,
c. whereas machines with 4O-bit addresses can access up to 240 = 1 T (tera) locations.
The number of locations represents the size of the address space of the computer.
From the system, we can view the memory unit as a black box. Data transfer between the
memory and the processor takes place through the use of two processor registers.
a. Usually called MAR (memory address register) and MDR (memory data register).
b. If MAR is k bits long and MDR is n bits long.
c. The memory unit may contain up to 2 k addressable locations.
d. During a memory cycle, n bits of data are transferred between the memory and the
processor.
e. This transfer takes place over the processor bus, which has k address lines and n
data lines.
f. The bus also includes the control lines Read / Write ( R / W ) and Memory Function
Completed (MFC) for coordinating data transfers.
g. Other control lines may be added to indicate the number of bytes to be transferred.
The connection between the processor and the memory.
1
VSREDDY
2
VSREDDY
o The :igure represents the memory circuit with 16 words (W0 to W15) where each
word has a word length of 8 bits (b0 to b7). So, this is referred to as 16×8 memory
organization.
o Memory cells of the same row or a word are connected via a common line which
we refer to as a word line. On the other hand, all the memory cells of a column are
connected to a sense/write circuit via two-bit lines. Further, the sense/ write
circuit is connected to data input and output lines.
RAM being volatile memory, each of its addressable locations can be accessed in a very
short time. Each addressable location in RAM has a :ixed accessing time independent of
its location and prior accessing patterns. RAM can be classi:ied as either static RAM or
dynamic RAM.
1. Static RAM
In static RAM memories or SRAM, the content of the memory cell retains as long as the
power supply to the memory chip is ON. In any situation, if the power supply to the
memory chip is interrupted then the content of memory cells of static RAM is also lost.
When the power is resumed back to the memory chip there is no guarantee that the
memory cells may have the same content as they have before the interruption of the
power supply. This is the reason the static RAM is volatile in nature
2. Dynamic RAM
The static RAM is faster its memory cells require several transistors which makes it
expensive. So, to design a less expensive and higher density RAM we have to implement it
using simpler cells.
3
VSREDDY
But, the fact with the simpler cell is that the simpler cell does not hold data for a long
period until the data is accessed from the cell frequently either for read or write
operation. The memory circuit implemented using such simpler cells is referred to as
dynamic RAMs.
In dynamic RAM the information is stored in the memory cell by imposing the charge on
the capacitor. But the capacitor can hold charge only for tens of milliseconds and to hold
the content for a longer time the capacitor must be charged to its full value. The capacitor
is charged while its content is refreshed either by reading the contents from the cell or
writing new information to the cell.
Being a non-volatile memory, the ROM memories can only be read and not written.
ROM memories are written once at the time of their manufacturing. Once written the ROM
memories cannot be rewritten or modi:ied. Usually, the ROM memories store small
programs that are essential for ef:icient working of computers like system programs,
subroutines, etc.
ROM memories have various forms such as PROM, EPROM, EEPROM, and :lash memory.
1. Programmable ROM (PROM): PROM is written with the help of electric signals. PROM
can be written by the manufacturer or it even allows the user to write on PROM but it
requires some special equipment. It provides :lexibility as it lets users program it.
The EEPROM can be programmed, erased, and read electrically. However, a different
voltage is required for each operation and this makes the circuit even more complex. But
the complexity of the circuit can be outweighed by many advantages of EEPROM.
4. Flash memory
The :lash memory is similar to EEPROM and uses electrically erasing technology. Flash
memory also allows selective erasure and selective writing of cells. The difference is that
the :lash memory can write an entire block of cells at once. The other difference is that
the :lash memory uses the same voltage to write, erase, and read the memory. This
reduces the complexity of the circuit and even consumes less power.
4
VSREDDY
Primary Secondary
Level Register Cache
memory memory
Bandwidth 4k to 32k MB/sec 800 to 5k MB/sec 400 to 2k MB/sec 4 to 32 MB/sec
Size Less than 1KB Less than 4MB Less than 2 GB Greater than 2 GB
Access time 2 to 5nsec 3 to 10 nsec 80 to 400 nsec 5ms
Managed by Compiler Hardware Operating system OS or user
5
VSREDDY
Cache Memories
Is volatile memory that is used to store frequently accessed data for quick
retrieval. It acts as a buffer between the CPU (Central Processing Unit) and the main
memory (RAM - Random Access Memory), signi:icantly speeding up data access and
processing. Here are some key aspects of cache memory
Cache memory is sometimes called CPU (central processing unit) memory because it is
typically integrated directly into the CPU chip or placed on a separate chip that has a
separate bus interconnect with the CPU. Therefore, it is more accessible to the processor,
and able to increase ef:iciency.
Cache memory needs to be much smaller than main memory. Consequently, it has less
storage space. It is also more expensive than main memory, as it is a more complex chip
that yields higher performance.
Cache memory operates between 10 to 100 times faster than RAM, requiring only a few
nanoseconds to respond to a CPU request.
1. L1 cache, or primary cache, is extremely fast but relatively small, and is usually
embedded in the processor chip as CPU cache.
6
VSREDDY
Write-through: Data is written to both the cache and main memory at the same time.
Write-back: Data is only written to the cache initially. Data may then be written to main
memory, but this does not need to happen and does not inhibit the interaction from taking
place.
Performance Considerations
Two key factors in the commercial success of a computer are performance and cost; the
best possible performance at the lowest cost is the objective. The challenge in considering
design alternatives is to improve the performance without increasing the cost.
Performance depends on how fast machine instructions can be brought into the
CPU for execution and how fast they can be executed.
`The main purpose of memory hierarchy is to create a memory that the CPU sees
as having a short access time and a large capacity. Each level of the hierarchy plays
an important role. The speed and ef:iciency of data transfer between various levels of
the hierarchy are also of great signi:icance. It is bene:icial if transfers to and from the
faster units can be done at a rate equal to that of the faster unit. This is not possible if
both the slow and the fast units are accessed in the same manner, but it can be achieved
when parallelism is used in the organization of the slower unit. An effective way to
introduce parallelism is to use an interleaved organization.
7
VSREDDY
Interleaving
Memory interleaving is a technique used in computer architecture to increase the
speed of memory access. It's a method of arranging memory storage to maximize the
throughput and minimize the access latency.
How It Works:
1. Parallel Access: When a processor accesses memory, it can retrieve data from
multiple modules simultaneously, as each module operates independently. This
parallelism increases the overall memory bandwidth.
2. Reducing Latency: Since each memory module gets more time to refresh between
accesses (as other modules are being accessed), it can reduce the effective latency.
3. Sequential Access Optimization: Interleaving is particularly effective for
sequential memory accesses, which are common in many applications. The
processor can access a series of data points without waiting for a single module to
complete all read/write operations.
Hit Rate and Miss Penalty
the memory hierarchy is the success rate in accessing information at various levels of the
hierarchy. Recall that a successful access to data in a cache is called a hit. The number of
hits stated as a fraction of all attempted accesses is called the hit Rate, and the miss rate
is the number of misses stated as a fraction of attempted accesses.
Caches on the CPU Chip
When information is transferred between different chips, considerable delays are
introduced in driver and receiver gates on the chips. Thus, from the speed point of view,
the optimal place for a cache is on the CPU chip. Unfortunately, space on the CPU chip is
needed for many other -functions; this limits the size of the cache that can be
accommodated.
Virtual Memory
Virtual Memory is used in the computer memory to increase the storage capacity of the
main memory. It is a logical storage unit of a computer that creates an illusion to execute
a large program that may not be completely placed in the main memory. Furthermore, it
allows the user to load or store the data program or :iles larger than the size of the main
memory.
1. Virtual Memory allows the users to run more than one application at once.
2. It enhances the degree of multiprogramming in the virtual memory.
3. Virtual Memory is a logical unit of computer memory that increases the main
memory capacity by storing or executing a large size program than the main
memory.
4. It does not require any :ixed limit on the degree of multiprogramming.
5. It increases the CPU utilization in the virtual memory.
6. It is required whenever the system does not have much space to store any big
programs or :iles.
8
VSREDDY
1. Relocation:
The programmer does not know where the program will be placed in memory
when it is executed while the program is executing, it may be swapped to disk and
returned to main memory at a different location (relocated). Memory references must be
translated into the code to the actual physical memory addresses.
The address generated by the CPU is said to be a logical address. An address
generated by MMU is called a physical address.
2. Protection:
Processes should not be able to reference memory locations in another process
without permission. It must be checked at run time. The memory protection requirement
must be satis:ied by the processor (hardware) rather than the operating system
(software).
The word protection means provide security from unauthorized usage of memory.
The operating can protect the memory with the help of base and limit register. Base
registers consisting of the starting address of the next process. The limit speci:ies the
boundary of that job, so the limit register is also said to be a fencing register.
3. Sharing:
Allow several processes to access the same portion of memory. It is better to allow each
process access to the same copy of the program rather than have their own separate copy.
4. Logical organization:
Programs are written in modules. Modules can be written and compiled independently.
Different degrees of protection given to modules (read-only, execute-only). Modules are
shared among processes.
5. Physical organization:
Memory available for a program plus its data may be insuf:icient. Overlaying allows
various modules to be assigned to the same region of memory.
9
VSREDDY
Secondary Storage
This is also known as External Memory/Storage memory/Auxiliary memory/Backup
memory. It is used for storing data and instructions both permanently. It is also used to
transfer data from one computer to another. Secondary memory is not directly
accessible to the CPU. It is usually slower for operations like read/write, cheaper and
used in larger storage capacity.
Example: Hard disk, CD, DVD, Pen drive, etc.
Types of Secondary memory
1. Magnetic memory
2. Optical memory
Magnetic memory
Magnetic memory uses the property of a magnet for storing data. It is in use since the
:irst generation of computers. It contains data storing surface coated by magnetic oxide
compound. Magnetic memory is further divided as:
1. Magnetic Drum
Magnetic drum contains a metallic drum coated by magnetic oxide on the outer
surface of the drum, data is stored on this surface. It was in use in the :irst and
second generations of computers.
2. Magnetic tape
The magnetic tape contains a thin plastic ribbon, only one side of the ribbon is
used for storing data. The data storing side is coated by compound magnetic oxide.
It is a sequential access memory. So, the data read/write speed is slower. It mainly
used is for storing audio, video and backup data. It is highly reliable. It has a storage
capacity of 100MB-200GB. The width of the ribbon ranges between 4mm-1inch.
3. Magnetic disk
The magnetic disk contains a circular disc made of metal or plastic. Both sides of
the disc is usually used for storing data. The disc is coated with magnetic oxide.
The disc is divided into multiple concentric circles known as a track. Tracks are
further divided into a small areas known as sectors. Data are stored in sectors.
Example: Hard disk, :loppy disk, zip disk, Online Classroom Program disk,
Winchester disk, Jaz disk.
4. Hard disk
It is used as the main storage device of the computer. It uses 2-4 metallic disks
(platter). The disk is usually made of aluminium. Both sides of the disk are used
for storing data instead of the upper side of the uppermost disk and the lower side
of the lowermost disk. The data storing surface is coated with magnetic oxide. Each
data storing surface contains a separate read/write head. During data read/write
operations, the platter rotates at the rate of 3600-15000rpm. The hard disk is also
known as a hard drive because both data storing disk and data read/write
components are combined. It has a storage capacity of few megabytes to terabytes.
5. Floppy disk
10
VSREDDY
It contains a single plastic disk. Initially, it was used as the main storage device but
nowadays it is used for carrying data from one computer to another. It requires a
:loppy drive for its operation. It is unreliable and a hard disk because the data
storing surface is exposed. So, it may be affected by dust particles and magnetic
:ields.
Optical Memory
Optical memory uses the light beam for its operation. It is developed in the fourth
generation of computers. It is mainly used for storing audio/video, backup as well as
carrying data. It requires an optical drive for its operation. Its read/write speed is slower
compared to hard disk and :lash memories.
Example: CD, DVD, BD
1. CD
It stands for Compact Disk. It has a storage capacity of 700 MB or approx. to 90
minutes of standard audio. CD contains hard circular plastic; a single side of this
plastic is coated with aluminium alloy. This alloy stores data. It is protected by an
additional thin plastic covering. CD required CD drive for its operation.
Types of CD are:
-CD-R is a blank CD in which data can be stored once. After storing data it is
converted into CD-ROM.CD-ROM It cannot be erased or updated. CD-RW
can also be erased and used multiple times.
2. DVD
It stands for Digital Versatile Disk. It has a storage capacity between 4.7GB to 17GB.
Its shape and size are similar to CD but the difference in storage capacity is due to
different chemical components and data is compressed before storing. It requires
a DVD drive for its operation. The read/write speed of a DVD is slower than that of
a CD. Types of DVD are:
a. DVD-R
b. DVD-ROM
c. DVD-RW
d. DVD can also be classi:ied as:
1. Single-sided single-layered DVD (4.7GB)
2. Single-sided dual-layered DVD (7-8GB)
3. Dual-sided single-layered DVD (9GB)
4. Dual-sided dual-layered DVD (17GB)
3. BD
It stands for Blu-ray disk. It has a storage capacity of 25GB-50GB. It requires a BD
drive for its operation. Its shape and size are like CD and DVD. Types of BD are:
a. BD-R
b. BD-ROM
c. BD-RW
The working mechanism of CD
The surface of the CD contains land and pit. Land represents binary 1 and pit
represents binary 0. During the CD reading process, a beam of light is emitted
11
VSREDDY
which strikes the surface of the CD and gets re:lected. The re:lection is captured
by the lens in the CD drive. The difference in re:lection from land and pit is
identi:ied to determine 1 and 0. The land is in a crystalline form and the pit is in
amorphous form. The size of land and pit is smaller in DVD compared to CD.
Important Questions
Small questions
Assignments questions
Small questions
Large questions
12