Cache Memory and Types of Cache Memory

Cache memory and types of cache memory

Cache Memory Tutorial - Some important Concepts

In this cache memory tutorial we will cover the following contents in context of cache memory.

(1) What is cache memory ?
(2) Types or Levels of Cache Memory .
(3) Performance of  Cache Memory.
(4) How to improve cache performance?
(5) Locality of references in cache memory.
(5) Conclusion 

What is Cache Memory?

In order to execute an instruction cpu need to fetch that instruction from main memory. But data accessing cost from main memory is high and its takes more time. So we need a device or memory from which cpu can access the instruction in less time as compare to main memory.

Register may be this device which is the fastest memory but the problem with register is that it can not hold the whole program, it can hold only few instructions and it is more costly.

So there is a another memory known as cache memory which is faster from main memory but store less amount of data as compare to main memory and more data as compare to register.

Cache memory is a smaller and faster memory. This is the importance of cache memory.Cache generally holds those part of the program which is most frequently needed by the cpu. Actually when the data and instructions are  accessed first time then it is retrieved from the main memory and its copy is stored in the cache so next time when that data or instruction is  required then cpu looks in cache for that data. If the required data is found then it is retrieved from cache instead of main memory.

Now a days most of the CPUs have different independent caches which, some of them also include instruction and data. SO it is used to reduce the average access time ot  to increase the speed of the cpu. Cache memory is placed between main memory and the cpu.

types of cache memory

Types of cache memory or Levels of Cache Memory

In this section of cache memory tutorial we will explain different types of cache memory. Generally there are 3 different levels or types of cache in computer. Here level number refers to the distance of cache from the cpu. Each of them is discussed below.

L1 Cache – Level 1 cache memory is also known as primary cache or internal cache. It is built directly into the processor. Its capacity is very small from 8 kb to 128 Kb. Level 1 Cache is closest to CPU.

L2 Cache -  level 2 cache is slower as compare to level 1 cache. But its storage capacity is more upto 16 MB. Now a days most of the processor have advance transfer cache which is a level 2 cache memory.

L3 cache -  This type of cache is separate from the processor . It is slower as compare to cache of level  L1 and L2 .

 Cache memory and its organization is as shown in following  figure.

cache memory organization

Cache Performance

Now we come to the cache performance. So as I explained in previous section that  When the processor needs to read or write a location in main memory, it first checks for a corresponding entry in the cache. At this situation there may be two cases.

Case 1 : If the processor finds that the memory location is in the cache, then this is known as  cache hit or sometime we say that cache hit has occurred and cpu retrieved the data  from chache.

     Case 2: If the processor does not find the memory location in the cache, then this is known as  cache miss or some time we say that cache miss has occurred. Now in this case for a cache miss, at first the cache allocates a new entry and copies in data from main memory, then the request is fulfilled from the contents of the cache.

In order to calculate the performance of the cpu  you need to understand these two term cache hit and cache miss. We have already discussed it in previous paragraph of this section.

Generally performance of cache memory is frequently measured in terms of a quantity called Hit ratio.

Hit ratio = hit / (hit + miss) =  no. of hits/total accesses

How to improve Cache performance ?

If somehow we are able to reduce the miss rate then cache performance can be improved. So how can we reduce the cache miss rate ?
(1)   If we use the larger cache block size, then sometime it helps in reducing the cache miss rate. Larger block size helps with spatial locality. But some time this methods is not suitable because large size of cache block  reduce total number of blocks in cache.  Which increase the miss penalty.
(2)   Another solution is Increase the Associativity.  Higher associativity can improve  the reduce the miss rate.

Locality of reference in Cache Memory

Locality of reference in cache memory some time also called the principle of locality of reference. This  is the term which applied  in a situations where the same value or related storage locations are frequently accessed.

Locality of reference may be of three types temporal, spatial and sequential. Let us see one by one to each.

Temporal locality: In temporal locality a resource that is referenced at one point in time is referenced again soon afterwards.

Spatial locality: In spatial locality the likelihood of referencing a storage location is greater if a storage location near it has been recently referenced.

Sequential locality: In sequential locality storage is accessed sequentially, in descending or ascending order.

The occurrence of locality depends on the manner in which computer programs are created. Generally related  data are stored in consecutive locations in storage. 

