Student's Name: HUMPHREY MARUBE
Reg No: 23/UG/871/BSCS-J
Instructor:
Course
Date
Questions:
1. For cachememory explain the following
1. Direct Memory
2. Set Associative Mapping
3. Associative Mapping
2. How is main memory useful in a computer system? Explainthe memory address map of
RAM and ROM
3. Write shortnotes on Associative memory and contentAddressable memor
Direct Memory:
The simplest technique, known as direct mapping, maps each block of main memory into only
one possible cacheline. or In Direct mapping,assign each memory block to a specific line in the
cache. If a line is previously taken up by a memory block when a new block needs to be loaded,
the old block is trashed. An address space is split into two parts index field and a tag field. The
cache isused to store the tag field whereas the rest is stored in the main memory.
Direct mapping`s performance is directly proportional to the Hit ratio. Relationships in the Direct
Mapping can be defined as:
i = j modulo m where
i = cache line number
j = main memory block number
m = number of lines in the cache
For purposes of cache access, each main memory address can be viewed as consisting of three
fields. The least significant w bits identify a unique word or byte within a block of main
memory. In most contemporary machines, the addressis at the byte level.The remaining s bits
specifyone of the 2s blocks of main memory. The cache logic interprets these s bits as a tag of s-r
bits (the most significant portion) and a line field of r bits. This latter field identifies one of the
m=2r lines of the cache.Line offset is index bits in the direct mapping.
Set Associative Mapping:
This form of mapping is an enhanced form of direct mapping where the drawbacks of direct
mapping are removed. Set associative addresses the problem of possible thrashing in the direct
mapping method. It does this by saying that instead of having exactly one line that a block can
map to in the cache, we will group a few lines together creating a set. Then a block in memory
can map to any one of the lines of a specific set. Set-associative mapping allows each word that
is present in the cache can have two or more words in the main memory for the same index
address. Set associative cache mapping combines the best of direct and associative cache
mapping techniques. In set associative mapping the index bits are given by the set offset bits. In
this case, the cache consists of a number of sets, each ofwhich consists of a number of lines.
Relationships in the Set-Associative Mapping can be definedas:
m = v * k i= j mod v
where
i = cache set number
j = main memory block number v = number of sets
m = number of lines in the cache number of sets k = number of lines in each set
Associative Mapping:
In this type of mapping, associative memory is used to store the content and addresses of the
memory word. Any block can go into any line of the cache. This means that the word id bits are
used to identify which word in the block is needed, but the tag becomes all of the remaining bits.
This enables the placement of any word at any place in the cache memory. It is considered to be
the fastest and most flexiblemapping form. In associative mapping,the index bits are zero.
What is virtual Memory?Explain relation betweenaddress space and memory space in
virtualmemory system
Virtual Memory:
A virtual memory is an abstraction that extends the available memory by usingdisk storage.
Virtual memory is a memory management technique used by operating systems to give the
appearance of a large, continuous block of memory to applications, even if the physical memory
(RAM) is limited. It allows the system to compensate for physical memory shortages, enabling
larger applications to run on systemswith less RAM.
The size of virtual storage is limited by the addressing scheme of the computer system and the
amount of secondary memory available not by the actual number of main storage locations.
Relation betweenaddress space and memory space:
Address space: Refers to the room of addresses which usually refers to the reference to the
different slots of virtual memory allotted to different processes. The address space is divided into
many regions,each of which servesa specific function.
This helps in:
Isolation: Each process is isolated from others, preventing them from interfering with each
other's memory.
Flexibility: Programs can be written as if they have access to a large amount of memory, even if
the physical memory is limited.
Memory space: Refers to the actualphysical locations in the main memory (RAM)where data is
stored.These are known as physical addresses.
The physical memory is shared among all processes, but each process only sees its own virtual
addressspace
Relationship: The relationship between address space and memory space is managed through a
processcalled address translation. Here's how it works:
Virtual to Physical Mapping: The operating system maintains a page table that maps virtual
addresses to physical addresses. When a process accesses a virtual address, the systemtranslates
it to the corresponding physical address using this table.
Paging: Memory isdivided into fixed-size blocks called pages (for virtual memory)
and frames (for physical memory). The page table keeps track of which virtual pages are stored
in which physicalframes.
Page Faults: If a process tries to access a virtual address that is not currently mapped to a
physical address (i.e., the data is not in RAM), a page fault occurs.
How is main memory useful in a computer system? Explain the memory address map of
RAM andROM
Use of the main memory in a computersystem:
Also known as RAM, it playsa crucial role in a computer system.Here we can see how it useful:
1 Temporary Storage: Main memory provides temporary storage for data and instructions that
the CPU needs while performing tasks. This allows for quick access and manipulation, which is
essentialfor efficient processing.
2 Speed:RAM is much faster than secondary storage devices like hard drives or SSDs. This
speed is critical for the overall performance of the computer, as it allowsthe CPU to quickly read
and write data.
3 Multitasking: Main memory enables multitasking by allowing multipleapplications to run
simultaneously. Each application gets a portionof the RAM, which helpsin switching
betweentasks smoothly withoutsignificant delays.
4 Data Access: When you open a file or an application, it is loaded from the slower secondary
storage into the faster main memory. This makes accessing and using the data much quicker.
5 Buffering: RAM is used for buffering data, which helps in managingthe flow of data
betweenthe CPU and other components like the GPU, network interfaces, and storage devices.
This buffering ensures smooth and efficient data transfer.
6 Virtual Memory: Main memory works in conjunction with virtual memory systems to extend
the apparent amount of RAM available. This allows the system to handle largerapplications and
datasetsthan the physicalRAM alone could support.
7 Caching:Adequate main memory helps in maintaining system stability by reducingthe chances
of crashes and slowdowns. When the systemhas enough RAM, it can handle more processes and
data without running into memory bottlenecks.
8 System Stability: Adequate main memory helps in maintaining system stability by reducing
the chances of crashes and slowdowns. When the system has enough RAM, it can handle more
processes and data without running into memorybottlenecks.
The memory address map is a crucial conceptfor understanding how data is located withinmain
memory. It defines a unique address for each memory location, allowing the CPU to efficiently
locate and access data.
v The memoryaddress map of RAM
1. Read-write: Data in RAM can be both read from and written to by the CPU. This is
essential for storing program instructions and data that need to be modified
duringprogram execution.
2. Dynamic allocation: The operating system dynamically allocatesmemory space in RAM
to running programs and data as needed. This flexibility allows efficientmemory
utilization.
3. Volatile: Data in RAM is lost when the computer shutsdown
v The memory address map of ROM:
1. Read-only: Data in ROM can only be read by the CPU, not written to. It
typicallycontains essential systemprograms like the BIOS (BasicInput/Output System)
that are needed for booting up the computer.
2. Fixed content: The content of ROM is pre-programmed by the manufacturer and cannot
be changed by the user. This ensures critical system programs remain intact.
3. Non-volatile: Data in ROM is retained even when the computer is powered off.
1. Short note on Associative memory and contentAddressable memory
1. Associative memory:
Definition: Also known as Content-Addressable Memory(CAM), is a type of memory that
allowsdata retrieval based onthe content rather than a specificaddress.
Key Features:
• Content-Based Access:Data is accessed by matching the content ratherthan using a memory
address.
• Parallel Processing: Multiple searches can be performedsimultaneously, making it faster for
certain applications.
It can be used for taskslike pattern recognition, data correlation, and implementing cacheswith
faster lookups based on content.
1. Addressable Memory:
Definition:Addressable memory refers to the conventional memory system wheredata is
accessed using specific memory addresses.
Key Features:
• Address-Based Access:Data is stored and retrieved using unique memoryaddresses.
• Sequential Processing: Data retrieval is typically done sequentially, which can be slower
compared to associative memory.
It can be used in general-purpose computing and standardRAM operations.