LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-31-2012, 05:39 AM   #1
sluge
Member
 
Registered: Dec 2006
Location: Russia,52
Posts: 116

Rep: Reputation: 6
Question Difference between cache and buffers


Hello!
vmstat shows statistics about cache and buffers, but where the difference between them?
 
Old 08-31-2012, 07:55 AM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Posts: 3,366
Blog Entries: 33

Rep: Reputation: 216Reputation: 216Reputation: 216
Wink

I think the buffers are in cache (ram) the buffer may have a size (rhetrofit/back(ward) tech/compatibility),

but the cpu may not need the buffer set aside for it(the data in cache) if the cpu/ram/HDD/Inet is fast enough.

Streaming instead of buffering, but buffering anyway in case (may cause double handling, busy cpu, no room for sheduled tasks (?)).

Internet speeds are quite fast (not fast like South Korea,)

and in most instances the bandwidth is sufficeint to deliver the goods on time.

You need a bandwith tester for your graphics and other gaming devices, like sound.

No good if the picture is perfect but there is a delay with key-presses, and/or sound delays.

Can't remember why I started this post, Happy Friday to you all.

Cheers Glenn

Last edited by GlennsPref; 08-31-2012 at 07:57 AM. Reason: spelling
 
Old 08-31-2012, 08:42 AM   #3
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
probably: http://en.wikipedia.org/wiki/Cache_%28computing%29
http://en.wikipedia.org/wiki/Data_buffer
 
Old 08-31-2012, 09:10 AM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by sluge View Post
vmstat shows statistics about cache and buffers, but where the difference between them?
I'm not sure. I wouldn't answer at all if you hadn't already gotten two really terrible answers.

I think the difference arises because of the fact that the OS works in 4KB chunks, but files are not necessarily aligned on 4KB boundaries on the media.

I think cache holds chunks of file that are 4KB aligned within the file, while buffers hold chunks of the filesystem that are 4KB aligned in the filesystem, but not in a specific file.

1) I might be totally wrong. I never looked at the relevant code. I'm repeating/simplifying plausible info that I read elsewhere.

2) The 4KB number is an x86 standard, not a Linux standard. It may be some other value for Linux on some other architecture.
 
Old 08-31-2012, 01:17 PM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
Quote:
Originally Posted by johnsfine View Post
I'm not sure. I wouldn't answer at all if you hadn't already gotten two really terrible answers.
I do not think wiki is terrible. In general cache is used to duplicate data in memory to have much quicker access (for frequent usage). It is explained on that wiki page with a lot of examples. Also at the end of the page there is a small explanation about the difference between buffers and caches.
 
Old 08-31-2012, 03:04 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
Quote:
Originally Posted by sluge View Post
vmstat shows statistics about cache and buffers
Quote:
Originally Posted by pan64 View Post
I do not think wiki is terrible.
I didn't really intend to start a fight. I just thought I should explain why I was posting rather than waiting for someone who really knows the answer.

I didn't say wiki was terrible. I'm not very impressed with those two articles, but that is irrelevant. If those two articles were great descriptions of the generic computer terms "buffer" and "cache", that still wouldn't change the fact that linking to generic info (containing no Linux specifics) is a terrible answer for a question that is very specific to Linux.

If you thought the difference between "buffer" and "cache" in some generic context was relevant to the difference between "buffer" and "cache" in Linux, you were mistaken.

Last edited by johnsfine; 08-31-2012 at 03:29 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear buffers/cache ? cola Linux - General 4 10-08-2011 11:29 AM
crontab to email when buffers/cache memory reached a defined value sokha Linux - General 2 06-20-2010 11:44 PM
-/+ buffers/cache details mansoorulhaq Linux - General 1 03-26-2007 10:40 AM
Linux cache/buffers never increase DukeLeto Linux - General 1 01-02-2007 12:02 AM
Weird cache / buffers problem - they're tiny! mrtee Linux - Enterprise 0 12-15-2005 05:24 PM


All times are GMT -5. The time now is 06:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration