+3 votes
202 views
The guide to understanding your computer's RAM: never run out of memory

in Help by (551k points)
reopened | 202 views

1 Answer

+4 votes
Best answer

Computers run programs
Volatile, non-volatile memory and hard drives
The importance of RAM
RAM types
What is that of the channels?
How much memory do I need?
DDR4, is it better than DDR3?
Better with SSD
The near future

image

Traditionally, there has been some confusion when talking about the memory of laptops, desktops and even mobile devices such as smartphones or tablets. "What memory does your computer have?" It is a question that we do not always know how to answer clearly..

Sometimes we confuse gigs with megabytes, storage memory with RAM , and we get a bit of a mess. If you are an advanced user, sorry if what we are going to tell you now is already known, but in order to undo this confusion we will start from simple concepts.

Computers run programs

The reason for being of a computer is to run programs. As smart as they may sound, they are nothing without software . Everything that a mobile, tablet, laptop or desktop, Windows or Mac or Linux, with processors from Intel, Qualcomm, AMD, Mediatek or whatever manufacturer does, is precisely that: processing program instructions. One after another, from start to finish..

A processor (a CPU or central processing unit), as soon as it receives power by pressing the power button, waits for instructions to start executing them . The computer startup sequences are responsible for initializing the system so that it runs the operating system, on which, in turn, the programs we use in our day-to-day are executed.

image

Be it games, Photoshop, Google Chrome or Star Wars Battlefront, it all comes down to a processor that “reads” instructions and processes them according to the structure of the program that is running..

A CPU processes instructions at a clock frequency of several Gigahertz (GHz). The clock on a computer is like the captain of a galley. It sets the pace at which instructions are processed, in the same way as the captain paces the rowers . The nuance is that if they were to row according to a computer clock frequency, they would have to move the oars about a billion times per second, assuming the clock frequency was 1 GHz.

That is the rate at which current processors work. That is, assuming a frequency of 1 GHz, an instruction is processed every nanosecond . At 3 GHz, 3 instructions would be processed for every nanosecond, and so on.

image

So that there are no bottlenecks that slow down the CPU, the processors have to receive instructions at that rate . Otherwise they would have to be waiting for them, which would not make sense. Now, where are the programs that contain these instructions stored? The answer is: in memory.

Simple, but in practice, things get complicated. For example, there are several types of memory. And instructions and data are moved from one to another as appropriate to make the processor not have to wait to execute the code sequences. The faster this memory, the more expensive it will be and the less quantity we can have .

So the engineers had no choice but to design a hierarchy of "containers" (buffers or cache memory) in which small amounts of super-fast memory are used on a first level, larger amounts of somewhat slower memory on a second level, even greater amounts of cache even less fast in a third level, to arrive in a fourth level to the RAM memory , which is the one that will be more familiar to users. The memory of the first three levels is called "cache" and is built into the silicon of the CPU. In a fifth level would be the hard drives, SSD or magnetic.

image

To give you a rough idea, RAM is what we can buy in stores , while caches are part of the electronics of the CPU. Another difference between cache and RAM is their technology: caches are of the SRAM (Static RAM) type, very fast but very expensive, while what we know as RAM is of the DRAM (Dynamic RAM) type, less fast , but less expensive.

image

If we talk about sizes, the L1 cache moves in values ​​of the order of 32 KB, the L2 memory, of the order of 256 KB and the L3 memory, of the order of 3 - 12 MB. That is, tiny amounts compared to what we usually handle for RAM, in the order of GB . One MB is 1,024 KB and 1 GB is 1,024 MB, so you can get an idea about how little cache memory is available on computers.

As we have already mentioned, SRAM memory is faster, but very expensive. RAM is cheaper, but slower. Faster, lower capacity, and higher price .

Volatile, non-volatile memory and hard drives

Caches and RAM, meanwhile, belong to a broader category, that of volatile memories . That is, if we turn off the computer, its content is lost. For this reason, it is necessary to have non-volatile memory to store data and programs.

Hard drives and SSD drives are non-volatile memory, and it is where a computer goes at startup to load into memory the instructions and data that it will execute during its operation . Non-volatile memory falls into the category of storage systems.

image

So, when they ask us about the memory of the computer or the mobile or tablet, they will generally refer to the volatile RAM . If you ask about storage capacity, we are talking about non-volatile memory. Hard drives. The problem with non-volatile storage systems is their slowness. Accessing the contents on a hard drive or even on an SSD is extremely slow compared to accessing RAM .

Making some numbers, if we take as a reference the time that a clock cycle lasts, which for a 3 GHz processor is about 0.3 ns and if we normalize the scale to make the comparison reference be 1 second , we would have the following:

accessing the L1 cache takes about 3 seconds access L2, about 9 seconds access L3 cache, 43 seconds when we go to RAM, we already talk about an access time of 6 minutes for an SSD, between 2 and 6 days accessing a magnetic hard drive takes 1 to 12 months

