Computer Memory Organization
Computer Memory Organization
• When CPU needs the data, first of all, it looks inside the L1
cache.
• If it does not find anything in L1, it looks inside the L2
cache.
• If again, it does not find the data in L2 cache, it looks into
the L3 cache.
• If data is found in the cache memory, then it is known as a
cache hit.
• On the contrary, if data is not found inside the cache, it is
called a cache miss.
• If data is not available in any of the cache memories, it looks
inside the Random Access Memory (RAM).
• If RAM also does not have the data, then it will get that data
from the Hard Disk Drive.
• So, when a computer is started for the first time, or an
application is opened for the first time, data is not available
in cache memory or in RAM.
• In this case, the CPU gets the data directly from the hard disk
drive.
• Thereafter, when you start your computer or open an
application, CPU can get that data from cache memory or
RAM.
Associative Memory
• An associative memory can be considered as a memory
unit whose stored data can be identified for access by the
content of the data itself rather than by an address or
memory location.
• When a write operation is performed on associative
memory, no address or memory location is given to the
word.
• The memory itself is capable of finding an empty unused
location to store the word.
• On the other hand, when the word is to be read from an
associative memory, the content of the word, or part of the
word, is specified.
• The words which match the specified content are located
Representation of an Associative
memory
• From the block diagram, we can say that an associative
memory consists of a memory array and logic for 'm' words
with 'n' bits per word.
• The functional registers like the argument register A and key
register K each have n bits, one for each bit of a word.
• The match register M consists of m bits, one for each
memory word.
• The words which are kept in the memory are compared in
parallel with the content of the argument register.
• The key register (K) provides a mask for choosing a
particular field or key in the argument word.
• If the key register contains a binary value of all 1's, then the
entire argument is compared with each memory word.
• Otherwise, only those bits in the argument that have 1's in
their corresponding position of the key register are
compared.
• Thus, the key provides a mask for identifying a piece of
information which specifies how the reference to memory
is made.
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
Memory Access Methods
• 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.
Random Access
• In this method, any location of the memory can be
accessed randomly like accessing in Array.
• Physical locations are independent in this access method.
• Most used in RAM and ROM
Direct Access
• In this method, individual blocks or records have a unique
address based on physical location.
• Access is accomplished by direct access to reach a general
vicinity plus sequential searching, counting or waiting to
reach the final destination.
• This method is a combination of above two access methods.
• The access time depends on both the memory organization
and characteristics of storage technology. The access is
semi-random or direct.
• Application of direct memory access is magnetic hard disk,
read/write header
Sequential Access
• In this method, the memory is accessed in a specific linear
sequential manner.
• The access time depends on the location of the data.
• Applications of this sequential memory access are magnetic
tapes, magnetic disk and optical memories.
Associate Access
• In this memory, a word is accessed rather than its address.
• This access method is a special type of random access
method.
• Application of thus Associate memory access is Cache
memory.
Buffering in Computer
• Buffer is a region of memory used to temporarily hold data
while it is being moved from one place to another.
• A buffer is used when moving data between processes within
a computer. Majority of buffers are implemented in software.
• Buffers are generally used when there is a difference between
the rate at which data is received and the rate at which it can
be processed.
• If we remove buffers, then either we will have data loss, or we
will have lower bandwidth utilization
• In Buffering, Whether the communication is direct or
indirect, message exchanged by communicating processes
reside in a temporary queue.
• Buffering is typically used to manage data flow between
devices and helps regulate the rate of data transfer.
• The buffer allows the sender to transmit data at a faster
rate while the receiver processes the data at its own pace.
What's the role of a buffer in computer
architecture?
• A buffer in computer architecture serves as a temporary
storage area for data while it's being transferred between
two devices or processes.
• In more detail, a buffer is a region of physical memory
storage used to temporarily hold data while it is being
moved from one place to another.
• It's a crucial component in computer architecture as it
allows for the smooth and efficient transfer of data.
• This is particularly important when there's a difference in
speed between the source and destination of the data.
• For instance, when data is being transferred from a fast
device like a hard drive to a slower one like a printer, a
buffer can store the data from the hard drive while the
printer catches up.
• Buffers are also used in the management of data flows
between processes running at different speeds or with
different priorities.
• They can help to prevent bottlenecks in data flow and
ensure that processes run smoothly without interruption
• For example, when streaming a video online, a buffer is
used to store a certain amount of video data ahead of
what's currently being viewed.
• This allows the video to continue playing smoothly even if
there's a temporary slowdown in the internet connection.
• In addition, buffers are used in the implementation of
various data structures in computer programming, such as
stacks and queues.
• They are also used in the design of many types of
computer hardware, including CPUs and GPUs, where they
help to manage the flow of data between different parts of
the system.
Types of Buffering
i. Zero Capacity – This queue cannot keep any message
waiting in it. Thus it has maximum length 0. For this, a
sending process must be blocked until the receiving
process receives the message. It is also known as no
buffering.
ii. Bounded Capacity – This queue has finite length n. Thus
it can have n messages waiting in it. If the queue is not
full, new message can be placed in the queue, and a
sending process is not blocked. It is also known as
automatic buffering.
iii. Unbounded Capacity – This queue has infinite length.
Thus any number of messages can wait in it. In such a
system, a sending process is never blocked
Advantages of Buffering
i. It helps in matching speed between two devices, between
which the data is transmitted.
For example, a hard disk has to store the file received
from the modem.
ii. It helps the devices with different data transfer size to get
adapted to each other.
iii. It helps devices to manipulate data before sending or
receiving.
Advantages of Buffering
i. Regulating data flow between devices
ii. Allowing the sender to transmit data at a faster rate
iii. Preventing lost data due to network congestion
Disadvantages of Buffering
• Increased latency due to the time it takes to store and
retrieve data from the buffer
• Increased memory usage due to the buffer’s storage
requirements
Buffer Overflow and Underflow
• Buffer overflow occurs when more data is sent to a buffer
than it can handle, leading to data loss or corruption.
• Buffer underflow occurs when there is not enough data in
the buffer, leading to a delay in data transfer.
Application of Buffering
• Buffering is a critical component of streaming services,
such as Netflix and YouTube.
• When you stream a video, the data is transmitted in
packets and stored in a buffer before being displayed on
your screen.
• Buffering ensures that the video plays