Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to know the techniques for hard disk are still available for ssd.

Suppose that we use a solid state disk based on nand flash memory for second storage(without hard disk).

  1. when we read data, disk cache(which has been used for improving between main memory and hard disk) is effective with ssd?

  2. when we write data, write buffering in main memory is also effective with ssd?

I'm so confused to use terminology(such as disk cache, write buffering..). sorry for that.

Thanks for any comments

share|improve this question

It almost sounds like you are confusing the concept of a RAM disk with that of a SSD. A RAM disk is created in DRAM memory to cache data but completely wiped if power is turned off. A SSD uses NAND flash (as you mention) and acts exactly like a traditional hard drive to the OS (albeit a really fast one).

  1. Reading data from a SSD happens directly there is no additional cache like in traditional hard drives.
  2. There is no write buffering, data is written directly to the disk (the NAND flash)

Read caching and write buffering are used in traditional spinning hard drives to account for the lower latencies of writing to magnetic disks (ie moving the actuator and writing the bits on disk).

share|improve this answer
If SSD is so fast, why not use it in place of RAM? No, no, it's still slower than RAM, and still benefits from a cache. – jpaugh Jun 8 '13 at 7:00

Yes, techniques that make spinning hard disks appear faster can and are used to make flash SSD appear faster.

The operating system does not know or care that the device at the other end of the drive cable is a spinning hard disk or a SSD. The operating system treats them both exactly the same.

When an application writes data to "the drive", the operating system buffers that data in a page cache in main memory (i.e., in DRAM on the motherboard) so the application can get on to the next task while the operating system trickles that data through the drive connector. Later when the OS actually sends that data to the drive, both spinning hard disk and SSD store that data in a disk buffer (in DRAM inside the drive case) so the OS can get on to the next task while the drive trickles that data onto the actual non-volatile media (spinning magnetic domains or floating bits of polysilicon).

When an application reads data from "the drive", the operating system checks to see if maybe that data has been buffered in the page cache -- and if it hasn't, it reads not only that block of data from the hard drive, but also does a read-ahead of a few more blocks of data and sticks them in the page cache. When a drive (spinning magnetic or flash) receives a request to read data, it checks to see if maybe that data has already been buffered in the disk buffer -- and if it hasn't, it not only gets that data from the non-volatile media, but it typically also does a read-ahead of a few more megabytes.

These techniques still work because, even though flash memory is much, much faster than spinning hard drives for reads and random writes, flash memory is still several times slower than typical motherboard main memory DRAM.

This all happens automatically with any modern OS.

(I've heard that a few flash SSDs read from so many flash chips in parallel that it is fast enough to do that "on-the-fly" when responding to a read request, so they don't buffer reads. Their internal disk buffer only buffers writes, which are much slower. Also, DRAM SSDs use DRAM, not flash, so they don't have a internal disk buffer at all, since it wouldn't be any faster at reads or writes. )

EDIT: Some people seem to think that the operating systems does know and care about whether the device at the other end of the cable is a spinning hard disk or a SSD -- in particular, so the OS can send the appropriate TRIM command to only the SSD.

My understanding is that (a) many early operating systems don't know anything about SSDs. Those OSes were written under the assumption that the device at the other end of the cable is a spinning disk. Those operating systems still work fine when the spinning disk is replaced with a SSD. All such OSes treat both SSDs and HDDs the same.

Also, (b) many modern operating systems do know all about SSDs. In particular, many modern OSes send the TRIM command at the appropriate time, in order to improve SSD performance. However, my understanding is that many (most?) such OSes typically still treat SSDs and HDDs the same -- they send the TRIM to all the drives, even spinning disk drives, and the spinning disk drives silently ignore it. See Does having TRIM enabled affect other hard drives on a computer (and how do you know when Windows is using it)?

Also, older SSDs -- built before the ATA standard had a TRIM command -- will also silently ignore the TRIM command. See Wikipedia: TRIM.

share|improve this answer
Uhm, as far as I know, OSes do know what drive they are using, for example Windows enables the TRIM feature if it's running on a SSD drive, am I right? – Deses Jun 7 '13 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .