Skip to content
Snippets Groups Projects
Commit 33c79a9e authored by ylvse560's avatar ylvse560
Browse files

Lab 2 questions

parent 039ecb55
Branches
No related tags found
No related merge requests found
......@@ -24,8 +24,15 @@ with shared (critical section) or distributed work pool.
## Lab 2
### Explain how CAS can implement a safe data structure sharing between several threads.
Each thread must check that the data it wants to change has not been changed since the thread read the data. Therefore, the thread will not change the data with old data.
### Explain the scenario raising the ABA problem you have implemented.
There are three threads and a shared stack with two elements. First, thread 0 pops an element but is not finished before thread 1 pops an element and thread 2 pops an element. Then, when thread 1 and 2 have finished their pops, thread 0 resumes with its pops. It succeeds in the CAS check as the pointers are OK - but the next pointer in the element is pointing to a free node!
### Show, compare and comment the performance of both lock-based and hardware CAS-based concurrent stacks, as a function of number of threads.
## Lab 3
#### Question 1.1: Why does SkePU have a "fused" MapReduce when there already are separate Map and Reduce skeletons? Hint: Think about memory access patterns.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment