what is the difference between cache and buffer which are in system monitor applet?

Asked by dinar qurbanov

hello. what is the difference between cache and buffer which are in system monitor applet of gnome in memory diagram?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Uwe Geuder
Solved:
Last query:
Last reply:
Revision history for this message
Sam_ (and-sam) said :
#1
Revision history for this message
Best Uwe Geuder (ubuntulp-ugeuder) said :
#2

Cache and buffers are in main memory. The CPU can only access main memory. Main memory is faster than mass memory (disk drives, optical drives, solid state mass memories, etc.)

Cache contains data that is also available on the disk. It is just cached to be able to access it faster. If more memory is needed the system can reduce the amount of cache and use the same memory for something else. The only harm done is that the next reader of the previously cached data needs to wait longer until it is read from disk again.

When your machine has been running a long time and used for many things but currently not many applications are running, nearly all memory will be used as cache. This is a good thing and it does not mean that your system is low on memory. it will just be fast to access everything already in cache.

A buffer is used for writing to or reading from a device (e.g. a disk drive, but also audio devices etc)

Here the terminology gets somehat overlapping and confusing. When data is read from a disk it is read into a buffer. If you leave it there for a longer time it is cached. If it's modified by an application you say the cache page is dirty. It needs to written back to disk, and this writing needs a buffer.

I don't know where Linux / Gnome system monitor exactly draws the borderline. Can cache contain dirty pages? Or will it be counted as buffer then?

Revision history for this message
dinar qurbanov (qdinar) said :
#3

Thanks Uwe Geuder, that solved my question.