How do CPU and RAM Work Together?

Written By Mushfiq Rahman

The RAM or memory of a computer is very essential for its basic operation. You may have heard that more memory can increase your system performance.

But have you wondered how it works with the CPU in unison?how-do-cpu-and-ram-work-together

Memory is basically the place where all the programs are stored during execution. And if you buy the perfect RAM, you can actually unlock some additional performance.

So join me as I explore the intricate pairing of memory with the processor and why you should know more about it.

How does a CPU Work?

A processor executes pieces of instructions that are present in a program. It does this by using the data stored in the memory. All instructions are part of the programs that you run, and the data CPU uses in such calculations are stored in the memory.  

Let’s take a simple calculator application, for example.

It can perform simple arithmetic operations using the input that you provide. Suppose you wanted to know what the answer to 5+7-3*2 is. The application will break this query into multiple instructions, with each step doing one mathematical operation and aggregating with the previous step.

The Processor obtains these instructions stored in a location within the memory by loading them to its cache memory. Here the famous Fetch-Decode-Execute cycle starts to process the instructions.

cpu-architecture

Every processor has a control unit, arithmetic logic unit, memory registers, and cache memory. Remember, a CPU won’t run without RAM sticks.

The control unit orchestrates which instructions are sent for execution in the arithmetic logic unit. The registers hold the results of the instructions, while the cache facilitates the quick retrieval of instructions from the main memory.

Now, let’s go back to the calculator application again.

The control unit requests the instructions from memory, and these are loaded into the cache memory. The next step is decoding what operation needs to be done, such as adding 5 and 7. Then the specific instruction is sent to the Arithmetic Logic unit, where the addition is performed, and the result is stored in the Registers.

The Fetch, Repeat, Execute cycle repeats again for the next successive pieces of instructions. This continues as long as you continue using the calculator app and the application loads the instructions to the memory.

How does RAM Work?

A RAM works by storing all the data from an application, including the inputs and output operation that needs to be performed. When you open the calculator app, everything the app can do is loaded in the memory. This includes all the instructions, such as addition and subtraction.

I will extend the example of the calculator application here to explain the memory architecture.

memory-architecture

Let’s dive in a bit about how memory is structured.

A memory contains a large number of cells that are arranged in a tabular manner. These cells are typically made up of transistors and capacitors. The capacitors hold a charge, which can be represented as the data that is stored.

When an app loads a program to a memory, the memory cells are refreshed with new data. The processor, meanwhile, has no idea where a certain instruction resides on a memory.

Think of a situation when you need to replace a specific hard drive in a server farm. Unless you know the exact server and the serial number of the HDD, you will be lost when retrieving it.

To help the processor get the specific data, you need the addresses of the instructions which are provided by the Memory Controller integrated with the processor.

How do CPU and RAM Work Together?

The CPU executes the instructions, which are stored by the RAM. They are connected using a unified bus. A memory controller collects the instructions from the RAM and sends them to the CPU for execution. The process repeats as long as you are running any applications on your computer.

Now let’s focus on the memory controller, which delivers the instructions from the memory.

Remember the Fetch-Decode cycle? When a processor requests instructions, the memory controller acts as an intermediary and collects the data. It knows all the locations of the data that is stored on the memory itself.

memory-controller

The data arrives at the CPU using a bus that connects the processor with the memory. This is basically a wired connection between the two. There are separate channels for the address and the data. Data moves to and fro using this path.

The speed at which the data transfer is performed is denoted by the memory bandwidth of the processor. As newer processors are released, more data can be exchanged between the two. The result is faster execution of instructions.

How Does RAM Affect Performance

Your processor is the fastest component of your computer. It can execute instructions so fast that other components, such as memory or storage drive, are often behind the slowdowns that we experience.

Choosing the right RAM is crucial to getting the maximum performance out of your computer. Having a Mustang and not being able to hit its max speed is similar to what you can expect if you do not choose the best RAM.

Let’s look at some factors that will show which metrics to look at when buying the correct memory:

Memory Frequency

Every RAM has a maximum rate at which it can transfer data, known as memory frequency. This is denoted by its frequency. The more this value is, the faster the processor can access the data.

You can see its rated frequency printed on its packaging. Here is a Corsair Vengence PRO RAM module.

corsair-3200-ddr4

However, every CPU has some limitations imposed on it regarding how fast it can accept the data.

A Ryzen 3 3200g supports memory up to 2933 MT/s. For a Ryzen 5 5300g, the official support goes up to 3200 MT/s. As newer components are released, they can accept faster RAM due to architectural changes.

A slower RAM means your system is limited by memory. It has the potential to go faster. So, buy the fastest RAM supported by your system.

You can also speed up your RAM with some overclocking. Check out our separate article on how you can achieve this without breaking up your system.

CAS Latency

As explored in the memory section, CAS latency is the total time that a processor takes when accessing individual memory blocks. This is represented in nanoseconds (ns).

The latency values are stated as four digits. For example, the Kingston Fury Beast 3200 MT/s RAM has timings of 16-18-18-18. Here the first digit represents the latency which in this case is 16 ns.

memory-latency-cpu-z

The lower the latency, the faster your system’s performance will be. So, go for the RAM that has the lowest latency with the fastest clock speed.

However, the latency of memory between generations is not the same. DDR5 has almost double the latency of DDR4 memory. But its higher clock speed makes up for it, and hence, its performance is not an issue.

Channels

Remember the data bus stated earlier? You can utilize an additional path by connecting the RAM in dual channels.

Dual channel memory increases the data transfer rate twice. Because an additional path is present, more data can now flow to the CPU. And for the CPU, faster data is always beneficial. You can quickly determine which RAM channel to use and utilize more from your RAM modules.

ram-installed-in-dual-channel

It is recommended to buy your memory in pairs and connect them to the alternate slots to the motherboard. If you are looking for 16 GB of total memory, go for 2 identical sticks of 8 GB memory.

You might also be tempted to increase the memory of your computer. Check our article to see if you get any performance benefits from upgrading RAM.

Frequently Asked Questions

How is RAM connected to the CPU?

The memory bus connects the RAM and the processor together. It contains separate paths for data, location, and control signals so that the bandwidth is not an issue when communicating with the processor.

Why is RAM important for your CPU?

You need a storage place for your applications to keep the data being executed. More RAM means additional space to open applications. Applications such as games require more memory than conventional applications such as web browsers.

Does RAM speed depend on the CPU?

You can only use the RAM with maximum speed supported by your processor. This speed is limited by the memory controller. Check your processor’s support page to know about the fastest speed that is supported.

How to know which RAM is compatible with my CPU?

Every processor supports a certain generation and memory frequency. Consult with the processor support page to know more about it. For example, the Ryzen 7000 series only supports DDR-5 memory. You cannot use DDR-4 memory because its motherboard chipset does not support it.

Conclusion

A processor is one of the most complicated components manufactured on Earth. And the way it works is even more complicated, which makes it even more fascinating for computer geeks.

Add memory to the setup, and you are giving the processor headroom to flex its muscles. That is a very simple analogy, but it explains the relationship between the two.

I hope this article added some value to your computing knowledge.

Until next time, it’s farewell from us here.

About The Author
Mushfiq is a CSE graduate currently serving out piping-hot tech tips. He is a self-confessed computer nerd and fell in love with computers when racing with the OG Most Wanted. He also pledges lifelong allegiance to MCU. You will find silly comedies on his movie watchlist, mostly due to Steve Carell. Apart from computers, the night sky fascinates him the most.

Leave a Comment