Are computers with more RAM potentially faster if not all memory is usually in use?

85

14

Let's say I have a computer with 16 GB of memory. If my computer is usually only using about 4 GB and never reaches 8 GB, is it any faster than a computer with only 8 GB of (the same type of) memory? Would my computer run equally fast by removing the other half of the 16 GB leaving just 8 GB?

Keavon

Posted 2014-07-23T02:50:30.520

Reputation: 1 130

17Part of the difficulty of this question is that "in use" is difficult to define for any modern operating system with virtual memory and memory-mapped files. For example, is the code ("text") segment of an executing program "used" or "cache"? – R.. GitHub STOP HELPING ICE – 2014-07-23T17:38:39.540

5Different operating systems manage memory differently. No operating system has been indicated in the question. The term "is use" can also mean different things. Bad question, even worse answer chosen. – Jason – 2014-07-23T21:59:33.173

The smaller memory is potentially faster, since there's less load on the memory address drivers. In practice, though, I doubt that the clock speeds are adjusted to take this into account, so there'd be no difference. (This is assuming the "extra" RAM would just sit there like a lump and not somehow be put to use.) – Daniel R Hicks – 2014-07-23T23:03:55.230

3This question really needs a definition of "in use". Every answer (as the currently accepted) that claims cache tells about a use of memory. This is probably the more usefull definition, but separating different uses of memory would be helpfull. I assume we might not want to discuss if completely unused memory is helping... – Nanne – 2014-07-24T13:55:42.660

Also note that that having the extra ram stick itself makes it faster, since both should be able to be accessed in parallel. – Tyzoid – 2014-07-25T12:59:22.017

The question "Are computers potentially faster...?" is at odds with the text: "Would my computer run equally fast without the extra memory?". If the answer to the first is Yes, then the answer to the second is No. Making these consistent would improve the question. – Dominic Cronin – 2014-07-27T12:43:31.117

@Tyzoid What you're referring to is called "dual-channel" or "multi-channel", where sets of one or more DIMMs are attached to independent channels of one or more memory controllers. – user314104 – 2014-07-29T16:23:59.150

@user314104 Right. Where the OP said 'run equally fast by removing the other half of the 16 GB leaving just 8 GB'. I implied that it referred to two 8gb sticks of ram. – Tyzoid – 2014-07-29T18:09:04.803

Answers

112

Yes, because the operating system can use the extra RAM as disk cache, which speeds up access to data on disk.

Extra RAM won't make CPU-bound computations (not involving much disk I/O) faster, though.

Wyzard

Posted 2014-07-23T02:50:30.520

Reputation: 5 832

In general, how much RAM may be used for disk caching on a normal workstation? – Keavon – 2014-07-23T03:04:09.120

31Any RAM that isn't being used for other purposes. (Unless you have more RAM than disk space, which is unlikely.) – Wyzard – 2014-07-23T03:05:11.293

You should point out that it is the window's approach. I do not think linux or mac "use" any extra ram. – khajvah – 2014-07-23T03:09:08.377

30Linux does. I'd be surprised if Mac OS didn't do the same. It'd be silly not to. – Wyzard – 2014-07-23T03:10:25.747

@Wyzard I heard that windows shows that it uses a lot of ram while it actually caches the extra ram, as you said but under linux, I have never experienced extra use of ram. It simply doesn't show. – khajvah – 2014-07-23T03:17:56.327

9"Doesn't show" where? Run free on a Linux system and look at the "cached" column. Some higher-level applications (such as the GNOME System Monitor) don't report cache as "in use" because that RAM is available for use by other programs; the kernel can discard caches at any time. – Wyzard – 2014-07-23T03:23:46.097

If you have abundance of unused memory you can gain huge speed boost by turning some of it into RAMdisk for files in constant (your background music for example) use or for your temporary workbench (eg. for some multi-stage file processing where you are interested only in end result) – PTwr – 2014-07-23T06:35:15.137

@Keavon, all of it. The OS should automatically discard cache entries as necessary. – Jayen – 2014-07-23T06:57:29.050

3Extra RAM won't make CPU-bound computations faster, but faster RAM can, so be sure to buy the fastest RAM your CPU/motherboard support. Note that there is clock speed as well as latency to consider. – Jayen – 2014-07-23T06:58:50.140

