threading

Answer tucked away in Changelogs…

The answer to my question about Thread Building Blocks’ usefulness for non-algorithmic parallelization (i.e., in a word, threading ;) was tucked away in a Change Log (it seems that TBB could use a little work on its documentation revision, and the book predates the change).

http://software.intel.com/en-us/blogs/2009/08/05/transitioning-from-intel-tbb-21-to-22/

ISO C++ thread class – A thin portable wrapper around OS threads. It’s a close approximation of the ISO C++ 200x class thread (Section 30.2 of http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2691.pdf). Now TBB lets you choose which is best, task-based versus thread-based, for your situation. Threads are typically better than tasks when the “work” is really more waiting than computation, such as for:

  • GUI, I/O or network interface threads.
  • Threads that need to wait on external events.
  • Programs that previously needed to use both native threads and Intel® TBB tasks.

Well, at least now I have a more immediately useful pet-project to work on: writing a generic encapsulation of a resource-sharing and resource-specific worker pool. Resource-sharing: a shared pool of resources which the workers variously use – which they use is indefinite i.e. a resource; Resource-specific: a pool that will handle specific actions for specific resources, i.e. this specific resource.

Resource-sharing: Write this data to any database handle in the pool; Resource-specific: Someone write this data to connection #42.

OpenMP joy from Visual Studio :)

An update from my earlier post, I got a reply to my OpenMP 3.0 ticket, for those of you who don’t have a Windows Live account:

Hopefully that means it’ll be in VS 2010 by release time. Superb.

<3 Visual Studio, yet again :)

Going Parallel

I’ve been looking at OpenMP and Thread Building Blocks. I’ve actually managed to OpenMP one part of the client (which seemed to reduce the “chug” as you move at high speed between large areas of terrain, but didn’t otherwise impact performance, maybe at spawning, I dunno), and a few parts of the cell host (I reorganized the order in which the host prepares vehicles for their world update; the initial part of which is quite thread-safe, and boils down to a simple culling algorithm; on the live servers that should significantly reduce the time the world update dispatch takes, meaning that the data sent to clients is “fresh”er by 5-10 ms under busy load).

My initial understanding of both systems was fairly hazy – I’m trying to run before I can walk, but then the documentation for both starts at a sprint.

The worst mistake I made was misunderstanding their focus: which is algorithmic parallelization.