Presentation is loading. Please wait.

Presentation is loading. Please wait.

Questions Parallel Programming Shared memory performance issues

Similar presentations


Presentation on theme: "Questions Parallel Programming Shared memory performance issues"— Presentation transcript:

1 Questions Parallel Programming Shared memory performance issues
ITCS 4/5145 Parallel Programming, UNC-Charlotte, B. Wilkinson, 2013, QuizQuestions8d.ppt Oct 8, 2013

2 Both locks and semaphores can be used to control access to critical sections. Name one additional feature provided with semaphores? (More than one acceptable answer.) . None of the other answers.

3 Use Bernstein’s conditions to determine whether the sequence can be executed in parallel: a = b + c; y = 3; a = 3; x = y + z: Clearly show how you got your answer. (No marks for just yes or no!)

4 Use Bernstein’s conditions to determine whether the two code sequences: forall (i = 0 i < 4; i++) a[i] = a[i+3]; for (i = 0 i < 4; i++) always produce the same results. Clearly show how you got your answer. (No marks for just yes or no!)

5 How many threads could be used for the computation below, each thread executing one or more of the instructions: x++ ; a = x + 2; b = a + 3; c++; without changing the code. Explain clearly your answer. . None of the other answers.

6 Bernstein’s conditions are sufficient but not necessary conditions (in the mathematical sense) to establish whether statements can be executed in parallel. Devise a sequence of two statements that fails Bernstein’s conditions but still can be executed in parallel or in any order?

7 How many conditions need to be tested to determine whether 4 statement can be executed in parallel according to Bernstein’s conditions? . None of the other answers.

8 Why does false sharing reduce performance of shared memory programs
Why does false sharing reduce performance of shared memory programs? (This question is not asking what is false sharing.) . It doesn’t. None of the other answers.

9 Explain the potential false sharing effect in the following code
main { int x,y; ... #pragma omp parallel (shared x,y) { tid = omp_get_thread_num(); if (tid == 0) x++; if (tid == 1) y++; } Suggest how could false sharing be prevented in this code.


Download ppt "Questions Parallel Programming Shared memory performance issues"

Similar presentations


Ads by Google