Friday 15 January 2021

Computer Memory: Memory Hierarchy, Internal and External Memory

 

Types of Computer Memory:

 

Memory Hierarchy:

 

The memory is characterized on the basis of two key factors—capacity and access time.

 

Capacity is the amount of information (in bits) that a memory can store.

 

Access time is the time interval between the read/ write request and the availability of data.

 

The lesser the access time, the faster is the speed of memory. Ideally, we want the memory with fastest speed and largest capacity. However, the cost of fast memory is very high. The computer uses a hierarchy of memory that is organized in a manner to enable the fastest speed and largest capacity of memory.

 

The hierarchy of the different memory types is shown in the following fig.

Memory hierarchy


The internal memory and external memory are the two broad categories of memory used in the computer. The internal memory consists of the CPU registers, cache memory and primary memory. The internal memory is used by the CPU to perform the computing tasks. The external memory is also called the secondary memory. The secondary memory is used to store the large amount of data and the software. In general, referring to the computer memory usually means the internal memory.

Internal Memory:

 

The key features of internal memory are as follows:

·         limited storage capacity

·         temporary storage

·         fast access, and

·         high cost.

 

Registers, cache memory, and primary memory constitute the internal memory. The primary memory is further of two kinds: RAM (Random Access Memory) and ROM (Read Only Memory).

 

Registers are the fastest and the most expensive among all the memory types. The registers are located inside the CPU, and are directly accessible by the CPU. The speed of registers is between 1– 2 ns (nanosecond). The sum of the size of registers is about 200B.

 

Cache memory is next in the hierarchy and is placed between the CPU and the main memory. The speed of cache is between 2 – 10 ns. The cache size varies between 32 KB to 4MB. Any program or data that has to be executed must be brought into RAM from the secondary memory. Primary memory is relatively slower than the cache memory. The speed of RAM is around 60 ns. The RAM size varies from 512KB to 3GB (higher capacities are available nowadays).

 

 

Secondary Memory:

 

The key features of secondary memory storage devices are as follows:

·         very high storage capacity

·         permanent storage (non-volatile), unless erased by user,

·         relatively slower access,

·         stores data and instructions that are not currently being used by CPU but may be required later for processing, and

·         cheapest among all memory.

 

The storage devices consist of two parts: drive and device. For example, magnetic tape drive and magnetic tape, magnetic disk drive and disk, and, optical disk drive and disk. The speed of magnetic disk is around 60ms (milliseconds). The capacity of a hard disk ranges from 160 GB to 1,600 GB (1.6 Tera Bytes). Figure below shows the interaction between CPU and memory.

CPU and Memory


To get the fastest speed of memory with largest capacity and least cost, the fast memory is located close to the processor. The secondary memory, which is not as fast, is used to store information permanently, and is placed farthest from the processor.

 

With respect to CPU, the memory is organized as follows:

1.    Registers are placed inside the CPU (small capacity, high cost, very high speed).

2.    Cache memory is placed next in the hierarchy (inside and outside the CPU).

3.    Primary memory is placed next in the hierarchy.

4.    Secondary memory is the farthest from CPU (large capacity, low cost, low speed).

 

The speed of memories is dependent on the kind of technology used for the memory. The registers, cache memory and primary memory are semiconductor memories. They do not have any moving parts and are fast memories. The secondary memory is magnetic or optical memory has moving parts and has slow speed.

 

 

CPU Registers:

 

Registers are very high-speed storage areas located inside the CPU. After CPU gets the data and instructions from the cache or RAM, the data and instructions are moved to the registers for processing. Registers are manipulated directly by the control unit of CPU during instruction execution. That is why registers are often referred to as the CPU’s working memory.

 

Since CPU uses registers for the processing of data, the number of registers in a CPU and the size of each register affect the power and speed of a CPU. The more the number of registers (ten to hundreds) and bigger the size of each register (8 bits to 64 bits), the better it is.


No comments:

Post a Comment