6 ms·
I find the real world analogies quite weak and unnecessary. If you haven't read it already, this is worth mentioning: https://people.freebsd.org/~lstewart/arti
by forgotpwtomain 10y ago
I find the real world analogies quite weak and unnecessary.
If you haven't read it already, this is worth mentioning: https://people.freebsd.org/~lstewart/articles/cpumemory.pdf https://people.freebsd.org/~lstewart/articles/cpumemory.pdf
- mungoman2 10y agoI think they are great for building intuition. What don't you like about them?
- qq66 10y agoI also dislike most real-world computing analogies because it encourages the use of mental heuristics that are usually just not that relevant to the situation at hand. I remember when there was a big scandal about MBA applicants getting their admissions status by feeding in query strings to the URL, there was a big debate about whether it was like "breaking a lock" or "opening an unlocked door" which doesn't really respect the unique moral reasoning that you need to use to understand the actual situation at hand.
- Sylos 10y agoI generally like real-world analogies, but in this case I do find it too elaborate and unnecessary, too. As a straight answer to the question, it would have sufficed to explain that accessing a larger cache takes more time and resources than accessing a small cache. Then one could have compared that to desk vs. cabinet once to make it visual, but there's no need to extend that analogy for each individual cache level. That just exhausts the reader and makes it near-impossible to tell which parts of the analogy are relevant/accurate and which parts are just fluff to make the analogy work. Alternatively, if you really want to explain each individual detail of caches, then do go with such an elaborate analogy, but then explain at every step to what it corresponds and which part of the analogy is relevant. You shouldn't write out a page-worth of mostly accurate text and then write a paragraph afterwards to explain how the analogy fits. Chances are you've lost half of your readership at that point and many (myself included to be honest) will quit reading at exactly that point, because they feel like you're repeating yourself.
- smallnamespace 10y ago> it would have sufficed to explain that accessing a larger cache takes more time and resources than accessing a small cache. I think the point of the long analogy is to hammer in the intuition that physical locality has a concrete price in the real world, and the cache hierarchy is simply a consequence.
- peyton 10y agoSometimes long analogies like that of the article have trouble making obvious distinctions between design choices and The Way Things Work. For instance, this article's analogy makes assumptions about cache eviction policy and cache coherence that map nicely to an office setting. Other design choices might not map well. So intuition developed here might not be flexible enough to reason about caches in the real world. Not to say the analogy detracts from the article. The author includes a list of caveats. I really enjoyed the piece.
- oolongCat 10y ago>I find the real world analogies quite weak and unnecessary. I actually thought they were good, I always loved when teachers/professors took the time to explain things using real world analogies. Something about them just makes me remember things better.
- amelius 10y agoAlso, their name is already an analogy: pointer.
- EliRivers 10y agoThis kind of thing reminds me of people trying to teach pointers through clumsy analogies to envelopes and letters, or parcels and addresses, or cars and door handles, or some other awful mess. As with pointers, when it comes to caches, a clear explanation without analogies is far superior.
- posterboy 10y agoThe abstract and transparent explanation would involve a lot of maths, in which case a blog post might be the wrong place to start.
- EliRivers 10y agoI'm not convinced it would. They're different kinds of storage, with principal differences in access speed, sharing between cores, physical location and so on. No mathematics needed for a working understanding.
- smallnamespace 10y agoI think you have it backwards. The differences in access speed, density, and power between different types of caches are due to how our physical world works. Therefore,uUsing a physical analogy is totally appropriate since we see the same constraints in different contexts; namely, there's an energetic cost to be paid for increased physical locality, and this is intuitively obvious to most people. The specific details (e.g. eviction policy, cache topology, etc.) are mostly irrelevant for understanding this key point.
- EliRivers 10y agoAnalogies are unhelpful here. I don't need an analogy to help people understand that different kinds of memory have different characteristics. I can just say it. It is easier to understand if I simply state that there are different kinds of memory, and that they have different constraints in terms of speed, density and power. That is really, really easy to understand and from there I can accurately reason about it. I don't need an analogy to understand any of this. Just saying that different kinds of memory have different speed, densities and power consumptions explains everything and provides all the intuition needed.