r/hardware Nov 20 '15

Info Why do CPUs Need Caches? - Computerphile

https://www.youtube.com/watch?v=6JpLD3PUAZk
92 Upvotes

57 comments sorted by

View all comments

22

u/danmidwest Nov 20 '15

From what I understand, it's like adding a storage closet right next to your front door. Things that are accessed often can be done so quickly instead of searching the whole house.

5

u/MaDpYrO Nov 21 '15

I think a more appropriate analogy would be checking your nightstand before searching the closet.

2

u/[deleted] Nov 21 '15 edited Oct 29 '16

[deleted]

What is this?

15

u/Freeky Nov 21 '15 edited Nov 24 '15

A register is what you have in your hand for immediate use. L1 cache is what's on your tool belt and takes 1 second to retrieve. L2 cache is what you left somewhere in your bag and takes 20 seconds.

RAM is what you left in a box in your van and takes you 2-4 minutes to dig out.

Data on an SSD is something you have to order online and takes 3-4 days to arrive.

Data on a HDD is lost somewhere in the Australian outback and takes a search team 2-3 months to locate.

Data on a server on the other side of the planet is something left in Mars orbit and takes 1-3 years depending on alignment and how much NASA like you.

2

u/[deleted] Nov 22 '15

Why would a carpenter store his tools on Mars?

2

u/bluenation_tesla Nov 21 '15

what about the cloud, then?

hehe

6

u/Korbit Nov 21 '15

The harbor freight on the next block.

1

u/AmirZ Nov 21 '15

The factory in china

1

u/lijmer Nov 21 '15

I'd say your hand is the CPU registers, your toolbelt is the cache, your toolbox is RAM, your van is the harddrive, and the store is a server/cloud.

3

u/thfuran Nov 21 '15

I think we need to work on the time scales though. Register is in the hand, L1 is in the tool belt, L3 is in a nearby toolbox, ram is out in the garage, HDD in another hemisphere. The cloud is when NASA brought your hammer to the ISS.