Computer Science Tutorial

Classification of Computer Memory

Classification-of-memory

So, basically there are four different types of memory in computer. They work concurrently to help CPU in faster and efficient execution of user program. If one of them halts for any reason then overall performance of computer drops drastically. Among all these memory only Register is a kind of which lies inside the processor chip. Rest all lies outside the cpu chip.

Basic Difference between RAM and ROM

RAM
ROM
RAM
  • This is volatile in nature. volatile means it looses its contents after power off.
ROM
  • This is non volatile in nature, which means it retains its contents even after power off.
RAM
  • It contains user programs and instructions which is right now in execution.
ROM
  • It contain bootloader program, which is executed once during computer booting only.
RAM
  • It is read/write memory.
ROM
  • It is read only memory.
RAM
  • Instruction in RAM is executed after operating sysem loads. ROM loads the Operating System into RAM
ROM
  • Programs in ROM is executed before operating system loads. Basically it helps loading Operating System into >RAM.
RAM
  • It is primary Memory.
ROM
  • It is secondary Memory.
RAM
  • It's speed affects computer overall performance.
ROM
  • It's speed doesn't affect overall computer performance.
RAM
  • It stands for Random only Memory.
ROM
  • It stands for Read only Memory.
RAM
  • CPU can directly access AM's data
ROM
  • CPU can not directly acccess ROM's data
RAM
  • It is large memory compatred to ROM, capacity is also high
ROM
  • It is small memory, capacity is also low
RAM
  • RAM is costly.
ROM
  • ROM is cheap.

Memory Hierarchy

Classification-of-memory

What computer uses hierarchical structure of memory? We could have only kind of memory either Primary memory or secondary memory only. Why there is different combination of memory in a computer.

Answer lies in concept that only one kind of memory can not fulfill all our criteria needed to build a computer. Like RAM is high speed of memory but we can not build a computer with RAM only since its temporary memory. We need some kind of permanent storage also like Hard Disk Floppy Disk etc. Again only having Hard Disk can not solve our problem, since it is slowest kind of memory. And processor can not access it directly, even if we made it to be accessed diretly by processor, it will not be efficient since it is a slowest kind of memory.

The speed and cost per byte of different kind of memory increases upwards and size or capacity of memory increases downwards. So in a computer Register memory is the most advanced circuitry and its price is also highest. But as we go down the price per byte and speed also decreases. So, Secondary Memory is slowest kind of memory in a computer and it's size is also large which is in Tera bytes generally.

Cache memory

It is a high speed memory which equalizes/compensates the speed difference between CPU and RAM. It lies between CPU and RAM, all the requests by processor during execution goes through actually cache memory. If cache memory has the requested data, it immediately responds with the data, if not, RAM is accessed. So in this way CPU need not to access RAM every time for frequently used data. This reduces effective memory access time of cpu making instruction excution faster.
Cache Organisation
How do cache memory works?
The principal concept behind this is a computer program tend to be localized in a certian portion of memory. This property of typical program is called Locality of reference. So if we are able to bring that small localized portion of memory into a high speed memory like cache memory, average access time of CPU will reduce, so excution time will reduce as a result CPU's efficiency will increase. enhances.
In some system we can also find two level of caching L1 cache and L2 cache, it further enhances CPU efficiency.

Explaination of above image:

1. First Cache is accessed, if data found data immediately returned to CPU.

2. If data not found in CPU, RAM is accessed and it return with requested data. CPU then keeps a copy of this data in cache and starts execution.

3. Whenever CPU writes/updates anything in cache it concurrently udpdates RAM. This way it confirms that RAM always automatically updated and it doesn't keep outdated data.
BN Computer Academy
All Rights Reserved