What’s false sharing and how to solve it (using Golang as example)

Figure 1
Figure 2
figure 3
figure 4
  1. Make sure the size of cache line in the CPU in your system: this is relative to the size of cache padding you use.
  2. Padding more variables mean you consume more memory resource. Running benchmark with your scenario and make sure what you pay is worthful.

--

--

I am Genchi, a backend engineer in Taiwan.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Genchi Lu

Genchi Lu

I am Genchi, a backend engineer in Taiwan.