YuNing's Thought

Home

❯

Notes

❯

True Sharing

True Sharing

Dec 30, 20251 min read

True sharing occurs when two different processors access the same variable.

unsigned int sum;  
{
	// parallel section
	for (int i = 0; i < N; i++)  
		sum += a[i]; // sum is shared between all threads
}

Fix

  • atomic
  • Thread Local Storage

Links

  • ThreadSanitizer — Clang 20.0.0git documentation
  • False Sharing

Graph View

  • Fix
  • Links

Backlinks

  • Performance Share
  • False Sharing

Created with Quartz v4.5.2 © 2025

  • GitHub
  • Discord Community