Friday, June 20, 2014

Scalable Designs for Multicore


I put together this presentation on how to design software that scales on multicores.
It uses examples in Java, yet the basic learning is same in all languages. (In fact, I learned it in C++).
(Original video on YouTube is: https://www.youtube.com/watch?v=op2Fh-iiKoA ).

Here's the summaries:

Basic multicore scalability (in Java)

  • Parallelize with threads and thread pools
  • Use enough threads (but not too many)
  • Thread pools assure execution on multiple cores
  • Keep same objects on same cores (as much as possible)
  • Avoid having multiple tasks working on the same data
  • Avoid locks (ex. attribute synchronized)
  • Avoid cache line contention

Patterns to manage lock conflicts

  1. Structured parallelism
  2. Non-blocking data structures
  3. Immutable or purely functional data structures

Patterns to manage core affinity

  1. Tasks last as long as program
  2. Tasks last as long as service they implement
  3. Tasks are dynamically extended

All original content copyright James Litsios, 2014.

No comments: