7. Suppose we want to sum 100,000 numbers on a single-bus multiprocessor
computer. Let's assume we have 10 processors. The first step would be to split the set of
numbers into subsets of the same size. All processors start the program by running the
following loop that sums their subset of numbers, where Pn is its processor index (0~9):
sum/Pn] = 0;
for (I = 10000 * Pn;I <10000*(Pn+1);I=I+1)
sum(Pn] = sum[Pn] + Al]; / sum the assigned areas
The next step is to add these many partial sums, so we divide to conquer. Half of
processors add pairs of partial sums, then a quarter add pairs of the new partial sums,
and so on until we have the single, final sum. We want each processor to have its own
version of loop counter variable I, so we must indicate that it is a "private" variable.
In this problem, the two processors must synchronize before the "consumer" processor
tries to read the result from the memory location written by the "producer" processor,
otherwise, the consumer may read the old value of the data. Here is the code (halfis also
a private variable):

Question: according to the algorithm, find out what operations are executed by the
designated processor during the designated repeat-loop iteration. (Ex: NOP or sum[0] =
sum[0] + sum [4]). Copy Table 7 to your answer sheet and fill in the answers.
