top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Few questions about Cache memory

+1 vote
454 views

I have few questions about Cache Memory

In my system "free -h" command gave me below output,

      total        used        free      shared  buff/cache   available
Mem:   7.6G        2.1G        1.5G         46M        4.0G        4.8G
Swap:  1.6G         28M        1.6G

1. Why "Cache Memory" is required inside the main memory?

As far as i know "Cache Memory" is different than the main memory(RAM), It is very costly and it is very faster, Please Correct me if i am wrong.

2. Before 1 hour this cache memory was 3 GB and then it is increased by 1 GB?

Please note that I din't start/run any new processes

3. Till what limit i can start new processes/application?

I mean as per free -h command output,

free memory = 1.5 GB, Cache memory = 4 GB and Swap memory = 1.6 GB

can i start new application up to (1.5 + 1.6) GB or (1.5 + 1.6 + 4) GB`?

4. Can i set/configure this cache memory value?

If yes, then how to?

posted Feb 25, 2016 by Chirag Gangdev

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Thought to answer this, but Manikandan J has nicely explained this :)

1 Answer

+1 vote
 
Best answer

1. Why "Cache Memory" is required inside the main memory?

I think when referring to "Cache Memory" you're thinking of memory used for disk caching, which is RAM used to store information from a hard disk to speed up future processes. It will be freed when future processes have to use information that is not already present in memory and then be used by those new processes.

2. Before 1 hour this cache memory was 3 GB and then it is increased by 1 GB?

This is nothing bad and/or unusual, as unused memory is wasted memory. The system probably preloads code it deems usable in the future.

3. Till what limit i can start new processes/application?

Basically until the available memory after buffers/cached is zero. When this happens, your system will start using swap memory on disk (note this is not RAM but space on your hard disk). This is undesirable as disk speeds are considerably lower than RAM speeds and will result in your system becoming really slow.

4. Can i set/configure this cache memory value?

It's Linux/Unix, so of course it is configurable :)

answer Feb 26, 2016 by Manikandan J
Similar Questions
+3 votes

also please explain Virtual Memory Can Slow Down Performance why and how?

0 votes

In Ch. 9- Vitual memory management- Topic no- 9.4.5.3 (Enhanced Second-Chance Algorithm)- Last paragraph, it is written that

"The major difference between this algorithm (Enhanced Second-Chance Algorithm) and the simpler clock algorithm is that here we give preference to those pages that have been modified in order to reduce the number of I/O required."

Here simpler clock algorithm is Second-Chance Algorithm.
Does this mean that only in Enhanced Second-Chance Algorithm, while replacing a page from frame, modified (dirty) page is removed first whereas in other algorithm non-modified (non-dirty) page is removed first?

...