Monday 15 July 2013

multithreading - threads accessing same cache line -



multithreading - threads accessing same cache line -

i came across suggestion threads not access same cache lines , cant understand why, while doing search on topic came around questions: multiple threads , cpu cache 1 of answers suggested:

you want avoid 2 threads simultaneously trying access info located on same cache line

the way see it, cache stores pages of memory quick access process, , says here:http://en.wikipedia.org/wiki/thread_%28computing%29#how_threads_differ_from_processes

threads share address space

it shouldn't problem 2 threads access same cache line since if page in cache , thread trying access memory cache nail regardless of other thread.

i heard argument avoiding threads accessing same cache line on several different occasions cant myth. missing here?

in (probably don't have exhaustive hardware knowledge) multicore cpus, cache lock accessed line when 1 core tries write corresponding memory. other cores trying access same cache line held in wait.

you can share same info among threads long it's read (or infrequently updated), if maintain writing it, hidden access serialization yield performances equivalent running threads on same core (actually bit worse due cache locking delays).

multithreading caching operating-system

No comments:

Post a Comment