Breaking

Tuesday, November 6, 2018

What is Cache Memory? - First2Wishes

Cache memory


What is cache memory?
Cache memory is very high-speed Static Random Access Memory(SRAM). Cache memory is also called the Central Processing Unit(CPU) memory.

Cache memory is also very expensive. The cache memory is made up of the semiconductor.

The cache memory is faster than regular Random Access Memory(RAM). Computer processor accesses the cache memory more quickly than regular RAM because of the cache memory is integrated directly into the CPU.

The work of a cache memory in a computer is to store data and programs that are repeatedly used in the operation of programs for a different task.

The CPU is search data and instruction in the cache memory before search in the main memory. If the data or instruction is available then the processor takes data from there for the fast operation.

The cache memory in a computer is used for fast operation and improve the performance.
The cache memory stores the program instruction and data that are frequently used by the computer, which is CPU need for next time.

The main work of a cache memory is to speed up an operation by saving the important data and instruction that are required for fast operation.


Important of cache memory
Cache memory is extremely important for a computer because it is a very high-speed memory(SRAM) and it provides very fast cache data for the processor to do programs or task at high speed.

Due to this cache memory, the computer processor does not need to access data which is stored in the memory again and again. The cache memory stores the important data instruction which can be directly accessed by the microprocessor. So it's reduced the access time of CPU for the required data instruction. Thus it increases the performance of a computer.

If the cache memory is not present in the computer than the computer operation is much slower by using primary memory.
Because the computer needs to access the primary memory again and again and it will take a little time.

The difference between primary memory and cache memory
Speed: The cache memory is different from the primary memory, the access time of cache memory by the CPU is less than the primary memory.

Location in the motherboard: The cache memory is inside the CPU, there is no need to connect the cache memory by Bus to the CPU. But the primary memory is separately palaces from the CPU in the motherboard of the computer and it needed to connect the primary memory with CPU by Memory Bus.

Storage capacity: The size of storage in the cache memory is much lower than the primary memory.

Size: The size of the cache memory is much smaller than the primary memory in the computer.

Cost: As the cache memory is faster than the primary memory so it is much expensive as compare to the primary memory.


Cache memory


Types of cache memory
There are three types of cache memory in the CPU

1. L1 cache
2. L2 cache
3. L3 cache


L1 cache
L1 cache is the fastest cache memory in the CPU. L1 cache is smaller in size. It from 2KB to 1.5MB.

The L1 cache memory is the main cache memory of CPU. It used first by the CPU if the required data is there. If the computer processor does not find the information looking for then it will go to the L2 cache and if it is not found in the L2 cache then the processor goes to the L3 cache memory.

L2 cache
The L2 cache memory is slower and lower than the L1 cache and lager in size. The range of size of the L2 cache is 256KB to 8MB. It is a secondary cache memory used by the computer after the L1 cache.

L3 cache
L3 cache memory is a lower cache memory of CPU. The L3 cache is larger in size is between 1MB to 32MB. If the processor does not find the information in L1 cache and L2 cache memory then the CPU search in the L3 cache memory.


The size of the cache memory

The size of a cache memory is much smaller than the primary memory. The size of the cache memory is in between 2KB to 32MB.

L1 cache memory size- 2KB to 1.5MB

L2 cache memory size- 256KB to 8MB

L3 cache memory size- 1MB to 32MB

L1 cache<L2 cache<L3 cache



advantages of cache memory

The cache memory is very useful for a computer to do fast operations. The cache memory has the following advantages

1. Fast Memory
It is faster than main memory. The cache memory is directly accessed by the computer processor.

2. Access time
The access time of cache memory is extremely small as compared to the main memory.

The cache memory is located in CPU and the CPU can directly access the cache memory.

3. Stores program.
It stores the required program that can be executed within a short period of time.

4. Temporary data.
It stores data for temporary use. The data saved in the cache memory is only for temporary use, it can't save data permanently.


The disadvantage of cache memory

1. Price
The cache memory is very expensive as compared to main memory.

2. Memory capacity
The cache memory has a limited storage capacity. So all programs can't be saved in the cache memory.


Cache memory mapping
There are three types of cache memory mapping is used.

1. Direct mapped cache.

2. Fully associative cache mapping.
3. Set associative cache mapping.

1. Direct mapped cache
In this type of cache, each block is mapped to exactly one cache memory location.

Direct mapped cache rows in a table with three columns. The data block or cache line that contains the data fetched and stored, a tag with part or all of the address of the data that was fetched. A flag bit that shows the presence in the raw entry of a valid bit of data.


2. Fully associative cache mapping
This cache mapping is similar to direct mapping in structure but the difference is it allows a block to be mapped to any cache location rather than to a prespecified cache memory location as in the case with direct mapping.

3. Set associative cache mapping.
This mapping is a compromise between direct mapping and fully associative mapping in which every block is mapped to a subset of cache locations.


Important of  cache memory to improve the performance of a computer 

The cache memory is used in a computer for fast operation and improve the performance.
The cache memory stores the program instruction and data that are frequently used, which are CPU may be a need for next time.

The computer CPU can access this data and instruction very quickly from cache memory as compared to the main memory. So the cache speeds up a computer processor.


Conclusion
The cache memory is very important for a computer because of it increase the performance. The disadvantage with case memory is it is very expensive and low storage capacity.