what is the difference between l1 cache and l2 cache?

前端 未结 3 1765
旧巷少年郎
旧巷少年郎 2021-02-01 03:39

I know that l1 and l2 caches are levels in multi-level cache.
I would like to know where each level cache is placed, and what is the maximum number of cache levels allowed?<

相关标签:
3条回答
  • 2021-02-01 04:05

    Taken from this link -

    L1 and L2 are levels of cache memory in a computer. If the computer processor can find the data it needs for its next operation in cache memory, it will save time compared to having to get it from random access memory. L1 is "level-1" cache memory, usually built onto the microprocessor chip itself. For example, the Intel MMX microprocessor comes with 32 thousand bytes of L1.

    L2 (that is, level-2) cache memory is on a separate chip (possibly on an expansion card) that can be accessed more quickly than the larger "main" memory. A popular L2 cache memory size is 1,024 kilobytes (one megabyte).

    Complete Cache architecture is here in WIKI

    0 讨论(0)
  • 2021-02-01 04:06

    The different between L1 and L2 cache

    Although both L1 and L2 are cache memories they have their key differences. L1 and L2 are the first and second cache in the hierarchy of cache levels.

    1. L1 has a smaller memory capacity than L2.

    2. Also, L1 can be accessed faster than L2.

    3. L2 is accessed only if the requested data in not found in L1.**

    4. L1 is usually in-built to the chip, while L2 is soldered on the motherboard very close to the chip.

    5. Therefore, L1 has a very little delay compared to L2. Because L1 is implemented using SRAM and L2 is implemented using DRAM, L1 does not need refreshing, while L2 needs to be refreshed.

    6. If the caches are strictly inclusive, all data in L1 can be found in L2 as well. However, if the caches are exclusive, same data will not be available in both L1 and L2.

    IF YOU WANT TO READ DEEPLY CLICK THIS LINK

    0 讨论(0)
  • 2021-02-01 04:19

    Both of these depend on the CPU. There are CPUs which have no cache at all, there are CPUs which have the L1 cache on die and the L2 cache on a separate die on the same chip or even on a separate chip, or there are CPUs which have both L1 and L2 cache on the same die as the CPU core.

    There are multi-core, multi-chip CPUs where each core has its own L1 cache on die, the 4 cores of one multi-core chip share an L2 cache that is on chip, but on a separate die, and the 2 chips share an L3 cache that is on a separate chip, but in the same package. Sometimes, there are also so-called CPU books which contain multiple chip packages, which might or might not have their own shared cache, which would then be an L4 cache.

    Of course, multi-core chips don't have to share their L2 cache, they can also have private L2 caches.

    And it's not always obvious, what level a certain cache is, or even whether or not a piece of RAM is a cache at all.

    For example, on later Intel 80486 processors, there was an L1 cache on the chip and an L2 cache on the motherboard. But then AMD came out with a socket-compatible CPU that had both an L1 and L2 cache on the chip. So, the exact same cache chip on the motherboard was either an L2 or L3 cache, depending on what kind of CPU you used.

    On the Cell BE CPU, the SPEs have 256 KiByte of RAM each. Except that this RAM has about the same size and the same speed as a typical L2 cache, and since the SPEs don't have any other caches, you could also view this as a cache. However, caches are normally managed automatically by the CPU, whereas RAM is typically managed by the user program, the language runtime or the OS, not the CPU. So, is this RAM or a cache? It turns out that, in order to achieve best performance, you should really not view this as RAM, but more as a software-controlled cache.

    0 讨论(0)
提交回复
热议问题