阿摩線上測驗 登入

申論題資訊

試卷:101年 - 101 國立中山大學_碩士班招生考試_資工系(甲、乙組):計算機結構#105905
科目:中山◆資工◆計算機結構
年份:101年
排序:0

申論題內容

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):
61ea16b746ea5.jpg
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.
61ea16d05c7af.jpg