Module 5 Dfco
Module 5 Dfco
Module 5 Dfco
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.
In this article, we will take a look at the Design and Characteristics of Memory Hierarchy
according to the GATE Syllabus for CSE (Computer Science Engineering). Read ahead to
learn more.
1. Capacity
It refers to the total volume of data that a system’s memory can store. The capacity increases
moving from the top to the bottom in the Memory Hierarchy.
2. Access Time
It refers to the time interval present between the request for read/write and the data availability.
The access time increases as we move from the top to the bottom in the Memory Hierarchy.
3. Performance
When a computer system was designed earlier without the Memory Hierarchy Design, the gap in
speed increased between the given CPU registers and the Main Memory due to a large difference
in the system’s access time. It ultimately resulted in the system’s lower performance, and thus,
enhancement was required. Such a kind of enhancement was introduced in the form of Memory
Hierarchy Design, and because of this, the system’s performance increased. One of the primary
ways to increase the performance of a system is minimising how much a memory hierarchy has
to be done to manipulate data.
1. Registers
The register is usually an SRAM or static RAM in the computer processor that is used to hold the
data word that is typically 64 bits or 128 bits. A majority of the processors make use of a status
word register and an accumulator. The accumulator is primarily used to store the data in the
form of mathematical operations, and the status word register is primarily used for decision
making.
2. Cache Memory
The cache basically holds a chunk of information that is used frequently from the main memory.
We can also find cache memory in the processor. In case the processor has a single-core, it will
rarely have multiple cache levels. The present multi-core processors would have three 2-levels
for every individual core, and one of the levels is shared.
3. Main Memory
In a computer, the main memory is nothing but the CPU’s memory unit that communicates
directly. It’s the primary storage unit of a computer system. The main memory is very fast and a
very large memory that is used for storing the information throughout the computer’s operations.
This type of memory is made up of ROM as well as RAM.
4. Magnetic Disks
In a computer, the magnetic disks are circular plates that’s fabricated with plastic or metal with a
magnetised material. Two faces of a disk are frequently used, and many disks can be stacked on
a single spindle by read/write heads that are obtainable on every plane. The disks in a computer
jointly turn at high speed.
5. Magnetic Tape
Magnetic tape refers to a normal magnetic recording designed with a slender magnetizable
overlay that covers an extended, thin strip of plastic film. It is used mainly to back up huge
chunks of data. When a computer needs to access a strip, it will first mount it to access the
information. Once the information is allowed, it will then be unmounted. The actual access time
of a computer memory would be slower within a magnetic strip, and it will take a few minutes for
us to access a strip.
Cache Memory
Cache memory is a high-speed memory, which is small in size but faster than the main
memory (RAM). The CPU can access it more quickly than the primary memory. So, it is
used to synchronize with high-speed CPU and to improve its performance.
Cache memory can only be accessed by CPU. It can be a reserved part of the main
memory or a storage device outside the CPU. It holds the data and programs which
are frequently used by the CPU. So, it makes sure that the data is instantly available for
CPU whenever the CPU needs this data. In other words, if the CPU finds the required
data or instructions in the cache memory, it doesn't need to access the primary
memory (RAM). Thus, by acting as a buffer between RAM and CPU, it speeds up the
system performance.
L3: It is known as Level 3 cache or L3 cache. This cache is not present in all the
processors; some high-end processors may have this type of cache. This cache is used
to enhance the performance of Level 1 and Level 2 cache. It is located outside the CPU
and is shared by all the cores of a CPU. Its memory size ranges from 1 MB to 8 MB.
Although it is slower than L1 and L2 cache, it is faster than Random Access Memory
(RAM).
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.
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 by the memory and are marked for reading.
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.
The following diagram can represent the relation between the memory array and the external
registers in an associative memory.
The cells present inside the memory array are marked by the letter C with two subscripts. The
first subscript gives the word number and the second specifies the bit position in the word.
For instance, the cell Cij is the cell for bit j in word i.
A bit Aj in the argument register is compared with all the bits in column j of the array
provided that Kj = 1. This process is done for all columns j = 1, 2, 3......, n.
If a match occurs between all the unmasked bits of the argument and the bits in word i, the
corresponding bit Mi in the match register is set to 1. If one or more unmasked bits of the
argument and the word do not match, Mi is cleared to 0.
In this scheme, User can load the bigger size processes than the available main memory
by having the illusion that the memory is available to load the process.
Instead of loading one big process in the main memory, the Operating System loads the
different parts of more than one process in the main memory.
By doing this, the degree of multiprogramming will be increased and therefore, the CPU
utilization will also be increased.
Since all this procedure happens automatically, therefore it makes the computer feel like
it is having the unlimited RAM.
Demand Paging
Demand Paging is a popular method of virtual memory management. In demand paging,
the pages of a process which are least used, get stored in the secondary memory.
A page is copied to the main memory when its demand is made or page fault occurs. There
are various page replacement algorithms which are used to determine the pages which
will be replaced. We will discuss each one of them later in detail.
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.
Advantages of Virtual Memory
The OS also determines which processes will get memory resources and
when those resources will be allocated. As part of this operation, an OS
might use swapping to accommodate more processes. Swapping is an
approach to memory management in which the OS temporarily swaps a
process out of main memory into secondary storage so the memory is
available to other processes. The OS will then swap the original process
back into memory at the appropriate time.
• Recycling. When a program no longer needs the memory space that has
been allocated to an object or data structure, that memory is released
for reassignment. This task can be done manually by the programmer or
automatically by the memory manager, a process often called garbage
collection.
Vector processing is a central processing unit that can perform the complete vector
input in individual instruction. It is a complete unit of hardware resources that
implements a sequential set of similar data elements in the memory using individual
instruction.
The scientific and research computations involve many computations which require
extensive and high-power computers. These computations when run in a
conventional computer may take days or weeks to complete. The science and
engineering problems can be specified in methods of vectors and matrices using
vector processing.
An array processor contains multiple numbers of ALUs. Each ALU is provided with the
local memory. The ALU together with the local memory is called a Processing Element
(PE). An array processor is a SIMD (Single Instruction Multiple Data) processor. Thus
using a single instruction, the same operation can be performed on an array of data
which makes it suitable for vector computations.
Pipes
Pipe is widely used for communication between two related processes. This is a
half-duplex method, so the first process communicates with the second
process. However, in order to achieve a full-duplex, another pipe is needed.
Message Passing:
It is a mechanism for a process to communicate and synchronize. Using
message passing, the process communicates with each other without resorting
to shared variables.
Message Queues:
A message queue is a linked list of messages stored within the kernel. It is
identified by a message queue identifier. This method offers communication
between single or multiple processes with full-duplex capacity.
Direct Communication:
In this type of inter-process communication process, should name each other
explicitly. In this method, a link is established between one pair of
communicating processes, and between each pair, only one link exists.
Indirect Communication:
Indirect communication establishes like only when processes share a common
mailbox each pair of processes sharing several communication links. A link can
communicate with many processes. The link may be bi-directional or
unidirectional.
Shared Memory:
Shared memory is a memory shared between two or more processes that are
established using shared memory between all the processes. This type of
memory requires to protected from each other by synchronizing access across
all the processes.