Skip to content
hitechwholesales
Menu
  • Home
  • Games
  • Android
  • Technology Explained
  • Internet
Menu

What’s the Difference Between RAM and Cache Memory?

Posted on August 5, 2022

If you’re a techie, you may have heard of caches and how they work with your system’s RAM to make it faster. But have you ever wondered what is cache and how is it different from RAM?


Well, if so, then you are in the right place because we will see everything that differentiates cache from RAM.


Contents

  • Know the memory systems in your computer
  • Understanding RAM and how it works
  • Cache explained
  • RAM vs. cache
  • Cache is much faster than RAM

Know the memory systems in your computer

Before we start comparing RAM to cache, it’s important to understand how a computer’s memory system is designed.

You see, both RAM and cache are volatile memory storage systems. This means that both storage systems can store data temporarily and only work when power is supplied to them. Therefore, when you turn off your computer, all data stored in RAM and cache is deleted.

For this reason, any computing device has two different types of storage systems: primary and secondary memory. Drives are the secondary memory in a computer system where you keep your files, capable of storing data when it is turned off. On the other hand, primary memory systems supply data to the CPU when turned on.

two ram sticks

But why have a memory system in the computer that cannot store data when it is turned off? Well, there’s a big reason why primary storage systems are the quintessential computer.

You see, even though your system’s main memory cannot store data when there is no power, they are much faster compared to secondary storage systems. When it comes to numbers, secondary storage systems like SSDs have an access time of 50 microseconds.

By contrast, primary memory systems, such as random access memory, can supply data to the CPU every 17 nanoseconds. Therefore, primary memory systems are nearly 3,000 times faster than secondary storage systems.

Due to this difference in speeds, computer systems come with a hierarchy of memory, allowing data to be delivered to the CPU at blazing fast speeds.

CPU on a motherboard

This is how data moves through memory systems in a modern computer.

  • Storage units (secondary memory): This device can permanently store data, but it is not as fast as the CPU. Because of this, the CPU cannot access data directly from the secondary storage system.
  • RAM (primary memory): This storage system is faster than the secondary storage system, but it cannot permanently store data. Therefore, when you open a file on your system, it is moved from the hard drive to RAM. That being said, even RAM isn’t fast enough for the CPU.
  • Cache (main memory): To solve this problem, a particular type of primary memory known as cache memory is built into the CPU and is the fastest memory system in a computer. This memory system is divided into three parts, namely the L1, L2 and L3 cache. Therefore, any data that needs to be processed by the CPU is moved from the hard drive to RAM and then to the cache. That being said, the CPU cannot access data directly from the cache.
  • CPU registers (primary memory): The CPU register in a computing device is tiny in size and is based on the processor architecture. These registers can contain 32 or 64 bits of data. Once the data is moved to these registers, the CPU can access them and perform the task at hand.

Understanding RAM and how it works

As explained above, the random access memory in a device is responsible for storing and supplying data to the CPU for computer programs. To store this data, random access memory uses a dynamic memory cell (DRAM).

This cell is created using a capacitor and a transistor. The capacitor in this arrangement is used to store charge and is based on the state of charge of the capacitor; the memory cell can contain either a 1 or a 0.

If the capacitor is fully charged, it is said to store a 1. On the other hand, when it is discharged, it is said to store 0. Although the DRAM cell is capable of storing charges, this memory design has its flaws.

You see, since RAM uses capacitors to store charge, it tends to lose the charge you have stored in it. Due to this, data stored in RAM may be lost. To solve this problem, the charge stored in the capacitors is updated by sense amplifiers, which prevents the RAM from losing the stored information.

Circuit diagram of a DRAM cell
Image credits: Tosaka/Wikimedia Commons

Although this charging upgrade allows the RAM to store data when the computer is on, it introduces system latency as the RAM cannot transmit data to the CPU when it is being upgraded, slowing down the system.

In addition to this, the RAM is connected to the motherboard, which in turn is connected to the CPU via sockets. Therefore, there is a considerable distance between the RAM and the CPU, which increases the data delivery time to the CPU.

Due to the reasons mentioned above, the RAM only provides data to the CPU every 17 nanoseconds. At that speed, the CPU cannot reach its maximum performance. This is because the CPU must receive data every quarter nanosecond to provide the best performance when running at a turbo frequency of 4 gigahertz.

To solve this problem we have the cache, another temporary storage system that is much faster than RAM.

Cache explained

Now that we know the warnings that come with RAM, we can look at the cache and how it solves the problem that comes with RAM.

First of all, the cache is not present on the motherboard. Instead, it is placed on the CPU itself. Because of this, the data is stored closer to the CPU, allowing you to access the data faster.

In addition to this, the cache does not store data for all the programs running on your system. Instead, it only keeps data that is frequently requested by the CPU. Because of these differences, the cache can send data to the CPU at blazing fast speeds.

Also, compared to RAM, cache memory uses static cells (SRAM) to store data. Compared to dynamic cells, static memory does not need to be updated as they do not use capacitors to store charges.

Instead, it uses a set of 6 transistors to store information. Due to the use of transistors, the static cell does not lose charge over time, allowing the cache to feed data to the CPU at much faster rates.

Circuit diagram of a SRAM cell
Image credits: Abelsson/Wikimedia Commons

That being said, the cache also has its flaws. For one, it is much more expensive compared to RAM. Also, a static RAM cell is much larger compared to a DRAM, since a set of 6 transistors is used to store one bit of information. This is substantially larger than the single capacitor design of the DRAM cell.

Due to this, the memory density of SRAM is much lower and it is not possible to put a single SRAM with a large storage size on the CPU die. Therefore, to solve this problem, the cache is divided into three categories, namely L1, L2, and L3 cache, and is placed inside and outside the CPU.

RAM vs. cache

Now that we have a basic understanding of RAM and cache, we can see how they stack up against each other.

comparison metric

RAM

Cache

Function

Stores program data for all applications running on the system.

Stores frequently used data and instructions required by the CPU.

Size

Due to its high memory density, RAM can come in packages that can store anywhere from 2 Gigabytes of data up to 64 Gigabytes.

Due to their low memory density, caches store data in the Kilobyte or Megabyte range.

Cost

RAM is cheaper to manufacture due to its single transistor/capacitor design.

Cache manufacturing is expensive due to its 6 transistor design.

Location

The RAM is attached to the motherboard and is away from the CPU.

The cache is either present within the CPU core or shared between cores.

Velocity

RAM is slower.

The cache is faster.

Cache is much faster than RAM

Both RAM and cache are volatile memory systems, but they both perform different tasks. On the one hand, RAM stores the programs running on your system, while cache supports RAM by storing frequently used data close to the CPU, thus improving performance.

Therefore, if you are looking for a system that offers great performance, it is essential to look at the RAM memory and the cache that it brings. An excellent balance between both memory systems is essential to get the most out of your PC.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Android
  • Games
  • Internet
  • Technology Explained
  • CCPA
  • DMCA
  • Privacy Policy
  • Terms of Use
  • Contact us
  • About us
©2023 high tech Gaming | Design: Newspaperly WordPress Theme