Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I liked this better:

L1 - You've already started eating the sandwich, and only need to move your mouth and take another bite. (2 seconds)

L2 - There is a sandwich on the counter, so you need only find it, pick it up, and begin eating. (10 seconds)

RAM - You're near the fridge, but you need to open it and quickly throw together a sandwich. (3 minutes)

HD - Drive to store, purchase seeds, grow seeds, harvest etc. (1 year)

http://www.reddit.com/r/programming/comments/90tge/hey_rprog...

http://news.ycombinator.com/item?id=702713



Actually, this sandwich analogy is not as good as the library/book one.

In this analogy, you are busy while you are making your sandwich (because you are putting it together from stuff you got from your fridge).

In the library-with-free-delivery-service analogy, you can do other work while you wait for data from the library/RAM to be delivered.

Modern superscalar processors can re-order non-dependent instructions while waiting on a memory lookup, and that is what the free-delivery-service aspect of the analogy illustrates.


Very much agree. The analogy I'm used to (and use) is:

CPU = person (researcher at library) RAM = bounded physical space on desk Swap = cart for stacks Disk = the stacks (requiring scheduling of the elevator)

In my mind, the discussion of second/nanosecond is unimportant and makes this seem more technical than it needs to be to illustrate the point that "fetches from (non-SSD) disk are very slow and waste a lot of time." But this doesn't seem to be quite as focused as "A complete idiot's guide to the main components in a computer and what they do." (though I'm not sure that it's either time scales or components or SSD)


No! That version of the library analogy makes the ratios much too small.

CPU to main RAM: actually about 150:1; more like 30:1 in your analogy.

Main RAM to HD: actually about 200,000:1; more like 120:1 in your analogy.

The reason why "the discussion of second/nanosecond" is worth having is precisely that if you just say "very slow" and "a lot of time" then you're likely to think about ratios of the sort in your analogy, when the reality is much much much worse. (Extreme case: HD to CPU registers. Actual ratio: about 30 million to 1. Ratio in your analogy: about 4000 to 1.)


> In my mind, the discussion of second/nanosecond is unimportant

I disagree. The second/nanosecond discussion illustrates the scale of the difference. I can understand the difference between a few seconds and a few years (just about), and it puts it into perspective.

> "fetches from (non-SSD) disk are very slow and waste a lot of time."

Saying "It's very slow" isn't very helpful. I want perspective. Also the point is that the time is perhaps not wasted is an interesting one.

The original analogy is intelligent, (accurate?) and puts this into perspective for developers (and potential SSD customers!).


CPU register: there is a bite of sandwich in your mouth.


More precisely, a few bits of sandwich


SSD - order sandwich ingredients online and wait for them to arrive (about a day, give or take)?


About a day is ~90 microseconds, which is really fast, even for an SSD. The FusionIO folks claim they can do 30 microseconds though, which is really incredible, just a couple hundred times slower than ram.

I wanted to say that that was within an order of magnitude to the cost of a simple system call, but it looks like system calls are much much faster than my intuition suggested[1], and they're in the range of RAM access.

1] http://stackoverflow.com/questions/1860253/what-is-the-overh...


Looking at a random (2010) SSD review, it lists average read access times of less than 0.15 milliseconds = 150 microseconds for all of the SSDs involved. The long standing "gold standard" Intel X25-M had 70 μs.

http://www.tweaktown.com/reviews/3375/corsair_force_f120_120...


Wow that's faster than the range I was working with. Will look into it, thanks for the info.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: