Questions Parallel Programming Shared memory performance issues ITCS

  • Slides: 9
Download presentation
Questions Parallel Programming Shared memory performance issues ITCS 4/5145 Parallel Programming, UNC-Charlotte, B. Wilkinson,

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

Both locks and semaphores can be used to control access to critical sections. Name

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. ) a) b) c) d) e) . . None of the other answers.

Use Bernstein’s conditions to determine whether the sequence can be executed in parallel: a

Use Bernstein’s conditions to determine whether the sequence can be executed in parallel: a y a x = = b + c; 3; 3; y + z: Clearly show 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

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++) a[i] = a[i+3]; always produce the same results. Clearly show 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

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. a) b) c) d) e) . . None of the other answers.

Bernstein’s conditions are sufficient but not necessary conditions (in the mathematical sense) to establish

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

How many conditions need to be tested to determine whether 4 statement can be executed in parallel according to Bernstein’s conditions? a) b) c) d) e) . . None of the other answers.

Why does false sharing reduce performance of shared memory programs? (This question is not

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

Explain the potential false sharing effect in the following code main { int x,

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.