In denormalized "computer" time, those 12 months are about 10 ms (milliseconds). A manageable time, but much greater than the 0.9 ns (nanoseconds) it takes to access the L1 top-level cache. And an unacceptable time for normal use of a computer (or a mobile or tablet).

The importance of RAM

RAM, ultimately, is memory that combines a decent size with an affordable price . It is the memory where our programs and data are "loaded" from the SSDs and hard drives so that they are "at hand" when they are claimed by the processor's prediction algorithms, so that they are loaded into the caches before they are reclaimed by the CPU.

In this way, the CPU hardly has to wait, since data and instructions are organized so that they are always in the fastest memories. If we don't have enough RAM, or the prediction algorithms fail, this flow is broken and the processor will be faced with the stark reality of slow hard drive or SSD .

image

For example, if the processor needs data that is not cached, or L1, L2, or L3, it will go to RAM. If it is not in the RAM either, it will have to go to the hard disk or the SSD to read it , and therefore we will have to wait enormous amounts of time for the read operations to be performed.

The more RAM we have, the more likely we are not to have to fetch data or instructions from slow, non-volatile storage systems .

When we say that "the computer is slow", in many cases it is about situations in which the system works longer with RAM and hard drives than with caches . In this vein, it is interesting to say that the best friend of RAM is an SSD disk , especially when we turn the computer on or off, or when we start a new application on the computer.

At times such as power on, off, or when a new application is launched or a photo or text file is read, the system has to work “yes or yes” in the area of ​​RAM and non-volatile storage systems . And, as we have seen, using an SSD disk instead of a magnetic one is the difference (on a normalized scale) between taking days to perform data and program access operations, and taking months.

image

When we use SSD disks, the startup and shutdown of the computer or, in general, the loading of applications in the RAM, are tasks that are carried out in a fraction of the time that it takes with magnetic disks . And if we suspend the computer, the boot is even faster, since in this case we do not have to empty the RAM memory to save it on the disk, but it maintains its content thanks to the fact that the power to the volatile memory is not cut off.

Of course, not by using, say, 32 GB of RAM, the system will go faster. There is an amount of memory below which we will have problems, but above certain limits, unless we use very demanding applications, we will not notice a difference between, say, 16 GB and 32 GB.

RAM types

Memory is usually categorized according to its technological generation. The memory used in desktops and laptops is of the DDR (Double Data Rate) type and the most recent is the DDR4 type, although the easiest you will find in computers and stores is the DDR3 type . There is a variant of low consumption DDR3, the DDR3L, which you can also find for sale. The different generations are incompatible with each other, so that in a DDR3 compatible computer you will not be able to install DDR4 or DDR2, for example.

Memory is available in the form of DIMMs or SODIMMs . The former are for desktops, and the latter, shorter, for laptops. The modules have capacities that vary between 2 GB, 4GB or 8 GB as usual values, although there are also 16 GB or even 32 GB. There is also (in general) the possibility of installing a variable number of them, depending on the number of slots available, which can go from 2 to 8 in the computers with which we are used to working in the domestic environment.

image

Anyway, the trend (at the moment in laptops) is to make the RAM integrated into the board, with no expansion possibilities . In fact, another categorization of the types of memory that is beginning to be relevant, from the buyer's perspective, is that which refers to whether the RAM is soldered onto the computer board, or is installed using removable modules.

In addition to the type of module and capacity, RAM has another variable, the frequency in MHz at which it can operate . There are standards that define a set of speeds at which they have to operate under the corresponding standard, but manufacturers often manufacture modules capable of operating at higher speeds.

image

More MHz doesn't really mean higher performance. At a higher clock speed, other parameters that negatively affect performance, such as access latency , are also higher, so in the end, it is usually used with similar effective speeds for data transfer between the processor and RAM.

The advantage of having modules capable of running faster is that that way they will not “hang” if we tune the system to run faster . Overclocking consists of increasing the operating speed of the components of the system, and if, for example, we increase the processor frequency, the frequency in the memory buses will also increase. If we had a module that ran only at rated speed, it would "hang" under those conditions.

image

What is that of the channels?

In desktop computers, where you can install four and up to eight memory modules, it is usually indicated that the memory must be installed in a certain order. The reason lies in the way the CPU accesses memory. To improve transfer speed, the processor is able to use multiple channels in parallel when accessing memory to increase the number of bits it reads for each read operation .

To do this, it organizes the slots in channels, so that, in a configuration of four slots, two will be for channel 1 and two for channel 2. And their thing is that the modules are installed so that the processor reads the data in memory taking advantage of the full channel width.

image

In practice, the performance of the system will not be particularly affected by not taking advantage of all the channels. The data transfer speed is reduced, but we are talking about figures in the order of tens of GB / s (Gigabytes per second) , enough for there to be plenty of room when transferring data to the caches.

