Memory Units And Memory Hierarchy
Memory organisation is combination of several memory devices efficiently. Memory devices are combined and organised based on their characteristic such as access time, speed, storage capacity, physical size and cost per byte. Memory devices organised in such a way that computer system should operate at highest speed, provide bulky storage capacity, smaller in size and less in a cost. Memory organisation uses primary memory devices and secondary memory devices.
3.2 Memory Unit
Memory unit is storage unit of the computer system. It stores content such as instructions (codes) and data for temporary or permanent purpose. It is used to stores content and to retrieves the content when needed by CPU or user. Memory unit includes two types of memory: primary (main) and secondary. Instruction or data given by input devices is first getting stored in the primary memory. Further users saves processed (executed) data in the secondary memory. Primary memory is volatile (temporary). It is faster than secondary memory. It includes RAM and ROM. It is directly accessible by CPU. Secondary memory is non-volatile (permanent). It includes several secondary storage devices such as Hard Disk Drive (HDD), Floppy Disk Drive (FDD), CDROM, and DVD and so on. Figure 3.1 shows memory unit and communication line with other units.
Note: Volatile memory loses its content when computer loses power. In non-volatile memory power loss of computer does not affects content.
Input Unit
Process Unit
Output Unit
Primary Memory
Secondary Memory
Memory Unit
3.3 Memory hierarchy
Memory organisation includes various memory devices. These devises are structured in a hierarchy based on the characteristics of memory devices. Memory hierarchy explains the sequence of accessing memory device while processing, in the computer system. Memory is structured in the hierarchy in such a way that computer system should give excellent performance. Figure 3.2 shows Memory hierarchy. Hierarchy is made on the basis of characteristics of memory, they are listed as follow:
Access Time – Time taken by memory to read or write data. It is measured in milliseconds (ms) or in nanoseconds (ns).
Memory size – It is amount of memory. Measured in KB, MB, GB or TB.
Cost per byte – It is cost required to access per byte.
Transfer bandwidth – It is speed of the memory. It measured in MHz, GHz.
Unit of transfer – Data transfer rate. Measured in Kbps, Mbps or Gbps.
Increasing speed and cost per bit dcreeasing sisize
Registers in CPU
Level one cache
Level two cache
Main memory
Virtual Memory
Increasing Size, decreasing speed and cost
capacity
Secondary Storage devices
Figure 3.2 Memory Hierarchy
Memory hierarchy includes CPU registers on the top. Register provides fastest data access and it is one of the most expensive memory location.
Second and third levels are level-1 and level-2 cache respectively. The level one cache is small in size (4 KB to 32 KB) though much larger than register. It is fixed on CPU chip so user can not expand.
The level-2 cache is present on some CPUs only. It is much larger than level-1 cache. User can not expand it as it is fixed on CPU chip but it is cheaper than level-1 cache.
Virtual memory is part of disk drive, which simulates to Random Access Memory (RAM). Disk drives are less expensive; so cost per bit is significantly less. Secondary storage devices are such as Hard Disk Drive (HDD), Floppy Disk Drive (FDD), Compact Disk Read Only Memory (CDROM), Digital Versatile Disk (DVD) and tape drives. It is bit slower.
3.4 Memory types
Basic purpose of memory is to store content. Still memory is available in different types. Basic type of memory is primary memory and secondary memory. Types are made based on memory characteristics and its role in the computer system. Primary memory is the first memory used by CPU, so it should be faster and easily accessible. To make primary memory as per the requirement, memory organisation includes RAM and ROM as primary memory. The main use of secondary memory is use to store user’s data permanently. Speed of secondary memory can be compromised, but storage capacity should be excellent. So memory organisation includes HDD, FDD, and CDROM and so on as a secondary memory. Figure 3.2 shows types of memory.
3.4.1 Primary Memory
Primary memory is access directly by CPU. Primary divided in to two types RAM and ROM. Primary memory should be faster and easily accessible.
RAM – RAM is a primary memory used in the computer. RAM is the main memory of the computer system. It is volatile since its content is accessible only as long as the computer is ON. The content of RAM is cleared as soon as computer is powered OFF. It is at third place in the memory hierarchy. Operating system, application program and running data are loaded in the RAM. CPU directly accesses the RAM.
Types of RAM are as follows:
Static Random Access Memory (SRAM) – SRAM is made with several transistors, usually four to six, for each memory cell. It does not require refresh time as capacitors are not used. It is much faster and costlier than DRAM. Computer system use SRAM as cache memory.
DRAM (Dynamic Random Access Memory) – It has memory cells with a paired transistor; it uses capacitor, as capacitors slowly leaks with as they stared discharging, so need periodic refresh. It is slower and chippers than SRAM. It is much denser (stores many bits per chip). It requires less power and generates less heat as compared to the SRAM. DRAM is available in several forms such as SDRAM, then DDRAM to RDRAM.
Read Only Memory (ROM) – ROM is non-volatile primary memory. Data written on ROM can not delete or overwrite. Data is burned on the ROM as firmware. ROM memory is used in the computer system to write firmware for example BIOS program.
Types of ROM are as follows:
Programmable read-only memory (PROM) – This type of memory is one time written memory. Once program is written can not be change.
Erasable programmable read-only memory (EPROM) – Data written on EPROM can be erased. Ultraviolet is used to erase the data written on PROM.
Electrically erasable programmable read-only memory (EEPROM) – It is same as EPROM but to erase data entirely it requires electrical signal. So not require to remove from computer. Data can be erased or over written it the computer itself.
3.4.2 Secondary Memory
A secondary memory is non-volatile. Secondary memory used to save user’s data permanently. Devices used as secondary memory are HDD, FDD, CD, DVD, Tape drives and so on. Secondary memory is at sixth place in the memory hierarchy.
Devices used as secondary memory are listed as follows:
Floppy Disk Drives (FDD) – Used as magnetic, portable memory device. It stores maximum 1.44 MB data. Earlier it used to transfer data among computer systems.
Hard Disk Drives (HDD) – HDD is fixed, magnetic memory device. It is vital in the computer system because Operating System and user’s data is saved on the HDD. Storage capacity of HDD is vendor specific.
CDROM and DVDROM – Are optical memory units used for transferring data and programs among the computers. CDs are available in the size 650MB, DVDs are available up to 4 GB in a size.
Tape drives – Are usually used for data backup purpose.
3.6 Cache Memory
The cache is small amount of memory with high speed. Cache memory keeps data and code (introductions) that are used by CPU often. Use of cache memory reduced the waiting time of CPU that makes CPU more effective. SRAM is used to create cache memory. SRAM does not required refresh as it does not use capacitors as DRAM, it is 10 times faster than DRAM. Cache is of two types Level-1 that is placed ion the CPU. Level 2 cache is optional some processors have this type of memory that is some time placed inside the CPU or placed near by CPU. To execute next instruction, CPU first check cache memory for the same instruction if that instruction is not available then it goes further.
Note: DRAM is made up of capacitors which need constant refreshing to preserve data. SRAM uses flip-flop circuit that does not require refresh.
3.6.1 Cache line replacement Algorithms
While a new line is loaded in the cache, one of the existing lines must be replaced. Direct mapped cache, same block from line is removed take place for new one. In associative cache, it can search for another place.
Four of the most common line replacement algorithms are as follows:
LRU (Lease Recently Used) – the cache line that was last referenced in the most distance past is replaced.
FIFO (First In – First Out) – the cache line from the set that was loaded in the most distant past is replaced.
LFU ( Least Frequently Used) – the cache line that has been referenced the times is replaced.
Random – a randomly selected line from cache is replaced.
Note: The most commonly used algorithm is LRU.
Cache Terminology
Cache use few terminology for operation are as follows:
Hit – A cache access finds data the cache memory
Miss – A cache access does not find data or instruction, forcing access to next memory down in memory hierarchy.
Miss ratio – Percent of misses to data compared to all accesses.
Hit access time – Number of clocks to return a cache hit
Miss penalty – Number of clocks to process a cache miss.
Virtual Memory
Operating system enables a process through which space of hard disk drive can be simulate to RAM. The HDD space used as RAM is known a Virtual Memory.
As cost per byte of HDD is less, so virtual memory is beneficial to run many large programs that need more memory. Access time of RAM is in nanoseconds but virtual memory gives access time in milliseconds. It is much slower than RAM. Figure 5.1 shows operation of virtual memory.
Virtual memory uses paging and segmentation terminologies. Terms used by paging are as follows:
Virtual address- Address used by application program from virtual memory. It is composed of page number and page offset.
Physical address – Address of physical memory.
Page – virtual space divided into fixed-size pages.
Frame – Physical memory divided into fixed frames size.
MMU – Memory Management Unit (MMU) used to map virtual address to physical address.
Page table – Each process has its own page table. Each page table entry contains the frame number of the corresponding page in main memory
Figure 3.4 Virtual memory operations
3.8 Chapter Review Questions
Which of the following is primary volatile memory?
(A)
RAM
(C)
ROM
(B)
HDD
(D)
FDD
Ans: A
Which among the following are magnetic storage devices?
(A)
HDD
(C)
FDD
(B)
CDROM
(D)
DVDROM
Ans: A and C
Maximum storage capacity FDD is ——-
(A)
2GB
(C)
2.44 MB
(B)
1.44MB
(D)
None of these
Ans: B
A ÂÂÂ____ is used as cache memory in the computer system.
(A)
SRAM
(C)
DRAM
(B)
SDRAM
(D)
ROM
Ans: A
Which of the following is primary non-volatile memory?
(A)
Cache
(C)
ROM
(B)
Virtual
(D)
None of these
Ans: C
Which of the following ROMs’ content can be deleted using ultraviolet?
(A)
PROM
(C)
EPROM
(B)
ROM
(D)
EEPROM
Ans: C
Virtual memory is concept of ——————–
(A)
Using HDD space as RAM
(C)
Using FDD space as a RAM
(B)
Logical based
(D)
Protocol based
Ans: A
8. In the memory hierarchy which memory is at first level?
(A)
Register
(C)
L1 cache
(B)
L2 cache
(D)
None of these
Ans: A
9. Which memory takes second place in the memory hierarchy?
(A)
L1 cache
(C)
L2 cache
(B)
ROM
(D)
HDD
Ans: B
10. MMU stands for ——————–
(A)
Memory Mixture unit
(C)
Memory Management Unit
(B)
Memory measurement Unit
(D)
None of these
Ans: C
3.8.1 Answers
1. A
2. A and C
3. B
4. A
5. C
6. C
7. A
8. A
9. B
10. C
Summary
In the chapter, Memory Organisation, you learnt about:
Different memory units and its types.
Memory hierarchy based on memory characteristics.
Cache and its replacement algorithm.
Virtual memory and paging.
Order Now