Questions Parallel Programming Shared memory performance issues ITCS 4/5145 Parallel Programming, UNC-Charlotte, B. Wilkinson, 2013, QuizQuestions8d.ppt Oct 8, 2013
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.
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!)
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!)
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.
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?
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.
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.
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.