9.3. Cache memory and How It Works

posted Jul 21, 2014, 10:08 PM by Maurice Nyamoti   [ updated Nov 18, 2014, 11:15 PM ]

Cache memory and How It Works

  • Cache Memory is a special high speed mechanism. It can be either a reserved part of main memory or an independent high speed storage device.

How does the cache work?

cache memory

  • The Cache Memory Comes as a go between the CPU and the RAM. When the the CPU wants to pick elements of currently running programs, it easily fetches them from the Cache rather than from the RAM which is a volatile memory
  • The cache keeps the elements of those programs that are frequently run by the computer user these elements are called -cached files- when the user wants to run the programs again, these programs are easily retrieved from the list of cached files which is a faster approach compared to getting them from the RAM that alternatively requests the same files from secondary storage devices.
  • In Personal Computers, There are two types of caching are commonly used are memory caching and disk caching.

    A memory cache

    • sometimes called a cache store or RAM cache, is a portion of memory
      made of high-speed static RAM (SRAM) instead of the slower and cheaper dynamic RAM (DRAM) used for Main Memory.
    • Memory caching is effective because most programs access the same data or instructions over and over. By keeping as much of this information as possible in SRAM, the computer avoids accessing the slower DRAM.
    • Some memory caches are built into the architecture of microprocessors.
    • Disk caching works under the same principle as memory caching, but instead of using
      high-speed SRAM, a disk cache uses conventional main memory.
    • The most recently accessed data from the disk is stored in a memory buffer. When a
      program needs to access data from the disk, it first checks the disk cache to see if the data is there.

Disk caching

    • can dramatically improve the performance of applications, because accessing
      a byte of data in RAM can be thousands of times faster than accessing a byte on a hard disk.
      For example, Internet connection is the slowest link in computer. So the browser
      (Internet Explorer, Netscape, Opera, etc.) uses the hard disk to store HTML
      pages, putting them into a special folder on the disk.
      The first time you ask for an HTML page, the browser renders it and a copy of it is
      also stored on your disk. The next time, on your request to access this page, your
      browser checks if the date of the file on the Internet is newer than the one
      cached. If the date is the same, your browser uses the one on your hard disk instead of
      downloading it from Internet. In this case, the smaller but faster memory system
      is your hard disk and the larger and slower one is the Internet.
    • There are other caches like page cache, L1 cache, L2 Cache, virtual memory.

      L2 Cache:

    • If there is some special memory bank in the motherboard which is small but
      very fast and two times faster than the main memory access. That's called a level 2 cache
      or an L2 cache.

      L1 cache:

    • If there is smaller but faster memory system directly into the microprocessor's
      chip and this memory will be accessed at the speed of the microprocessor and not the
      speed of the memory bus, That's an L1 cache.

So! What role does the Cache Memory Play in the CPU?

Quickening of processing activities in the CPU by keeping elements of frequently used files.

Cache is made out of which technology?

The technology that designs the cache is that of - Static Random Access Memory (SRAM)

Comments