One common way of computing is that processing is performed on a single item and then the next item. Interpret that if more processing is done, the single item will be accessed more than once, which leads to temporal locality of reference.

 When moves to the next item this implies that the next item will be read, hence it is spatial locality of reference because memory locations are generally read in batches.


Cache memory is mostly used now a days in most of the computer architecture system. Cache memory is really very useful. In this cache memory tutorial we covered the introduction of cover memory, cache memory types,



addressing modes types,1,advance-java,2,advancejava,1,aktu entrance exam,1,aktu exam schedule,1,ASP,1,bare machine,1,base register and limit register,1,Basic Computer network questions,1,C Programming,15,C Plus Plus,1,C Programming,2,C Programming MCQ,2,C Programming Questions,2,C programming study material for gate exam,13,Cache Memory,1,CBNST Program,1,Childcare,1,CJ,2,Cloud Computing,1,components of use case diagram,1,Computer Architecture,1,Computer architecture based questions for gate exam,10,Computer Network,3,Computer Network Study Material,4,Computer network study material for gate,2,Computer Networks,7,Computer Science Study Material for Gate,20,computer science study material for gate exam,36,content based image retrieval content based image retrieval system,1,contiguous memory allocation,2,Core Java,8,COre Java Interview Questions,1,core java interviews questions,1,cyber crime report,1,Cyber crime status,1,cybercrime and security,1,cybercrime examples,1,Data link Layer Questions,1,Data Mining,1,Data Structure Questions,1,Data Transmission Architecture,1,Data Transmission in wsn,1,DBMS,4,dbms question paper,1,DE,1,Digital Electronics,1,DS,1,dynamic linking,1,dynamic linking in memory management,1,Electroencephalogram,1,File Handling,1,file management in operating system notes,1,FOC,1,Fundamenatl of Computer,1,Gate 2017,5,Gate 2017 Admit card,1,Gate 2017 Exam Schedule,1,Gate 2017 Syllabus,1,gate 2018,1,gate cse study material,1,gate practice set,10,gate study material for computer science,18,Gate study material for computer science 2017,1,GatePreviousYear,1,General,3,HCL Aptitude Test,1,HR Interview Questions,1,HTML,1,Image Processing,1,Important Date of Gate 2017 Exam,1,Information Security Policy,1,internal and external fragmentation,1,JS,1,lagrange's interpolation formula,1,lagrange's interpolation formula examples,1,Looping in C,1,MComputing,1,memory fragmentation,1,memory management,1,memory management questions and answer in os,1,Motivational,4,NCER,2,Numerical Techniques Lab,1,OOT,1,Operating System,11,Operating System Gate Questions,1,Operating System Objective Questions,4,Operating System Questions Bank,1,Operating system questions for gate,1,Operating System Study material,2,operating system study material for gate exam,16,Operating system tutorial,2,page swapping,1,paged memory allocation,1,paged memory allocation in operating system,1,paging technique of memory management .paging technique,1,paging technique of memory management program in c,1,Pointer in C,5,Process based question for gate,1,Quiz on non conventional energy resources,1,Regression testing,1,relocation in memory management,1,relocation registe,1,relocation register,1,resident monitor,1,resident monitor in operating system,1,routing table,1,segmentation in memory management,1,segmentation in memory management in operating system,1,Servlet,1,session tracking,1,session tracking in java,1,session tracking in servlet,1,Software Engineering,10,Software Engineering baes study material for gate,1,software engineering interview questions,1,Software Quality Assurance,3,software verification methods,1,SPM,1,Structure in C,1,Study Material for gate Computer Science,11,swapping in memory management,1,swapping in operating system,1,TCS Code Vita,1,Technical Questions from DBMS,1,Thrashing in Operating System,1,Threads concept in operating system,1,Tips to Learn Coding,1,Top 30 Core Java Interview Questions with Answer,2,top down approach,1,top down approach in programming,1,Types of operating system,1,UML,1,use case diagram explanation,1,website uses cookies,1,what is cookies website,1,What is process control block ?,1,what is software testing?,1,Wireless Sensor Network,3,worst fit algorithm for memory allocation,1,XML,1,
Computer Science Junction: Cache Memory and Types of Cache Memory
Cache Memory and Types of Cache Memory
Cache memory and types of cache memory
Computer Science Junction
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share. STEP 2: Click the link you shared to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy