
Pattern: Task Parallelism 227
FIGURE 10.3: Mandelbrot set split into tiles for task parallel implemen-
tation.
provided by Cilk (described in Appendix C) can be used to implement the
second option.
With this established, we can write a function doTile as shown in List-
ing 10.6 to process tiles on our workers.
This function is given the coordinates of the corners U = a + bi and L =
c + di. It is also given the indices of the region of the image array into which
it is to store these values bounded by (ux, uy) and (lx, ly). Using these, it
computes the dx and dy values and loops over the region of the image it is
responsible for setting the pixels to the ...