Welcome to my blog
Hello and welcome to my blog. Here I will be writing about my experiences while I am enrolled on my MSc in Computer Game Engineering. I will be blogging about what I'm learning, what games I'm playing and other game's related comments.
Thursday, 7 October 2010
Cache
We started off today talking about cache - which is basically a buffer where data can be accessed quickly, much quicker than if you had to access the data from the original source. A cache miss (when the data isn't in the cache) is something to be avoided, since it must then be retrieved from the original source (which take more time), it also flushes data already in the cache (so you lose important data you had already) - which could cause more cache misses.
Level 1 and level 2 caches where also mentioned. Level 1 is the fastest memory on a pc it built directly into the processor itself, there are to separate caches in level 1 one is for instruction the other is for data. Level 2 is bigger in size compared to level 1 but it's not so quick to access.
There is a careful balanced when managing cache - if you manage it to much then you slow the program more than you would have if you hadn't managed the cache at all.
Cache associativity is when level 1 and level 2 share the same data. There are a number of ways you can map these:
(for simplicity I will say Level 1 has 10 bytes of space and Level 2 has 100 bytes)
Direct mapped cache: For each 1 byte of L1 there's an associated 10 bytes block of L2 that go to that specific byte on L1.
Fully associated cache: Any of the 100 bytes from L2 can go anywhere onto the 10 bytes of L1. There is no specific location for each group of bytes.
N-Way Set Association cache: N is an integer normal 2,4,8... Instead of one single block of 10, the L1 cache is split up into 10/N sets sized N (say we have X sets), each of these sets have an associated 100/X block of L2.
Level 1 and level 2 caches where also mentioned. Level 1 is the fastest memory on a pc it built directly into the processor itself, there are to separate caches in level 1 one is for instruction the other is for data. Level 2 is bigger in size compared to level 1 but it's not so quick to access.
There is a careful balanced when managing cache - if you manage it to much then you slow the program more than you would have if you hadn't managed the cache at all.
Cache associativity is when level 1 and level 2 share the same data. There are a number of ways you can map these:
(for simplicity I will say Level 1 has 10 bytes of space and Level 2 has 100 bytes)
Direct mapped cache: For each 1 byte of L1 there's an associated 10 bytes block of L2 that go to that specific byte on L1.
Fully associated cache: Any of the 100 bytes from L2 can go anywhere onto the 10 bytes of L1. There is no specific location for each group of bytes.
N-Way Set Association cache: N is an integer normal 2,4,8... Instead of one single block of 10, the L1 cache is split up into 10/N sets sized N (say we have X sets), each of these sets have an associated 100/X block of L2.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment