What is difference between Virtual memory and Cache memory
What is difference between Virtual memory and Cache memory :- What is difference between Virtual memory and Cache memory In the world of computers, memory sets the limit upon which we base if we can run that program or not. If we are unlucky enough to have experienced DOS, then you know the bane (causes trouble) of the 640k memory limit. Nowadays memory seems to be almost infinite and nobody actually gets the ‘not enough memory’ messages of ester-year.
It is a very smart memory management procedure. By placing some parts that should be in memory inside your hard-disk they can extend the memory capacity of a computer way beyond what is installed; this is called virtual memory. So let’s say that your computer only has 1GB of memory and you launch a few programs whose total memory consumption is at around 1.5GB. Without virtual memory, you are not allowed to do that. But with virtual memory, the operating system assigns a portion of the hard-disk as a part of memory and keeps the data there.
So in the above example let’s say that the virtual memory is also 1GB. 1GB actual memory + 1GB virtual memory = 2GB system memory. That way even though your memory is limited you can still use memory extensive applications. There is a disadvantage to virtual memory though. Reading data from a hard disk is substantially slower than reading from memory. So the more information that is stored in your hard-disk the slower your system becomes making it seem sluggish (working more slowly than normal and in a way that seems lazy).
Cache memory on the other hand doesn’t extend the amount of memory you have, it merely lessens (smaller) the amount of time needed to access data. So that you can understand the concept easily, let’s say that the processor is a student doing a report. Whenever he needs data he goes to the bookshelf (the bookshelf being the memory, and the books are the data) and takes out a book and brings it back to his chair. He reads it then he returns it to the bookshelf before continuing with his report. If you were the student it would really be time consuming if you have to stand up and get a book every time you need a piece of data. Practically a student would get a few books from the bookshelf and place it on the table.
So that if he needs information that is in the book that he recently used, it is just within arms reach and he doesn’t have to stand and walk to get it. In this metaphor (a way that is different from its normal use) the table is our cache memory. Whenever the processor uses data it puts the most recent data it used in cache memory for quick access in case it is needed again. Cache memory is very limited though, just like a table having limited space, so data that was not accessed the longest gets returned to memory in order to free up the cache for more recent data.
I hope that you understand my post. if you like this post then share my post, and comment on my post if you have any suggestion or Queries related to Virtual Memory or Cache Memory. Thank you!