Parallel programming - a task-based approach

With the increasing availability of the multicore processors, there is a natural need to make use of the new computing resources. There are two very different modes of how we can handle this situation - with both ways being architecturally different:

The following part concentrate on the task-based approach, that has some similarities with real-life things, such as:

Why are these similarities important? Because sociological studies pointed out that the best overall performance is achieved only if the previous conditions are true. This is why you have to draw a number if you go to a bank or a service, and this is why the cash-desks are so unreliable and always make you think you have taken the wrong lane (the customers decide which one they choose).

A good task-based parallelism does the same: it sorts the incoming tasks in a waiting queue, and forward the tasks in this order to the free execution threads. If a task comes in and there is no free thread (processor), it waits in the queue until one of them finishes.

Advantages:

Disadvantages, things to consider:

The stuff is implemented in the TTaskDispatcher class.


Attila NAGY Last updated: 2018-08-30