In laptops, generally, we only have a single memory module, wasting the multi-channel configuration, and this does not result in a noticeable performance drop . Laptops 15 '' and up, and some 13 '' laptops, can use SODIMM memory modules in configurations of two, although space is increasingly being saved by eliminating these slots.

How much memory do I need?

Today, and taking into account the prices of RAM (between 6 euros and 10 euros per GB, as an approximation), the "sweet" point would be 8 GB for laptops and desktops . It is a sufficient amount to move the operating system and work with everyday applications and multimedia content that are not out of the ordinary. Better with an SSD, of course.

With 8 GB we can work with video and photo editing applications in home projects. As well as handle multitasking scenarios without problem. Below, we start to have problems if we work with high resolution image files, high resolution and quality videos or with many tasks at the same time . They are not unsolvable problems, since the system will go to "simulated" memory on the hard drives to work (the paging files), but at the cost of slowing down the response to highly undesirable limits.

image

Above 8 GB we enter a field with many possibilities for enthusiastic and demanding users . In professional systems, RAM is installed in larger amounts even than the size of our SSD hard drives. In these scenarios, databases and spreadsheets with gigantic sizes are handled, which have to be in RAM to meet the requests of thousands of users at the same time, for example.

In the home environment, from 16 GB we can play with the use of RAM, for example, as a place to store temporary system files or applications, which would otherwise be installed on hard drives or SSDs .

You can also install larger amounts of 32GB or 64GB and use some of the RAM to configure it as a hard drive in RAM . If we install a virtual machine in virtual units in RAM, the result is spectacular in terms of speed and response.

The amount of memory is especially relevant if we buy a computer that has the RAM soldered, and that, therefore, cannot be expanded. They are usually Ultrabook or convertible type laptops, ultralight and with a very thin design. The most economical models usually equip only 4 GB , which allows to work in a decent way with Windows and Mac, but is a fair bit for demanding users and enthusiasts in order to amortize the investment or protect themselves from planned obsolescence as they are used. Applications and operating systems are designed for more ambitious configurations.

image

DDR4, is it better than DDR3?

The newest thing in RAM is DDR4. With Intel's new 6th generation processors, DDR4 RAM support is coming in both desktops and laptops . The standard speed (SPD) of the modules goes from 1,600MHz to 2,133MHz and the memory modules reach higher capacities with less technological complexity, so it is not difficult to find 8GB and even 16GB modules .

Anyway, the speed is not really an improvement, since the internal latencies are higher than in DDR3 and in a way it is "eaten by what is served" . The advantages are also in the part of the voltage, lower than in DDR3, which saves energy, especially in laptops.

So DDR4 is a good argument, an (almost) obligatory choice, all said, if you buy a computer with new 6th generation Intel processors, but don't be told that it is better to buy a computer with DDR4 instead of DDR3 because the RAM performance is better . Or put another way, that memory alone is not the argument for buying a new computer.

Those who practice overclocking, should pay attention to the working frequency of the RAM, although it is a type of audience that knows perfectly what it needs and how to configure it.

Better with SSD

As an advice, say that installing an SSD disk is a resource that can greatly improve the performance of a computer . As we have seen, it is inevitable that the system has to “fill” volatile memories with the content of non-volatile ones (hard drives) during such common tasks as opening an application, or turning the computer on and off.

image
SSDs are many orders of magnitude faster than magnetic ones , so we'll reduce the time penalty of having to have RAM search the drives for data or programs.

The same applies to the case that we have enough RAM to configure a virtual disk. When it comes to saving or recovering its content to turn off the computer, it will take much less time to do so if we have an SSD disk as a storage unit.

The near future

The organization of memory has hardly changed for decades. The most notable advance was many years ago: that of solid state memory applied to SSDs . But non-volatile memory was still far inferior in performance to volatile, which forces to establish memory hierarchies like the current one.

image

But Intel has developed together with Micron, a memory manufacturer, a new non-volatile memory with a performance comparable to that of volatile RAM . This technology, called 3D XPoint, opens the door to eliminate the barriers between RAM and SSD disks, unifying the difference between both storage subsystems.

For now, Intel will market SSDs with this type of memory during 2016, pulverizing the performance figures of SSDs. And for servers, it will begin to use RAM modules with non-volatile memory with this technology, eliminating bottlenecks in the field of moving from non-volatile to volatile memory at a stroke.


by (3.5m points)

Related questions

+4 votes
1 answer
+5 votes
1 answer
asked Oct 7, 2019 in Hardware by backtothefuture (551k points) | 379 views
+3 votes
1 answer
asked May 17, 2020 in Help by backtothefuture (551k points) | 203 views
+3 votes
1 answer
Sponsored articles cost $40 per post. You can contact us via Feedback
10,632 questions
10,764 answers
510 comments
3 users