Parallelizing a loop