LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 10-29-2003, 05:06 AM   #1
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
hard disk cache.


Hi LQ,

Recently I'm seeing 2 different values in computer stores for hard disk cache. (2MB and 8MB)

but I'm wondering, my Linux system uses 300MB of free main memory as disk cache. how does this relate to the 8MB cache on the disk itself? Does this memory cache make the hd-cache useless, or is there something else stored in there?
 
Old 10-29-2003, 06:32 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
they are completely different. the disk cache buffer will store frequently accessed hard disk sectors to make it quicker to access the same data again. where as the memory cache saves pages of memory that have been used frequently. these two sets of data do not really overlap.
 
Old 10-29-2003, 08:02 AM   #3
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Original Poster
Rep: Reputation: 30
Quote:
where as the memory cache saves pages of memory that have been used frequently
this sounds like having a swap partition in the main memory.


I'm referring to this cache; doesn't this cache store disk sectors, like the "internal cache on the hd", or am I wrong here?
Code:
diederik@hal9000 diederik $ free -m
             total       used       free     shared    buffers     cached
Mem:           503        498          4          0         38        347
-/+ buffers/cache:        112        390
Swap:          188          0        188
(and my swap parition isn't used at all)

Last edited by yapp; 10-29-2003 at 08:05 AM.
 
Old 10-29-2003, 08:13 AM   #4
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
the hard disk cache on the drive itself is optimized for the drive, and uses read-ahead and
all kinds of cool stuff. there is almost nothing you can do to configure that.
it isn't to be messed with.
linux uses unused ram as disk cache. as soon as a program needs some
more ram, linux will dump the oldest data in the disk cache to give to the
program. that's what you want it to do.
netbsd will let you configure the percentage of ram to use as disk cache, and
will leave it fixed.
if you open up a whole bunch of programs, and i mean a bunch, you will
see the amount of ram used as cache go down.
 
Old 10-30-2003, 02:42 AM   #5
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Original Poster
Rep: Reputation: 30
whansard,

thanks for your explaination. I think I got it now.

* though the ext2 drivers also perform readaheads, is the disk cache far more optimized for the disk, and at a low level?
* because the cache is an internal feature of the hard disk, it runs independantly without any control from the kernel? (ie. perform readheads while your computer is busy with other things)
* This cache contains data you're about to read, but the Linux cache contains data that has been read?

Last edited by yapp; 10-30-2003 at 02:44 AM.
 
Old 10-30-2003, 10:10 AM   #6
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
i think the best thing about a big cache on the hard drive itself, is that the
controller can blast bigger chunks of data to the drive, and go do something
else. the data moving between the hard drive, and down that cable is much
slower than your ram. much much slower. but data from that hard drive
cache can be moved several times faster than the actual data from the
hard drive. so the drive's cache speeds up the slowest thing, the drive itself,
and the system ram data cache speeds up the slower thing, ( by not having
to go to it as often), the hard drive's cache. you may just as well think of
it as your processor's cache. ram > faster ram(cache) > even faster ram
(smaller faster cache) > processor.
platters > drive cache > system ram drive cache.
 
Old 10-31-2003, 04:50 AM   #7
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Original Poster
Rep: Reputation: 30
all right thanks a lot of your explaination.
 
  


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
Cloning 1 hard disk to smaller hard disk, dd or ghost? fireman949 Linux - Hardware 8 12-23-2012 12:51 AM
Is it possible to disable the disk cache? sunsfcn Linux - Software 3 07-15-2005 09:20 PM
disk cache emer_son Linux - Newbie 1 08-25-2004 07:47 PM
flushing disk and cache spejbl02 Programming 3 07-08-2004 01:18 AM
Hard Disk question - Making a big hard disk MrAnonym Linux - General 2 09-15-2003 06:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 06:04 PM.

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