1

I am making some benchmark tests and I use "truebench". This is a simple C program which just do a memset and a memcpy several times. On my laptop, when I launch only one instance I obtain 62s but when I launch 4 times (such that the 4 processes are running in the same time : all in background), I obtain 303s for each instances. My laptop has 8 cores, I did not expect it took so much time in the 4 instances case, I was expected to obtain a similar performance. Do you have an idea why such a difference ? Thank you for help. LMM.

2 Answers 2

0

Although you have a large number of cores, they cannot work in total parallelism, because other elements of the computer are not duplicated.

For example, take the RAM memory: if you have N sticks of RAM which are dual-channel, only 2xN accesses can be done in parallel. If the RAM is single channel, this number drops to N accesses.

On the other hand, the operating system does no optimization of where requested memory is allocated, and does not try to distribute memory allocations evenly among all RAM sticks. So if all allocations are done on the same single-channel RAM stick, only one access can be done at a time and all the processes are in effect serialized.

The same can be said for the CPU cache, where the situation is even worse, since it is much smaller than the RAM, so one process will swap out the data of others, in effect causing contention. (I gloss over here the differences between levels I and II of the CPU cache.)

You give no information about the total amount of memory you are trying to allocate. If that exceeds the amount of available RAM, you would add to the equation disk swaps back and forth, which would have a serious impact on performance.

4
  • Hi, I agree with you. does it mean that the more you have RAM stick the less you suffer from contention ? This implies that you would rather use small size RAM sticks ! Apr 28, 2019 at 21:36
  • That's true - the more channels you have, the more parallelism, up to the limits of the memory controller.
    – harrymc
    Apr 28, 2019 at 21:45
  • This problem shall appear in servers, indeed, most of servers have more than 32G of RAM and many cores, how many channels do they have to avoid this kind of problem ? Apr 28, 2019 at 22:28
  • Depends on the hardware. I have heard about quadruple-channel RAM for large servers, and also one RAM stick may consist of several chips with separate channels. The bottlenecks involved in one-computer architecture are the reason for the rise of multi-computer server networks.
    – harrymc
    Apr 29, 2019 at 6:16
0

CPUs use caching to speed up memory access. Your benchmark program probably accesses memory randomly (or allocates more), so the CPU is constantly waiting for memory fetches. It seems like one running instance already saturates the available RAM bandwidth, so four only cause more contention.

1
  • You are probably right, the number of concurrent requests for RAM read/write causes a bottleneck. Thank you for your response. Apr 28, 2019 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .