This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
Memory stores, instructions and data. Memory is of two types, primary memory and secondary memory. Instruction or data given by input devices is first getting stored in the primary memory. Further user saves processed (executed) data in the secondary memory. Primary memory is temporary and secondary memory is permanent.
Primary memory is the main memory of the computer system. It is faster than secondary memory. It directly communicates with CPU.
3.2 Memory Unit
Computer uses several types of memories to save instructions and data. Computer uses RAM and ROM as primary memory.
RAM is a primary memory used in the computer. 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. SRAM is used as cache memory in the computer system. A DRAM is used as main memory of the computer system. Types of DRAM are as SDRAM, DDRAM and RDRAM.
ROM (Read Only Memory) is non-volatile; read only memory unit. It used to store firmware, for example BIOS program. User can only read content of the ROM, can not write or modify.
A secondary memory is non-volatile. A devices used as secondary memory are HDD, FDD, CD, DVD, Tape drives and so on.
FDD (Floppy Disk Drives) used as magnetic, portable memory device. It stores maximum 1.44 MB data. Earlier it used to transfer data among computer systems.
HDD (Hard Disk Drives) are fixed, magnetic memory device. It is vital in the computer system because user saves permanent data on the HDD. Storage capacity of HDD is vendor specific.
CDs and DVDs 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.
Figure 3.1 Memory Types
3.3 Memory hierarchy
Computer system includes varies types of memories such as Primary memory, Secondary memory, tape drives and so on. These all memories are organised in hierarchy to get better performance. Memory hierarchy explains you that how computer system use memory while execution.
Figure 3.3 shows Memory hierarchy. This hierarchy is made on the basis of few characteristics of memory, as listed follow:
Access Time - Time taken by memory to read or write data.
Memory size - It amount of memory.
Cost per byte - it is cost required to access per byte.
Transfer bandwidth - It speed of the RAM.
Unit of transfer - Data transfer rate.
Increasing speed and cost per bit an decreasing size
Registers in CPU
Level one cache
Level two cache
Increasing Size, decreasing speed and cost
Figure 3.3 Memory Hierarchy
Memory hierarchy is having CPU's general purpose 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 (4Kbytes to 32 Kbytes) 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 one cache. User can not expand it as it is fixed on CPU chip but it is less in cost than level one cache.
Virtual memory is part of disk drive, which simulates to memory. Disk drives are less expensive; so cost per bit is significantly less.
File storage is disk drive storage. It is bit slower.
3.4 RAM (Random Access Memory )
RAM is primary volatile memory unit so data will lose in case of power failure. RAM access any memory cell directly that why known as random access. RAM contains Operating System, application software and currently used data. Types of RAM known are as follows:
SRAM (Static Random Access Memory) - 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 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 so need periodic refresh. So it is lower than SRAM. DRAM is used as main memory in the computer system. As technology enhanced DRAM get also get enhanced from SDRAM then DDRAM to RDRAM..
3.6 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.8 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.8.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.
Operating system enables assembly 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, 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.