0

I'm mining some Monero on my raspberry pi (Of course only for educational purposes). In order to increase my hashrate I'd like to increase my CPU cache. I already searched SE but haven't found a solution/tutorial so far...

The GPU performance is not important to me...

Do you know how to increase my CPU cache?

Any help would be very appreciated!! Thanks in advance!

fipsi
  • 216
  • 3
  • 9

2 Answers2

3

You cannot change the size of the cache; the CPU cache is built-in to the system on a chip (SoC) and replacing it manually is, for all intents and purposes, impossible.

It might be worth taking a look at this explanation of the CPU cache for some background context, but essentially the cache is a very small storage area near the CPU itself to store data as needed. The SoC is not designed to be modified by the user, and it will be inevitably be broken if you take it apart.

No modern computer really allows you to replace the CPU hardware cache, but the Pi is particularly difficult in this regard (you cannot even add/remove RAM).

If you need greater performance, you should probably invest in hardware designed for cryptocurrency mining (often these are high-end GPUs rather than inefficient Raspberry Pis).

Aurora0001
  • 6,357
  • 3
  • 25
  • 39
2

CPU cache

The CPU caches are built into the CPU. You can not upgrade it.

  • Level 1: 16kB instruction, 16kB Data.
  • Level 2: 512kB shared.
  • Level 3: None (some architectures have this external)

Other caches

There are other caches

Disk/ssd cache.

  • The drive will have some sort of built in cache. You don't care about this, only what its spec is.
  • The OS will implement a disk cache using RAM. It usually knows what is best, so leave it alone. The only time I have had to mess with it. Is when copying large files, I tell it to not cache, as I am not going to read the files any time soon. You can do this by doing nocache command …. There are also kernel parameters that you can tune, but you better know how to measure your changes, or you will probably make it worse.

Network cache.

  • The OS will use disk/ssd to cache web access.
  • You can cache dns lookup, but not installed by default.

What is cpu cache

A program will run from RAM, however RAM is slower than the CPU. Therefore a cache is added. It is the same speed as the CPU. It remembers recent RAM accesses and will give the CPU the data quicker that the RAM can. Because the cache is expensive, it is small. Therefore the cache will forget stuff, when it does, the CPU has to get the data from the RAM (this is slower). Everything in cache is a copy of what is in RAM. The caches job is to make RAM seem faster. It succeeds most of the time (≈80%), because in most programs the same data is access more than once, and usually clustered in time and space.

A note on swap

Cache is NOT swap. It is very different. (Modern OSs use paging, not swap. However the differences are inconsequential for the purpose of this discussion.)

While RAM is slower than cache and the CPU. It is faster than SSD and Disk. And while RAM is much bigger than cache, it is much smaller than SSD and Disk.

It get around the smallness of RAM, the OS will swap/page the content of parts of the RAM into the swap area of disk. Now that the disk knows the content, it can be erased from RAM, and this bit of RAM used for something else.

Key differences between cache and swap/paging

  • Cache is smaller that the thing it is caching, a cache is used to allow faster running. A CPU cache makes RAM appear faster (It does not make the RAM appear smaller).
  • Swap/paging is slow, it is used to make RAM appear bigger (but slower, but not by much, if the data is not being swapped in and out, and in and out and …).
ctrl-alt-delor
  • 255
  • 1
  • 11