What exactly does "Buffer" do for a HD?

edited December 2004 in Hardware
I've got a 60GB w/2MB buffer HD. I've been curious, exactly what does buffer do for you? I know that having a bigger one is better (heh, universal woman talk there) but what does it EXACTLY do? And is there any notable improvements with a larger buffer?

Comments

  • edited December 2004
    As far as I understand it the files you need for an operation but aren't currently using get loaded into the buffer to give the system faster response and while the system is chewing on the data it recovers from the buffer more is loaded in.

    This means that for operations involving small files you'll see a bigger improvement since the buffer holds more and will flood the IDE interface (100MBs) but for bigger files that are beyond the buffers size you'll see a marginal improvement at best because the system will then be grabing the data from the platters themselves so the drives subsystems and architecture (platter density, rotational speed and controller circuitry) will become more important.
  • RWBRWB Icrontian
    edited December 2004
    I heard some claim that adding more buffer to current HDD's is all but useless, but I am curious based on your response madmat if a 1GB buffer would just be insanely faster, it could then hold pretty much anything in it's memory. And being that they do have this ability minus a good price tag, I would love to have a HDD with a 1GB buffer. I'd pay a grand for one that only has 60GB of storage. Maybe less depending on certain variables. It would be the next best thing to having solid state drives.

    Does current buffers use SRAM or what?
  • EMTEMT Seattle, WA Icrontian
    edited December 2004
    I would guess that the operating system's got its own buffer in RAM so there isn't much need for one down the line at the HDD - what could the onboard cache do that the rest of the system can't do for it? Of course it might work better having it at the hard drive (we could call this "winmodem syndrome") but in terms of sheer space, your RAM could be more helpful than the cache - I'd think.

    One other use of buffer I believe is to reduce seeking. If lots of programs are writing small amounts of data to different places on the drive, the buffer could store these and the drive could write them in the most efficient order rather than running all over the place. I'm not positive on this but it's my understanding.
  • Straight_ManStraight_Man Geeky, in my own way Naples, FL Icrontian
    edited December 2004
    The HDD Buffer talked about in hardware sense, is for storing things temporarily that have not been sent to rest of computer or that are waiting to be written to HDD. Technically, this buffer isa READ\WRITE buffer and it can be used as a read-ahead buffer for reading big files sometimes, also. The HD-embedded controller chips decide how to use the HD's own buffer.

    For a program or a printer queue, a buffer is space used to hold things temprorarily while waiting to send them elsewhere. In the case of a printer queue, if you have enough main RAM in the computer then the printer queue's buffer is in RAM, else it can be mostly elsewhere in virtual memory space in a file on the computer's HD.

    Windows has many kinds of buffers it can use, some small and some larger, and one on the HD is called the swap file (which is a physical file area with a file name, and it does reside in a directory though most folks never see it). BUT, Windows itself does not use the HD's own buffer directly.

    Think of buffer as memory space used to make function work better. This function can be an application function, an OS function, or a hardware function. Audio cards have small buffers also, as do video cards, adn drivers use buffers also, but those are in the dedicated to software sense. A cache is a name for a buffer dedicated to a device, and HD cache is another name for HD buffer in the hardware sense.

    Just wanted to toss a framework out here so you folks might better understand the ways 'buffers' and 'caches' can be used as words.

    I'll give you one more idea set:

    L1 cache in CPU is cache or buffer work area used by the CPU to store things that will be worked on real soon or have just been worked on and are waiting to be sent elsewhere. BIGGER soemthings might get partly stored in L2 or L3 cache, the lower the number of cache after the L the closer it is to the CPU and the shorter the time the CPU expects to have it in that cache. another way to say this is that L1 cache is more data-volatile than L2 and boht are more data-volatile than L3 normally is. Some real modern only have L1 and L3 cache in significant amounts. BUT, caches are the CPUs work buffers, right on a modern CPU chip die.

    Think of it like this if you are newer to computers:

    HDs store data. Stores store stuff until you "buy" or "order" it. Big stores, like Walmart, can store lots of things for a long time, little stores ahve to sell fast to be able to get more things by ordering them. Cache is like having it in your pocket, say a stick of gum, but the whole box of gum packages stays at the store until you buy one pack. You stash, or cache, the gum pack or stick of gum in your pocket so its handy when you want it (but keep in the pocket too long, it will get stale or have other things happen like going through the washing machine-- same thing with a buffer or cache, you do not want data just sitting there for a long time).

    HDs use thier buffer as a temporary pocket of memory space to make data flow more even and smooth. HD platters and media coatings on them is your data store, but to work real smooth it needs its own dedicated work buffer, or cache space. Probably, this is not SRAM memory in your HD buffer, it is CMOS more likely and more commonly. The kind of RAM used for a HD buffer (aka HD cache) needs to wipe itself when the HD is turned off, and true Static RAM will hold content too long for that. some old HDs did have buffers that were more like SRAM than modern CMOS, but stick them in a new real fast booting machine, and you have to tell that computer to wait before talking to the HD in part becasue the HDs have to actively wipe thier buffers. Newer HDs essentially drain their buffers or caches on shutdown, more like CMOS than older kinds of SRAM. The CMOS that BIOS's use to store computer setup settings is special case, it is kept "alive" by clock battery juice.
  • BLuKnightBLuKnight Lehi, UT Icrontian
    edited December 2004
    Very nicely said Straight_Man. It reminds me of my CS 324 class. Thinking about it, I think that was the highlight of the entire course.
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited December 2004
    On a historical note, some OS used to have troubles with filesystem corruption in IDE hard drives with large buffers. When the OS wrote its last byte of data to the drive, the drive would report a sucessful write and the machine would power off immediately. The problem was that the drives reported a successful write as soon as the last byte of data was loaded into the buffer so the machine went down with data still waiting to be written in the buffer. Naturally, anything in the buffer when the power goes down is lost (it's still a problem today if you lose power while in the middle of a write, it's why some high-end RAID solutions have battery-backed buffers on the card). As I recall, the workaround was to introduce a fixed delay in the OS so that it would wait a few seconds after receiving the signal to allow the drive to finish writing before powering down.

    This should probably answer RWB's question about why we don't have gargantuan buffers: would take too long to shut down.

    -drasnor :fold:
  • EMTEMT Seattle, WA Icrontian
    edited December 2004
    drasnor wrote:
    This should probably answer RWB's question about why we don't have gargantuan buffers: would take too long to shut down.

    -drasnor :fold:
    That doesn't seem prohibitive. They could have the HD send a different signal during shutdown to say it was actually finished, if they really wanted huge caches.
  • TexTex Dallas/Ft. Worth
    edited December 2004
    You asked about a larger cache? For example my high end scsi raid controller has half a gb of DDR onboard the controller itself to cache reads and/or writes depending on the application and how I set the caching parameters for each array and thats on top of the 8mb cache on each scsi drive.

    How much the onboard cache on teh drive helps depends and varies greatly on a number of factors such as

    1)the firmware on the drive itself (each make and model is a little differant on how it uses the cache for read ahead or writing of data)

    2)How sequential the data acess patterns are. Its buffering ahead your readsa in sequential sectors so if the data is small or random in nature your seeing little benefit and

    3) If the drive fragmented so that the next read isnt going to hit the cache anyway its not helping.

    So "how much the onboard cache helps" is really gonna vary a lot from application and disk to another. Anymore the differance in cost between a 2mb and 8mb cache isnt much and its worth the price.

    Tex
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited December 2004
    EMT wrote:
    That doesn't seem prohibitive. They could have the HD send a different signal during shutdown to say it was actually finished, if they really wanted huge caches.
    Shrug. That was the case under the original IDE spec. I honestly don't know if it's been revised or not since ATA100/133 and SATA have been introduced.

    -drasnor :fold:
  • TexTex Dallas/Ft. Worth
    edited December 2004
    But the problem isnt just when you shutdown. Its when it freezes, crashes, you lose power etc...

    If you corrupted a filesystem or had corrupted data on every one of those instances many in these forums would reload several times a day.

    Tex
Sign In or Register to comment.