4@PTwr - in that case the OS should be caching those files and should not give that much speed up - a RAM disk might help if you are writing - but measure the speed difference to see if it is worth it – user151019 – 2014-07-23T10:29:53.713

1@Mark recently I did heck lot of multi-stage diffing+file processing (hence the example), ram disk (and optimized write/read to disk) was a savior of time. Automated, general use, system won't reach performance of specialized one. Even with SSD difference in speed is huge. Additional advantage can be work time on battery, if you are just listening to music while browsing net, there is no need to spin up disk at all. But it all depends on what you are doing with it. – PTwr – 2014-07-23T10:42:01.780

7

@khajvah http://www.linuxatemyram.com/

– Dan is Fiddling by Firelight – 2014-07-23T17:49:33.433

can we need configure OS for us extra RAM as disk cache?? – AminM – 2014-07-23T20:13:07.000

Is it possible that having more free RAM would bring a CPU speed increase because the OS was less likely to engage in compacting or some other slow operation which gets triggered when a certain amount of memory is used> – jmite – 2014-07-23T21:16:23.770

2Kind of the exact opposite of swapping – Mark – 2014-07-25T05:14:23.190

This isn't an answer to the question (IMO) since the OS does not literally use all the free RAM to cache; I'm on a linux desktop right now with an uptime of 16 days and 7 GB of RAM available to the system (1 is committed to video). Including the current disk cache, I'm consuming ~2.6 GB according to free. So if the question is supposed to be about RAM that is not in use, it should mean not in use, not "actually used for caching". I'm pretty sure the answer to that is no -- right now my desktop would perform equally with 4, 8, or 16 GB (I do leave sticks out to save power, BTW). – goldilocks – 2014-07-25T12:47:22.630

1@goldilocks I suspect your situation is the exception, not the rule. I have only 623 MiB free out of 12 GiB, after 4 days of uptime. – Tavian Barnes – 2014-07-26T21:37:22.913

@TavianBarnes It's possibly toward one end of a spectrum. To be fair, I think the cache gets somewhat flushed when the system is hibernated, so that "16 days up" is misleading. However, this still illustrates the point, because it's about how fast the cache accumulates again -- which might be an indication of how useful it actually is. A system with 2 GB committed and 8 GB cached is unlikely to perform better than one with 2 GB committed and 2 GB cached, because most of that 8 GB is just accumulation by happenstance. I.e., the rewards of caching are not linear. – goldilocks – 2014-07-27T10:14:35.900

-1 because (as written) this answer is wrong. The question clearly states that memory use remains well below 8Gb. The system (as configured) is plainly not making use of the memory to speed up disk access. If the answer gave instructions on configuring the system to take advantage of the extra memory in this way (or even indicated that it would be necessary) then it would be correct. Not otherwise. – Dominic Cronin – 2014-07-27T12:39:36.643

1@DominicCronin That totally depends on how you measure "free" RAM. Many UIs don't display caches as "in use". – heinrich5991 – 2014-07-28T11:17:27.733

59

Since every operating system manages memory differently, and none was given, I will answer in the context of Windows 7.

Below is an example from a computer with 24GB of RAM. Even though only 7 GB is currently allocated as "In Use" memory, another 10 GB is allocated as "Standby" memory and contains data that may or may not be read again. If it is read, it will make your computer "faster". The "Free" memory is not being utilized whatsoever at the moment.

Resource Monitor

  • "Available" is Standby and Free memory. In other words, all the memory not currently required.
  • "Cached" is Standby and Modified memory. All the memory used for caching, with modified being the portion waiting to be written to disk before becoming standby.
  • "Total" memory is all memory except Hardware Reserved.

If you'd like to learn more about memory usage in Windows 7, TechRepublic has a great article.

Jason

Posted 2014-07-23T02:50:30.520

Reputation: 5 925

So what would happen if this computer, under this load, got another 8 GB added? I suspect "nothing," but I also suspect that a user with a heavier load or longer uptime will have much more cached. – None – 2014-07-25T21:00:30.563

3@JonofAllTrades I'd agree. One thing the article I linked doesn't talk about is SuperFetch (a default service in Windows 7). SuperFetch loads things into memory before they're accessed. It records usage patterns in a file and takes several restarts/days to fully optimize. – Jason – 2014-07-25T21:48:57.177

Does this also happen in Linux? – Casper – 2016-12-15T07:40:14.820

16

