Shop OBEX P1 Docs P2 Docs Learn Events
HDD cache as fast external memory? — Parallax Forums

HDD cache as fast external memory?

RaymanRayman Posts: 14,849
edited 2009-09-02 12:42 in Propeller 1
I've noticed that most HDDs have ~8 MB or so of buffer RAM...

Could this be used as high speed external RAM?· I think perhaps if you only access a few sectors, you could read and write very fast, although perhaps the first read to a sector would be slow...

I'm mainly interested because I'm hope to playing around with some low cost 1.8" drives soon:
http://forums.parallax.com/showthread.php?p=834619

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

Comments

  • KyeKye Posts: 2,200
    edited 2009-09-01 22:49
    But how many pins do you need to acess it...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • RaymanRayman Posts: 14,849
    edited 2009-09-02 00:34
    It does need a few pins, but that's what makes it fast!

    I'm not sure exactly what type of cache HDDs use though... If it's write-back, then this scheme could work. If it's write through, then, it won't work so well, except for reading...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • David BDavid B Posts: 592
    edited 2009-09-02 04:22
    I don't know, but I'd guess that the cache is write-through, because there are so many applications where once a data write returns, the application needs to depend that on a crash or even loss of power, the data will be stored securely to the physical disk.

    What I don't know is what would happen if you then asked for the same data to be read back. I don't see why the HD couldn't return the data directly from the cache instead of waiting for the platter, if it's smart enough to manage its cache with a least-recently-used page replacement strategy or something like that.

    So it might work, if that sort of memory fits some particular project's needs.
  • BradCBradC Posts: 2,601
    edited 2009-09-02 04:53
    David B said...
    I don't know, but I'd guess that the cache is write-through, because there are so many applications where once a data write returns, the application needs to depend that on a crash or even loss of power, the data will be stored securely to the physical disk.

    By default most drives use write-back cache to try and make up for their abysmal rotational/seek latency. The ATA spec defines a flush command which is specifically to force the contents of the cache onto the platters. This is why you need journal based filesystems and barriers to increase the reliability of standard operating systems (and RAID boards use battery backed up ram for the cache).

    If the application depends on write ordering or ensuring the write has flushed it needs to explicitly use an operating system call that will block until the data is confirmed as written (fsync() for example).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • RaymanRayman Posts: 14,849
    edited 2009-09-02 12:42
    There's probably a hidden gotcha here somewhere, but it seems that it might work in theory... If I ever really get these drives, I'm going to have to try it out... See if I can get some LMM or high resolution graphics going...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
Sign In or Register to comment.