Pipelining (Task and Data Parallelism Together)
Pure task parallelism is harder to find than pure data parallelism. Often, when you find task parallelism, it’s a special kind referred to as pipelining. In this kind of algorithm, many independent tasks need to be applied to a stream of data. Each item is processed by stages as they pass through, as shown by the letter A in Figure 2-3. A stream of data can be processed more quickly if you use a pipeline because different items can pass through different stages at the same time, as shown in Figure 2-4. A pipeline can also be more sophisticated than other processes: it can reroute data or skip steps for chosen items. Automobile assembly lines are good examples of pipe-lines; materials flow through a pipeline and get a little work done at each step (Figure 2-4).
Figure 2-3. Pipeline
Figure 2-4. A pipeline in action with data flowing through it