Task Parallelism
Task parallelism is a wide category that encompass a lot of different applications and is often used to describe everything that is not data parallelism. However, OPL (and the parallel patterns book) define it somewhat narrower by excluding more specialized "task parallelism" such as pipelines, discrete events and divide-and-conquer/recursive splitting.
This pattern was pretty well fleshed out with many interesting observations, but I missed a code example. I also found it a bit confusing that the solution section spent much more time describing value-at-risk, speech recognition and the cost of various operations on various architectures than it spent discussing how to find and exploit task parallelism in these problems. I also wonder why the value-at-risk example are split between the solution section and the examples section? Should perhaps the solution section talk about task parallelism in general terms (discussing issues such as embarrassingly parallel task parallelism, synchronization/communication (and how to reduce it), load balancing and how to find task parallelism) and leave the examples for the examples section?
Discrete Event Pattern
I like this pattern a lot. It does a good job of explaining the problem and discuss several important aspects of the solution such as event ordering and deadlocks. It is also the pattern on which Apple's Grand Central is based and is very important in the world of desktop GUI application development. Grand Central is a system for generating tasks that are then placed in task queues. These queues are then processed by different processors and the tasks can generate new tasks and put them in other queue. The tasks therefore work a lot like events and allows the GUI thread to offload work to other processors and it lets these processors place tasks/events back in the GUI thread's task pool. The latter is what makes this an event-based framework as opposed to a task based framework and is very powerful as it allows the application state and GUI widgets to be updated by the GUI thread thereby avoiding mutual exclusion. I particularly love one GC example where a task is generated by the GUI thread to perform some statistical computations on a document (which could potentially be expensive). When these computations are done the task will then place an event/task to update the application state/GUI with the statistics it gathered in the GUI thread's task queue, which is a beautiful solution.
The only thing I missed was a good code example, perhaps implementing the standard thread-based event queues with a switch statement to decide the action that are often used.
Recursive Splitting
This was a very well written pattern with tons of examples using different programming models. It also does a good job of describing the strengths of recursive splitting which is lies in its flexibility to create many tasks and I thought it was very interesting how they contrast it to geometric decomposition.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment