Multiprocessor Synchronization

Barrier Synchronization
Companion slides for
The Art of Multiprocessor
Programming
by Maurice Herlihy & Nir Shavit
Simple Video Game
• Prepare frame for display
– By graphics coprocessor
• “soft real-time” application
– Need at least 35 frames/second
– OK to mess up rarely
Art of Multiprocessor
Programming
2
Simple Video Game
while (true) {
frame.prepare();
frame.display();
}
Art of Multiprocessor
Programming
3
Simple Video Game
while (true) {
frame.prepare();
frame.display();
}
• What about overlapping work?
– 1st thread displays frame
– 2nd prepares next frame
Art of Multiprocessor
Programming
4
Two-Phase Rendering
while (true) {
if (phase) {
frame[0].display();
} else {
frame[1].display();
}
phase = !phase;
}
while (true) {
if (phase) {
frame[1].prepare();
} else {
frame[0].prepare();
}
phase = !phase;
}
Art of Multiprocessor
Programming
5
Two-Phase Rendering
while (true) {
if (phase) {
frame[0].display();
} else {
frame[1].display();
}
phase = !phase;
}
while (true) {
if (phase) {
frame[1].prepare();
} else {
frame[0].prepare();
}
phase = !phase;
}
Even phases
Art of Multiprocessor
Programming
6
Two-Phase Rendering
while (true) {
if (phase) {
frame[0].display();
} else {
frame[1].display();
}
phase = !phase;
}
while (true) {
if (phase) {
frame[1].prepare();
} else {
frame[0].prepare();
}
phase = !phase;
}
odd phases
Art of Multiprocessor
Programming
7
Synchronization Problems
• How do threads stay in phase?
• Too early?
– “we render no frame before its time”
• Too late?
– Recycle memory before frame is
displayed
Art of Multiprocessor
Programming
8
Ideal Parallel Computation
0
0
0
1
1
1
Art of Multiprocessor
Programming
9
Ideal Parallel Computation
2
2
2
1
1
1
Art of Multiprocessor
Programming
10
Real-Life Parallel Computation
0
0
0 zzz…
Art of Multiprocessor
Programming
1
1
11
Real-Life Parallel Computation
2
0
zzz… 1
1
Uh, oh
Art of Multiprocessor
Programming
12
Barrier Synchronization
0
0
barrier
0
Art of Multiprocessor
Programming
13
Barrier Synchronization
barrier
1
1
1
Art of Multiprocessor
Programming
14
Barrier Synchronization
barrier
Until every
thread has
left here
No thread
enters here
Art of Multiprocessor
Programming
15
Why Do We Care?
• Mostly of interest to
– Scientific & numeric computation
• Elsewhere
– Garbage collection
– Less common in systems programming
– Still important topic
Art of Multiprocessor
Programming
16
Duality
• Dual to mutual exclusion
– Include others, not exclude them
• Same implementation issues
– Interaction with caches …
• Invalidation?
• Local spinning?
Art of Multiprocessor
Programming
17
Example: Parallel Prefix
a
after
b
c
a
d
a+b
Art of Multiprocessor
Programming
before
a+b+c
a+b+c
+d
18
Parallel Prefix
One thread
Per entry
a
b
Art of Multiprocessor
Programming
c
d
19
Parallel Prefix: Phase 1
a
b
c
a
d
a+b
Art of Multiprocessor
Programming
b+c
c+d
20
Parallel Prefix: Phase 2
a
b
c
a
d
a+b
Art of Multiprocessor
Programming
a+b+c
a+b+c
+d
21
Parallel Prefix
• N threads can compute
– Parallel prefix
– Of N entries
– In log2 N rounds
• What if system is asynchronous?
– Why we need barriers
Art of Multiprocessor
Programming
22
Prefix
class Prefix extends Thread {
private int[] a;
private int i;
private Barrier b;
public Prefix(int[] a,
Barrier b, int i) {
a = a;
b = b;
i = i;
}
Art of Multiprocessor
Programming
23
Prefix
class Prefix extends Thread {
private int[] a;
private int i;
private Barrier b;
public Prefix(int[] a,
Barrier b, int i) {
a = a;
Array of input
b = b;
values
i = i;
}
Art of Multiprocessor
Programming
24
Prefix
class Prefix extends Thread {
private int[] a;
private int i;
private Barrier b;
public Prefix(int[] a,
Barrier b, int i) {
a = a;
Thread index
b = b;
i = i;
}
Art of Multiprocessor
Programming
25
Prefix
class Prefix extends Thread {
private int[] a;
private int i;
private Barrier b;
public Prefix(int[] a,
Barrier b, int i) {
a = a;
Shared barrier
b = b;
i = i;
}
Art of Multiprocessor
Programming
26
Prefix
class Prefix extends Thread {
private int[] a;
private int i;
Initialize fields
private Barrier b;
public Prefix(int[] a,
Barrier b, int i) {
a = a;
b = b;
i = i;
}
Art of Multiprocessor
Programming
27
Where Do the Barriers Go?
public void run() {
int d = 1, sum = 0;
while (d < N) {
if (i >= d)
sum = a[i-d];
if (i >= d)
a[i] += sum;
d = d * 2;
}}}
Art of Multiprocessor
Programming
28
Where Do the Barriers Go?
public void run() {
int d = 1, sum = 0;
while (d < N) {
if (i >= d)
sum = a[i-d];
b.await();
if (i >= d)
a[i] += sum;
d = d * 2;
}}}
Art of Multiprocessor
Programming
29
Where Do the Barriers Go?
public void run() {
int d = 1, sum = 0;
while (d < N) {
if (i >= d)
sum = a[i-d];
Make sure everyone reads
b.await();
before anyone writes
if (i >= d)
a[i] += sum;
d = d * 2;
}}}
Art of Multiprocessor
Programming
30
Where Do the Barriers Go?
public void run() {
int d = 1, sum = 0;
while (d < N) {
if (i >= d)
sum = a[i-d];
Make sure everyone reads
b.await();
before anyone writes
if (i >= d)
a[i] += sum;
b.await();
d = d * 2;
}}}
Art of Multiprocessor
Programming
31
Where Do the Barriers Go?
public void run()
int d = 1, sum =
while (d < N) {
if (i >= d)
sum = a[i-d];
b.await();
if (i >= d)
a[i] += sum;
b.await();
d = d * 2;
}}}
{
0;
Make sure everyone reads
before anyone writes
Make sure everyone writes
before anyone reads
Art of Multiprocessor
Programming
32
Barrier Implementations
• Cache coherence
– Spin on locally-cached locations?
– Spin on statically-defined locations?
• Latency
– How many steps?
• Symmetry
– Do all threads do the same thing?
Art of Multiprocessor
Programming
33
Barriers
public class Barrier {
AtomicInteger count;
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
34
Barriers
public class Barrier {
AtomicInteger count;
int size;
public Barrier(int n){
count = AtomicInteger(n);
Number threads
size = n;
not yet arrived
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
35
Barriers
public class Barrier {
AtomicInteger count;
int size;
Number threads
public Barrier(int n){
participating
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
36
Barriers
public class Barrier {
Initialization
AtomicInteger count;
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
37
Barriers
public class Barrier {
AtomicInteger count;
Principal method
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
38
Barriers
public class Barrier { If I’m last, reset
AtomicInteger count; fields for next time
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
39
Barriers
public class Barrier {
AtomicInteger count;Otherwise, wait for
int size;
everyone else
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
40
Barriers
public class Barrier {
AtomicInteger count;
int size;
public Barrier(int n){
count = AtomicInteger(n);
size
= n;wrong with this protocol?
What’s
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
41
Reuse
Barrier b = new Barrier(n);
while ( mumble() ) {
Do work
work();
repeat
synchronize
b.await()
}
Art of Multiprocessor
Programming
42
Barriers
public class Barrier {
AtomicInteger count;
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
43
Barriers
public class Barrier {
AtomicInteger count; Waiting for
Phase 1 to finish
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
44
Barriers
1
public classPhase
Barrier
{
is so over
AtomicInteger
count; Waiting for
Phase 1 to finish
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
45
Barriers
Prepare
for
public class
Barrier
{
phasecount;
2
ZZZZZ….
AtomicInteger
int size;
public Barrier(int n){
count = AtomicInteger(n);
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
46
Uh-Oh
public class Barrier {
AtomicInteger count;Waiting for
Phase 2 to finish
int size;
public Barrier(int n){
Waiting for
count = AtomicInteger(n);
Phase 1 to finish
size = n;
}
public void await() {
if (count.getAndDecrement()==1) {
count.set(size);
} else {
while (count.get() != 0);
Art of Multiprocessor
}}}}
Programming
47
Basic Problem
• One thread “wraps around” to start
phase 2
• While another thread is still waiting
for phase 1
• One solution:
– Always use two barriers
Art of Multiprocessor
Programming
48
Sense-Reversing Barriers
public class Barrier {
AtomicInteger count;
int size;
boolean sense = false;
threadSense = new ThreadLocal<boolean>…
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
49
Sense-Reversing Barriers
public class Barrier {
Completed odd or
AtomicInteger count;
even-numbered
int size;
boolean sense = false;
phase?
threadSense = new ThreadLocal<boolean>…
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
50
Sense-Reversing Barriers
public class Barrier {
Store sense for
AtomicInteger count;
next phase
int size;
boolean sense = false;
threadSense = new ThreadLocal<boolean>…
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
51
Sense-Reversing Barriers
public class Barrier {
AtomicInteger count;
int size;
Get new sense
boolean sense = false; determined by last
threadSense = new ThreadLocal<boolean>…
phase
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
52
Sense-Reversing Barriers
public class Barrier {
AtomicInteger count;
If I’m last, reverse
int size;
sense for next time
boolean sense = false;
threadSense = new ThreadLocal<boolean>…
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
53
Sense-Reversing Barriers
public class Barrier {
AtomicInteger count;
Otherwise, wait for
int size;
sense to flip
boolean sense = false;
threadSense = new ThreadLocal<boolean>…
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
54
Sense-Reversing Barriers
public class Barrier {
AtomicInteger count; Prepare sense for next
int size;
phase
boolean sense = false;
threadSense = new ThreadLocal<boolean>…
public void await {
boolean mySense = threadSense.get();
if (count.getAndDecrement()==1) {
count.set(size); sense = !mySense
} else {
while (sense != mySense) {}
}
threadSense.set(!mySense)}}}
Art of Multiprocessor
Programming
55
Combining Tree Barriers
2-barrier
2-barrier
2-barrier
Art of Multiprocessor
Programming
56
Combining Tree Barriers
2-barrier
2-barrier
2-barrier
Art of Multiprocessor
Programming
57
Combining Tree Barrier
public class Node{
AtomicInteger count; int size;
Node parent; Volatile boolean sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await()}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
58
Combining Tree Barrier
Parent barrier in
public class Node{
AtomicInteger count; int size; tree
Node parent; Volatile boolean sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await()}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
59
Combining Tree Barrier
Am I last?
public class Node{
AtomicInteger count; int size;
Node parent; Volatile boolean sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await()}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
60
Combining Tree Barrier
public class Node{ Proceed to parent barrier
AtomicInteger count; int size;
Node parent; Volatile boolean sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await();}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
61
Combining Tree Barrier
public class Node{
Prepare for next phase
AtomicInteger count; int size;
Node parent; Volatile boolean sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await()}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
62
Combining Tree Barrier
public class Node{ Notify others at this node
AtomicInteger count; int size;
Node parent; Volatile boolean sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await()}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
63
Combining Tree Barrier
public class Node{
I’m not last, so wait for
AtomicInteger count; int size;
notification
Node parent; Volatile boolean
sense;
public void await() {…
if (count.getAndDecrement()==1) {
if (parent != null) {
parent.await()}
count.set(size);
sense = mySense
} else {
while (sense != mySense) {}
}…}}}
Art of Multiprocessor
Programming
64
Combining Tree Barrier
• No sequential bottleneck
– Parallel getAndDecrement() calls
• Low memory contention
– Same reason
• Cache behavior
– Local spinning on bus-based architecture
– Not so good for NUMA
Art of Multiprocessor
Programming
65
Remarks
• Everyone spins on sense field
– Local spinning on bus-based (good)
– Network hot-spot on distributed
architecture (bad)
• Not really scalable
Art of Multiprocessor
Programming
66
Tournament Tree Barrier
• If tree nodes have fan-in 2
– Don’t need to call getAndDecrement()
– Winner chosen statically
• At level i
– If i-th bit of id is 0, move up
– Otherwise keep back
Art of Multiprocessor
Programming
67
Tournament Tree Barriers
root
winner
winner
loser
loser
winner
Art of Multiprocessor
Programming
loser
68
Tournament Tree Barriers
All flags blue
Art of Multiprocessor
Programming
69
Tournament Tree Barriers
Loser thread sets
winner’s flag
Art of Multiprocessor
Programming
70
Tournament Tree Barriers
Loser spins on
own flag
Art of Multiprocessor
Programming
71
Tournament Tree Barriers
Winner
spins on
own flag
Art of Multiprocessor
Programming
72
Tournament Tree Barriers
Winner sees
own flag,
moves up, spins
Art of Multiprocessor
Programming
73
Tournament Tree Barriers
Bingo!
Art of Multiprocessor
Programming
74
Tournament Tree Barriers
Sense-reversing: next time
use blue flags
Art of Multiprocessor
Programming
75
Tournament Barrier
class TBarrier {
boolean flag;
TBarrier partner;
TBarrier parent;
boolean top;
…
}
Art of Multiprocessor
Programming
76
Tournament Barrier
class TBarrier {
boolean flag;
TBarrier partner;
TBarrier parent;
boolean top;
…
}
Notifications
delivered here
Art of Multiprocessor
Programming
77
Tournament Barrier
class TBarrier {
boolean flag;
TBarrier partner;
TBarrier parent;
boolean top;
…
}
Other thead at
same level
Art of Multiprocessor
Programming
78
Tournament Barrier
class TBarrier {
boolean flag;
TBarrier partner;
TBarrier parent;
boolean top;
…
}
Parent (winner) or
null (loser)
Art of Multiprocessor
Programming
79
Tournament Barrier
class TBarrier {
boolean flag;
TBarrier partner;
TBarrier parent;
boolean top;
…
}
Am I the root?
Art of Multiprocessor
Programming
80
Tournament Barrier
void await(boolean mySense) {
if (top) {
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
81
Tournament Barrier
Sense is a
void await(boolean mySense) {
Parameter to save
if (top) {
space…
return;
Le root, c’est moi
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
82
Tournament Barrier
void await(boolean mySense) {
I am already a
if (top) {
winner
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
83
Tournament Barrier
void await(boolean mySense) {
Wait for partner
if (top) {
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
84
Tournament Barrier
void await(boolean mySense) {
if (top) {
Synchronize upstairs
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
85
Tournament Barrier
void await(boolean mySense) {
if (top) {
Inform partner
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
86
Tournament Barrier
void await(boolean mySense) {
if (top) {
Natural-born loser
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
87
Tournament Barrier
void await(boolean mySense) {
if (top) {
Tell partner I’m here
return;
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
88
Tournament Barrier
void await(boolean mySense) {
if (top) {
Wait for notification
return;
from partner
} else if (parent != null) {
while (flag != mySense) {};
parent.await(mySense);
partner.flag = mySense;
} else {
partner.flag = mySense;
while (flag != mySense) {};
}}}
Art of Multiprocessor
Programming
89
Remarks
• No need for read-modify-write calls
• Each thread spins on fixed location
– Good for bus-based architectures
– Good for NUMA architectures
Art of Multiprocessor
Programming
90
Dissemination Barrier
• At round i
– Thread A notifies thread A+2i (mod n)
• Requires log n rounds
Art of Multiprocessor
Programming
91
Dissemination Barrier
+1
+2
Art of Multiprocessor
Programming
+4
92
Remarks
• Great for lovers of combinatorics
• Not so much fun for those who track
memory footprints
Art of Multiprocessor
Programming
93
Ideas So Far
• Sense-reversing
– Reuse without reinitializing
• Combining tree
– Like counters, locks …
• Tournament tree
– Optimized combining tree
• Dissemination barrier
– Intellectually Pleasing (matter of taste)
Art of Multiprocessor
Programming
94
Which is best for
Multicore?
• On a cache coherent multicore chip:
none of the above…
• Use a static tree barrier!
Art of Multiprocessor
Programming
95
Static Tree Barrier
All spin on
cached copy
of Done flag
2
2
0
0
0
Art of Multiprocessor
Programming
Counter
in parent:
Num of
children
that have
not
arrived
96
Static Tree Barrier
Alldetect
spin on
All
cachedincopy
change
of Done
Done
flagflag
1
2
0
1
2
0
0
0
0
Art of Multiprocessor
Programming
97
Remarks
• Very little cache traffic
• Minimal space overhead
• Can be laid out optimally on NUMA
– Instead of Done bit, notification must
be performed by passing sense down the
static tree
Art of Multiprocessor
Programming
98
So…How will we make use of
multicores?
Back to Amdahl’s Law:
Speedup = 1/(ParallelPart/N + SequentialPart)
Pay for N = 8 cores
SequentialPart = 25%
Speedup
= only 2.9
times!
Must parallelize
applications
on a very
fine grain!
Need Fine-Grained Locking
c
c
c
Coarse
Grained
c
Fine
Grained
25%
Shared
c
c
c
c
c
c c c
c
c
c
c
75%
Unshared
The reason
we get
only 2.9 speedup
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
c
25%
Shared
75%
Unshared
Traditional Scaling Process
7x
Speedup
1.8x
3.6x
User code
Traditional
Uniprocessor
Time: Moore’s law
Art of Multiprocessor
Programming
101
Multicore Scaling Process
7x
Speedup
1.8x
3.6x
User code
Multicore
As noted, not so simple…
Art of Multiprocessor
Programming
102
Real-World Scaling Process
Speedup
1.8x
2x
2.9x
User code
Multicore
Parallelization and Synchronization
will require great care…
Art of Multiprocessor
Programming
103
Future: Smoother Scaling …
7x
Speedup
User code
Abstractions
(like TM)
Multicore
1.8x
3.6x
Multicore Programming
• We are at the dawn of a new era…
• Still a lot of research and
development to be done
• And a body of multicore programming
experience to be accumelated by us
all
© 2006 Herlihy & Shavit
105
Thanks for Attending!
• Good luck with your programming…
• If you have questions or run into
interesting problems, just email us:
– [email protected][email protected]
© 2006 Herlihy & Shavit
106
This work is licensed under a Creative Commons AttributionShareAlike 2.5 License.
• You are free:
– to Share — to copy, distribute and transmit the work
– to Remix — to adapt the work
• Under the following conditions:
– Attribution. You must attribute the work to “The Art of
Multiprocessor Programming” (but not in any way that
suggests that the authors endorse you or your use of the
work).
– Share Alike. If you alter, transform, or build upon this work,
you may distribute the resulting work only under the same,
similar or a compatible license.
• For any reuse or distribution, you must make clear to others the
license terms of this work. The best way to do this is with a link
to
– http://creativecommons.org/licenses/by-sa/3.0/.
• Any of the above conditions can be waived if you get permission
from the copyright holder.
• Nothing in this license impairs or restricts the author's moral
rights.
Art of Multiprocessor
Programming
107