Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaling multithreaded applications on multicored machines

I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm finding that we need to rethink how we do things to scale to that many cores in a shared memory model. For example the standard memory allocator isn't good enough.

What resources would people recommend?

So far I've found Sutter's column Dr. Dobbs to be a good start. I just got The Art of Multiprocessor Programming and The O'Reilly book on Intel Threading Building Blocks

like image 703
Matt Price Avatar asked Aug 09 '08 15:08

Matt Price


3 Answers

A couple of other books that are going to be helpful are:

  • Synchronization Algorithms and Concurrent Programming
  • Patterns for Parallel Programming
  • Communicating Sequential Processes by C. A. R. Hoare (a classic, free PDF at that link)

Also, consider relying less on sharing state between concurrent processes. You'll scale much, much better if you can avoid it because you'll be able to parcel out independent units of work without having to do as much synchronization between them.

Even if you need to share some state, see if you can partition the shared state from the actual processing. That will let you do as much of the processing in parallel, independently from the integration of the completed units of work back into the shared state. Obviously this doesn't work if you have dependencies among units of work, but it's worth investigating instead of just assuming that the state is always going to be shared.

like image 73
Chris Hanson Avatar answered Oct 04 '22 04:10

Chris Hanson


You might want to check out Google's Performance Tools. They've released their version of malloc they use for multi-threaded applications. It also includes a nice set of profiling tools.

like image 27
John Downey Avatar answered Oct 04 '22 03:10

John Downey


Jeffrey Richter is into threading a lot. He has a few chapters on threading in his books and check out his blog:

http://www.wintellect.com/cs/blogs/jeffreyr/default.aspx.

like image 31
axk Avatar answered Oct 04 '22 04:10

axk