If the operating system is only using 4GB out of 8GB, it will run no differently to a machine using 4GB out of 16GB.

The ram that is unused has no impact on the performance of the machine.

However, the ideal situation is for the OS to use almost all available RAM. The OS and applications will request what they need, and the remaining ram should be used as cache - with a portion free perhaps to avoid swapping if an application needs more ram. Cache still counts as being "used" and will appear as being used in memory free tools.

Cache will take time to build up so you won't see this at boot. If after a while, the machine is still not using more that 4GB, then perhaps it is running a 32bit OS that cannot address more than 4GB (normally).

Paul

Posted 2014-07-23T02:50:30.520

Reputation: 52 173

4It depends on whether you consider disk cache as "used" RAM. The Linux free program reports it both ways, for example. – Wyzard – 2014-07-23T03:13:11.847

I think what the gui represents to a user and the actual situation can be different. RAM that is used for cache is used regardless of whether a userland tool hides that fact to the user. – Paul – 2014-07-24T22:15:49.150

"If after a while the machine is still not using more than 4GB..." -> Again, disk caching is great but it will not really fill up all your free RAM if you have lots of stuff that can be cached from disk -- it only caches what you've actually used and now are not, which probably does not amount to more than a couple of GB unless your normal activities include copious amounts of photoshop, etc. or the computer is a busy server with a lot of static files. – goldilocks – 2014-07-25T13:07:47.397

@goldilocks Obviously "after a while" is vague, but intends to mean "after such duration that Windows and apps have had cause to load enough data that would exceed 4GB". My usage is fairly routine and exceeds this routinely. The point being that if this limit is being hit, it may be addressing constraint rather than lack of need for more cache. – Paul – 2014-07-25T13:49:31.250

9

One other part to the equation is how the memory sticks are configured. Specifically, modernish motherboards support dual-channel memory which allows you to double the bandwidth between your motherboard and memory; if you had paired memory and you took out 1 of each pair, you've lost this and so your memory access when doing a lot of memory transfers will be diminished which should result in operations taking longer. (Contrariwise, if you happened to have 8 Gig's of faster memory paired with 8 Gigs of slower memory and were only using 8 Gigs, taking out the 8 gigs of slower and repairing the faster should allow you to run faster since you still get dual channel but not it doesn't need to slow down to the slowest memory)

But, in general, the caching stuff mentioned in other answers is going to be a bigger contributor to overall performance.

Foon

Posted 2014-07-23T02:50:30.520

Reputation: 231

3

Removing half of your 16GB of memory will slow your computer down.

This holds even if you never use close to 8GB of memory.

The software side of it is covered in other answers and boils down to the OS chosing to use RAM rather than disk.

However you might see a hardware driven hit to performance by halving the amount of RAM available. The reason is that RAM buses uses multi-channel architecture, meaning that the computer can transfer data between multiple RAM modules simultaneously.

Probably you computer is dual channel. In which case you can remove 2 out of 4 4GB RAM modules with no hardware mandated performance impact. However removing 1 out of 2 8GB RAM modules will impact performace.

If you have a quad channel RAM architecture you will see a performace hit even if your ram is 4GB modules.

Taemyr

Posted 2014-07-23T02:50:30.520

Reputation: 131

2

If the memory is ever maxed out or 99% you are going to lose speed because of the page file which sits on the hard disk. The hard disk can not even come close to the speed of RAM being that RAM is directly accessed by the cpu depending on bus speeds.

Windows uses about 3-4 GB idle of ram not counting other applications. I have been running 16 GB for years now and never actually needed more than 8gb. Realistically the avg PC users never uses more than 4-6 GB say for gaming. I have only seen it get close to 12 gb once when compressing a movie or doing something RAM intensive usually has to do with multimedia and multiple core CPU's would be the only way you would need more than 8gb. and yes it would run just as fast. IMO.

Idle after 1 Day uptime: enter image description here enter image description here

Idle after 2 Day Uptime: enter image description here enter image description here

The more RAM Windows has the more RAM it seems to use.

enter image description here

In terms of Windows 7 utilizing RAM to make certain process's faster here is an example.

enter image description here

Chkdsk maxing out RAM to speed up caching in turn speeds up performance and disk checking time so in this case more does in fact = faster...

MORBiD

Posted 2014-07-23T02:50:30.520

Reputation: 85

1Windows 7? Even with lots of stuff, I hardly go over 2G. – Simon Kuang – 2014-07-23T18:22:52.443

The more RAM Windows 7 has the more it will use... overtime it will fluctuate due to what programs you have opened and are currently open until services and applications release the memory it will fluctuate steadily.. with regard to the actual question. Will 8GB be as fast as 16GB yes and no depending on what you are using your computer for. Under normal circumstances you should need no more than 8GB and see no real performance loss if for common uses such as gaming or web browsing. – MORBiD – 2014-07-27T03:01:54.720

2

In practise the answer is more likely to be "NO" to the question as stated. The Q. says "(usage) never reaches 8 GB" and mentions "same type of memory" thus the most likely factor affecting speed (disk buffering) wont be affected. A common practical example is database servers with enough memory to buffer the complete hard disk - eg with 4GB of files and 2GB of process/system allocated memory doesn’t benefit from more than 8GB of memory.

Exceptions:

More memory can slow Hibernation - on my system with 32GB of memory and SSD disk a cold boot is significantly faster than awakening it from hibernation as it saves the whole 32GB on hibernation, but a cold boot requires much less to be read. Reducing memory would speed the system.

It Would be faster if you accessed more of the hard disk and most people have more disk usage than memory left over for buffering, so extra memory helps. Also many O/S report only part of the usage as "usage" and the rest is counted as buffering not "usage". (Linux reports usage both inclusive and exclusive of buffering).

Memory channels affect performance: [If removing memory means you reduce the number of memory channels in use then the system would slow down as Foon correctly pointed out]

[edit:] David Schwartz commented that lowering memory reduces the limits for private, modifiable memory mappings under windows. Windows apparently limits the total of these reservations to the total of memory plus swap so you can run out of this resource even though there is "free memory" reported (since real memory/swap is not allocated till a page is accessed, it is not counted as memory usage). Linux behaves differently - each process can allocate up to the the total of memory and swap size, and the total over all processes can exceed the total of memory plus swap.

iheggie

Posted 2014-07-23T02:50:30.520

Reputation: 137

1You basically just assert that "no" is the correct answer but don't say why. – David Schwartz – 2014-07-26T20:34:47.843

This was in response to the accepted answer - I don't have the rep points to comment on it directly - sorry for the confusion. To clarify, in case it wasn't obvious, you only use as much memory for hard disk buffering as is actually read or written - if there just isn't that much disk usage, or it is never accessed, then extra memory doesn't make a difference. – iheggie – 2014-07-27T00:14:55.450

1The example I gave of the database server is an example where extra memory makes little difference - all of the disk in usage gets buffered. – iheggie – 2014-07-27T00:21:15.187

What about the fact that more RAM means more backing store which may permit the OS to allow allocations it would otherwise refuse? – David Schwartz – 2014-07-27T06:36:26.303

In my example of the DB server - no difference at all since it would never refuse an allocation because of lack of free memory. What allocation would the O/S refuse if a. all the processes where in memory, b. the whole disk was already buffered in memory, c. it had free memory and d. some other limit wasn't exceeded (eg max process/buffer/addressable size limits)? – iheggie – 2014-08-01T02:32:33.960

I think you misunderstand the original question. It's not "is there some way a computer can have more RAM, not use it, and have that have no effect on its performance". It's "is there some way a computer can have more RAM, not use it, and have that affect its performance". – David Schwartz – 2014-08-01T03:28:00.470

I don't read the question as either of your alternatives - his first question uses FASTER (ie greater speed). – iheggie – 2014-08-01T03:52:12.137

Thanks for your comment - I clarified my answer, I don't read the question as either of your alternatives - his first question uses FASTER (ie greater speed), the 2nd is like your first. – iheggie – 2014-08-01T03:58:20.530

Your answer is still wrong because it ignores many possible ways the computer could be faster. For example, with less RAM, it might refuse private, modifiable memory mappings that it could allow if it had more RAM. This might cause the program to read using file descriptors rather than read from a mapping, which can be slower. (This is true even if the mappings aren't using very much memory. Memory is still reserved for them. Many databases work this way.) – David Schwartz – 2014-08-01T04:05:12.090

I am curious What you feel I ignored? In the original question usage was counted with the higher memory allocation, so those mappings would be classified and counted as "used memory". In the database example, are you saying that a database manager would use more than 6GB to map 4GB of files into memory? (Would a DB mamanger use MAP_PRIVATE flag?) - added comment to answer – iheggie – 2014-08-01T20:47:12.787

A mapping is not counted as used memory until it uses memory, which it may never do. For example, a large mapping may be permitted, reserving lots of memory that's never used. Then a small mapping that would have been heavily used could be refused because the needed memory has already been reserved. – David Schwartz – 2014-08-01T20:50:49.547

0

Memory fragmentation is another reason to have extra memory. If you have 8GB of RAM, and you tend to keeo it 80% utilized, particularly in modern use cases (with lots of memory swapping, such as from opening and closing browser tabs) you will eventually get significant fragmentation.

Adding the extra 8GB of RAM makes it more likely that the OS will find contiguous spaces of memory available, meaning less frequent reboots are necessary to avoid performance degradation.

Joe

Posted 2014-07-23T02:50:30.520

Reputation: 242

My understanding is that memory fragmentation is something that can occur within the memory space of a process, which is virtual on typical modern systems, and that it doesn't apply to the system in general. Since physical memory is divided into pages, which are mapped individually into the virtual memory spaces of the processes, fragmentation would be a menaningless concept. Please correct me if I have misuunderstood something. – Thomas Padron-McCarthy – 2014-07-26T06:26:42.353

0

Possibly, but not necessarily. Among other things, one of the things RAM allows a computer to do is permit application to allocate memory that they may never use. If the system doesn't have enough backing store (which includes RAM) to permit every allocation it has issued so far to consume as much memory is it possibly could, the operating system will either have to refuse those allocations or overcommit. Some operating systems never overcommit and pretty much all modern operating systems limit the amount of overcommittment they permit.

So memory that's not in use can improve performance by allowing operations that might potentially require RAM to succeed where otherwise they would fail.

David Schwartz

Posted 2014-07-23T02:50:30.520

Reputation: 58 310

-1

More ram doesn't speed up the computer. Less ram "slows" down the computer.

Computers have their physical maximum speed(this includes overclocking too) and nothing can make them faster than that.

Xtro

Posted 2014-07-23T02:50:30.520

Reputation: 281

3As shown in Wyzard's answer, the "computer" as a whole, includes disk access, where more ram alows more caching and therefore speeds it up. – please delete me – 2014-07-23T15:23:33.273

Do you mean that we can increase the physical speed limit of a computer by adding terabytes of ram on it ? – Xtro – 2014-07-23T15:29:37.453

Taking hard drives into account, yes. – please delete me – 2014-07-23T15:57:21.860

BTW, less RAM does not always slow down the computer either. The L3 cache many times slowed the computer because of cache misses. – please delete me – 2014-07-23T15:59:21.517

Do you have a reference for your assertion that the L3 cache has slowed down a computer, many times? – Mark Sowul – 2014-07-23T19:28:44.583

@MarkSowul I looked quickly, and did not find it. I remember either people talking about it or reading about it around 20 years ago when i was building a computer. – please delete me – 2014-07-24T00:12:48.590

@"Taking hard drives into account, yes": You can't assume the only purpose of ram is to buffer the hard drives. If you assume this, you should call it as hard drive buffer instead of ram.

In the normal use of ram, its huge size can never increase the physical computation power of the computer/cpu/circuits. They are gonna work as fast as the clock limit and the huge amount of ram will be waiting for the cpu most of the time. At that point, even if you double the ram, it can't do anything on computer's speed.

Repeat : RAM's only purpose is not buffering the hard drives. – Xtro – 2014-07-24T15:17:40.080

2I find your answer tautological. Yes, the 'maximum speed limit' of the CPU is the CPU's maximum speed. Good show. However, from a practical standpoint, compared to a PC with only sufficient RAM, a PC with excess RAM will perform somewhat faster. – Joe – 2014-07-26T03:35:31.700

And why is that ? :) – Xtro – 2014-07-27T18:20:36.147

"...increase the physical speed limit of a computer by adding terabytes of ram on it?" That's usually called "switching to SSDs", these days. Of course SSDs are still orders of magnitude slower than RAM, but they are also orders of magnitude faster (by some measurements, for example I/O operations per second (IOPS)) than rotational hard disks, and that can give the system a very noticable performance boost in actual use (which is what we are usually concerned with). – a CVn – 2014-08-01T21:11:07.620

We are talking about RAMs here. Any type of disc is out of discussion. – Xtro – 2014-08-03T03:13:02.537