LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 04:39 AM   #1
sluge
Member
 
Registered: Dec 2006
Location: Russia,52
Posts: 128

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, 06:55 AM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,657
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
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 06:57 AM. Reason: spelling
 
Old 08-31-2012, 07:42 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

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

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
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, 12:17 PM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
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, 02:04 PM   #6
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
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 02:29 PM.
 
  


Reply



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 10:29 AM
crontab to email when buffers/cache memory reached a defined value sokha Linux - General 2 06-20-2010 10:44 PM
-/+ buffers/cache details mansoorulhaq Linux - General 1 03-26-2007 09:40 AM
Linux cache/buffers never increase DukeLeto Linux - General 1 01-01-2007 11:02 PM
Weird cache / buffers problem - they're tiny! mrtee Linux - Enterprise 0 12-15-2005 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:38 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
Open Source Consulting | Domain Registration