More Related Content More from Fuenteovejuna (20) How to use many core CPUs, Константин Серебряный2. Threads
✔ Hard to program:
✔ Correctness
✔ Performance
✔ Unavoidable: 8 or 16 cores is commodity
✔ Alternatives:
✔ Message passing – slow
✔ Shared memory – even harder, usually no benefits
3. Correctness
✔ Deadlocks
✔ C++: custom Mutex w/ builtin deadlock detector
✔ C++: static analysis (gcc plugin, opensourse)
✔ Java: run-time detector
✔ Races
✔ C++: run-time detector: ThreadSanitizer (Valgrind)
✔ Linux, Windows, Mac; opensource
✔ Java: ThreadSanitizer (beta)
4. Performance
✔ Contension (threads compete for shared resource)
✔ Custom Mutex w/ contention profiling and web interface
✔ Cache locality (no ping-ponging between threads)
✔ Custom malloc (TCMalloc, opensource)
✔ Profiling: mostly PMU-based
✔ Oprofile, perfmon, google perf tools (opensource)