
Chapter 3
Principles of Parallel Loop
Scheduling
Many applications of parallel programming, both in R and in general, in-
volve the parallelization of for loops. As will be explained shortly, this at
first would seem to be a very easily programmed class of applications, but
there can be serious performance issues.
First, though, let’s define the class under consideration. Throughout this
chapter, it will be assumed that the iterations of a loop are independent of
each other, meaning that the execution of one iteration does not use the
results of a previous one.
Here is an example of code that does not satisfy this condition:
t o t a l <− 0
for ( i i n 1