Tuesday, September 30, 2008

Caching in Operating Systems

Hello friends in the last post i told you about the memory management in operating systems,now in this post i am going to tell you about the caching i operating system.

Caching is an important principle of computer systems.As all we know all information is kept in some storage such as main memory,as it is used,it is copied into a faster storage system-the cache-on a temporary basis.When we need a particular piece of information,we first check whether it is in cache or not,if it is in the cache we use it directly from the cache,otherwise we use the information from the source from where it is present and made a copy of that information in the cache assuming that we will need it again soon.By doing so we decreases the searching time of that particular information.

As all we know that the purpose of cache is to speed up memory accesses by storing recently used chunks of memory.Now why the need of caching or cache memory is required because as all we know that access from main memory into a register may take 20-50 clock cycles,but in the case of cache memory it reduces to single clock cycle.That's why cache memory or caching is needed.But the cache memory that we used is very expensive in cost that's why we can't compose our main memory entirely of it.

For more details , please visit here and here.
Thats why we have only very limited amount of cache,and we can store only limited amount of data in it,now the main question that arises here is that to store which data from the great chunk of data.For this we only save that data that is most recently used.Sometimes this policy is also known as the spatial and temporal locality.When we want to access memory at a certain address, we look in the cache to see if it is there. If it is there, we get it from cache instead of going all the way to memory, that situation is called a "cache hit." If the data is not in cache, then we bring the data from memory to cache, which takes longer since the data must be brought in from the smaller memory, that situation is called a "cache miss," and that delay that we endure because that memory must be brought from main memory is called a "miss penalty".

For more details , please visit here and here.

Hope you enjoy it.Please give your comments for more improvement.