SlideShare a Scribd company logo
1 of 46
Practical Solutions
for Multicore Programming

Dr. Guy Korland
Process 1
a = acc.get()
a = a + 100

Process 2
b = acc.get()
b = b + 50
acc.set(b)

acc.set(a)
... Lost Update! ...
Process 1

Process 2

lock(A)
lock(B)
….
lock(A)
lock(A)
... DeadLock! ...
Process 1

Process 2

atomic{
a = acc.get()
a = a + 100
acc.set(a)
}

atomic{
b = acc.get()
b = b + 50
acc.set(b)
}

... WIIIII! ...
Intel TSX
if(_xbegin()==-1) {
if( !fallback_mutex.is_acquired() ) {
tions.
sums[mygroup] += data[i];e instruc
impl
} else {
d to s
e
_xabort(1);
● Limit
ll-back
fa
}
erency
Coh
uires
● _xend();
Req
Cache
} else {
ing on
●fallback_mutex.acquire();
Relay
sums[mygroup] += data[i];
fallback_mutex.release();
}
We still need
Software Transactional Memory
DSTM2

Maurice Herlihy et al, A flexible framework … [OOPSLA06]

@atomic public interface INode{
int getValue ();
void setValue (int value );
jects.
}
to Ob
d

imite
L
sive.
Factory<INode> factory ru
int = Thread.makeFactory(INode.class );
aries.
●
final INodeVery factory.create(); ort libr
node =
factory result = Thread.doIt(new Callable<Boolean>() {
’t supp e (fork).
n
● Does
public Boolean call nc
rma () {
return node.setValue(value);
perfo
● Bad
} });
●
JVSTM

João Cachopo and António Rito-Silva, Versioned boxes as the
basis for memory transactions [SCOOL05]

public class Account{
private VBox<Long> balance = new aries.
VBox<Long>();

}

rt libr
suppo
public @Atomic void withdraw(long amount) {
esn’t
● Do
e. - amount); hared fields
balance.put rusiv
int(balance.get() nce” s
● Less
}
nnou
to “A
● Need
Atom-Java

B. Hindman and D. Grossman. Atomicity via source-tosource
translation. [MSPC06]

public void update ( double value) {
Atomic {
ord.
w
commission += value; erved
a res
tion.
● Add
}
ompila ries.
pre-c
}
ibra
●
eed

N
ort l
’t supp sive.
n
● Does
s intru
n Les
● Eve
Deuce STM - API
G. Korland, N. Shavit and P. Felber, “Noninvasive Java
Concurrency with Deuce STM”, [MultiProg '10]

public class Bank{
rds.
ed wo
private double commission = 10;
serv

No re
ased.
nb
tion.
@Atomicnnotatio
mpila
● A
re co
pac1,-Account ac2,rdouble amount){
public void transaction( Account
ies.
d for
ee
● No n (amount + commission);lib
al ra ol
ac1.balance -=
xtern
ac2.balanceppamount;e
+= orts
rch to
● Su
resea
}
able –
d
● Exten
}
●
Deuce STM - Overview
Benchmarks

(Sun UltraSPARC T2 Plus – 2 x Quad x 8 HT)
Benchmarks

(Azul – Vega2 – 2 x 48)
Benchmark - the dark side
1.2

1

0.8

0.6

0.4

0.2

0
1

2

3

4

5

6

7

8

9

10
Overhead
●

Contention – Retries, Aborts, Contention Manager …

●

STM Algorithm – Data structures, optimistic, pessimistic…

●

Semantic – Consistency model, Privatization…

●

Instrumented Memory access – Linear overhead on every read/write
Static analysis Optimizations
1. Avoiding instrumentation of accesses to immutable and
transaction-local memory.
2. Avoiding lock acquisition and releases for
local memory.

thread-

3. Avoiding readset population in read-only transactions.
Novel Static analysis
Optimizations

Y. Afek, G. Korland, and A. Zilberstein,
“Lowering STM Overhead with Static Analysis”, LCPC'10

1. Reduce amount of instrumented memory reads using load
elimination.
2. Reduce amount of instrumented memory writes using scalar
promotion.
3. Avoid writeset lookups for memory not yet written to.
4. Avoid writeset record keeping for memory that will not be read.
5. Reduce false conflicts by Transaction re-scoping.
...
Benchmarks – K-Means
We still need
Fine-Grained
Concurrent Data Structures
e.g. Pool
• P1

• Get( )

• Put(x)

• C2

• P2

•.
•.
•.

• C1

• Put(y)

• Get( )

• Pn • Put(z)

• Get( )

• pool

•.
•.
•.
• Cn
Java - pools
1. SynchronousQueue/Stack -

pairing up function without buffering.
Producers and consumers wait for one another

labilty.
/FIFO
Sca
LIFO and leave,
mited
● Li
2. LinkedBlockingQueuet- Producers put their value
' need
n
Consumers wait l does become available.
for a value to
● Poo

3. ConcurrentLinkedQueue - Producers put their value and leave,
Consumers return null if the pool is empty.
ED-Tree
Scalable Producer-Consumr Pools Based on Elimination-Diffraction Trees
(Y. Afek, G. Korland, M. Natanzon, N. Shavit)

:
ucture
● Merge
ee Str
ng-Tr
fracti
● Dif
ach)
d Zem
cture
an
havit
e Stru
(S
n-Tre
inatio
● Elim
itou)
nd Tou
ueue
a v it a
(Sh
kingQ
Bloc
ed
● Link
Performance
What about other cases?
Do we really need Linearizability?
Can we make it more formal?
The solution:
Relax the Linearizability Requirements
Y. Afek, G. Korland, and A. Yanovsky,
“Quasi-Linearizability: relaxed consistency for improved concurrency”,
OPODIS'10
e.g. Task Queue
Tail

Head

Task

Task Consumers

Task

Task

Task

Task

Task Producers
K-Quasi Task Queue
k
Tail

Head
Task

Task

Task

Task
Consumer

Task

Task

Task
Consumer

Task

Task
Quasi Linearizable Definition

H’

1

2

3

4

5

6

H

4

1

2

3

5

6

Distance 3
More motivation...
●

Statistical Counter

●

ID generator

●

Web Cache
Paractical Solutions for Multicore Programming

More Related Content

What's hot

Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual ExclusionDavid Evans
 
Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes Jonathan Salwan
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsJonathan Salwan
 
IOT Firmware: Best Pratices
IOT Firmware:  Best PraticesIOT Firmware:  Best Pratices
IOT Firmware: Best Praticesfarmckon
 
JVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixJVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixCodemotion Tel Aviv
 
[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation
[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation
[Sitcon2018] Analysis and Improvement of IOTA PoW ImplementationZhen Wei
 
EdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for JavaEdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for JavaLisa Hua
 
An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
 An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
An Open Discussion of RISC-V BitManip, trends, and comparisons _ ClaireRISC-V International
 
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...Jonathan Salwan
 
TMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
TMPA-2017: Simple Type Based Alias Analysis for a VLIW ProcessorTMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
TMPA-2017: Simple Type Based Alias Analysis for a VLIW ProcessorIosif Itkin
 
Multithreading done right
Multithreading done rightMultithreading done right
Multithreading done rightPlatonov Sergey
 
Kernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring NaughtKernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring NaughtDavid Evans
 
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...Linaro
 

What's hot (20)

Mutual Exclusion
Mutual ExclusionMutual Exclusion
Mutual Exclusion
 
Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes Dynamic Binary Analysis and Obfuscated Codes
Dynamic Binary Analysis and Obfuscated Codes
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
IOT Firmware: Best Pratices
IOT Firmware:  Best PraticesIOT Firmware:  Best Pratices
IOT Firmware: Best Pratices
 
JVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, WixJVM Memory Model - Yoav Abrahami, Wix
JVM Memory Model - Yoav Abrahami, Wix
 
[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation
[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation
[Sitcon2018] Analysis and Improvement of IOTA PoW Implementation
 
Java Memory Model
Java Memory ModelJava Memory Model
Java Memory Model
 
Onnc intro
Onnc introOnnc intro
Onnc intro
 
EdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for JavaEdSketch: Execution-Driven Sketching for Java
EdSketch: Execution-Driven Sketching for Java
 
Machine Trace Metrics
Machine Trace MetricsMachine Trace Metrics
Machine Trace Metrics
 
An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
 An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
An Open Discussion of RISC-V BitManip, trends, and comparisons _ Claire
 
opt-mem-trx
opt-mem-trxopt-mem-trx
opt-mem-trx
 
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
Sstic 2015 detailed_version_triton_concolic_execution_frame_work_f_saudel_jsa...
 
Sysprog 12
Sysprog 12Sysprog 12
Sysprog 12
 
Sysprog 12
Sysprog 12Sysprog 12
Sysprog 12
 
Fm wtm12-v2
Fm wtm12-v2Fm wtm12-v2
Fm wtm12-v2
 
TMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
TMPA-2017: Simple Type Based Alias Analysis for a VLIW ProcessorTMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
TMPA-2017: Simple Type Based Alias Analysis for a VLIW Processor
 
Multithreading done right
Multithreading done rightMultithreading done right
Multithreading done right
 
Kernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring NaughtKernel-Level Programming: Entering Ring Naught
Kernel-Level Programming: Entering Ring Naught
 
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
BKK16-503 Undefined Behavior and Compiler Optimizations – Why Your Program St...
 

Similar to Paractical Solutions for Multicore Programming

[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory AnalysisMoabi.com
 
A Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingA Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingMatsuo and Tsumura lab.
 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit AutomationMoabi.com
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory AnalysisMoabi.com
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCsw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCanSecWest
 
Preventing and Resolving MySQL Downtime
Preventing and Resolving MySQL DowntimePreventing and Resolving MySQL Downtime
Preventing and Resolving MySQL DowntimeJervin Real
 
Performance and predictability (1)
Performance and predictability (1)Performance and predictability (1)
Performance and predictability (1)RichardWarburton
 
Performance and Predictability - Richard Warburton
Performance and Predictability - Richard WarburtonPerformance and Predictability - Richard Warburton
Performance and Predictability - Richard WarburtonJAXLondon2014
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory AnalysisMoabi.com
 
Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...
Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...
Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...Sri Ambati
 
Austin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreAustin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreKim Phillips
 
How shit works: the CPU
How shit works: the CPUHow shit works: the CPU
How shit works: the CPUTomer Gabel
 
Exploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelExploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelVitaly Nikolenko
 
SQL Server In-Memory Internals and Performance Tips
SQL Server In-Memory Internals and Performance TipsSQL Server In-Memory Internals and Performance Tips
SQL Server In-Memory Internals and Performance TipsHamid J. Fard
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerPlatonov Sergey
 

Similar to Paractical Solutions for Multicore Programming (20)

[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis
 
A Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with MultithreadingA Speculative Technique for Auto-Memoization Processor with Multithreading
A Speculative Technique for Auto-Memoization Processor with Multithreading
 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
 
Meltdown & spectre
Meltdown & spectreMeltdown & spectre
Meltdown & spectre
 
Valgrind
ValgrindValgrind
Valgrind
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCsw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
 
Preventing and Resolving MySQL Downtime
Preventing and Resolving MySQL DowntimePreventing and Resolving MySQL Downtime
Preventing and Resolving MySQL Downtime
 
Performance and predictability (1)
Performance and predictability (1)Performance and predictability (1)
Performance and predictability (1)
 
Performance and Predictability - Richard Warburton
Performance and Predictability - Richard WarburtonPerformance and Predictability - Richard Warburton
Performance and Predictability - Richard Warburton
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...
Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...
Feature Engineering in H2O Driverless AI - Dmitry Larko - H2O AI World London...
 
Programar para GPUs
Programar para GPUsProgramar para GPUs
Programar para GPUs
 
GCC
GCCGCC
GCC
 
Austin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreAustin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectre
 
How shit works: the CPU
How shit works: the CPUHow shit works: the CPU
How shit works: the CPU
 
Exploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernelExploitation of counter overflows in the Linux kernel
Exploitation of counter overflows in the Linux kernel
 
AA_Unit 1_part-I.pptx
AA_Unit 1_part-I.pptxAA_Unit 1_part-I.pptx
AA_Unit 1_part-I.pptx
 
SQL Server In-Memory Internals and Performance Tips
SQL Server In-Memory Internals and Performance TipsSQL Server In-Memory Internals and Performance Tips
SQL Server In-Memory Internals and Performance Tips
 
Address/Thread/Memory Sanitizer
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
 

More from Guy Korland

FalkorDB - Fastest way to your Knowledge
FalkorDB - Fastest way to your KnowledgeFalkorDB - Fastest way to your Knowledge
FalkorDB - Fastest way to your KnowledgeGuy Korland
 
Redis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsightRedis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsightGuy Korland
 
Using Redis As Your Online Feature Store: 2021 Highlights. 2022 Directions
Using Redis As Your  Online Feature Store:  2021 Highlights. 2022 DirectionsUsing Redis As Your  Online Feature Store:  2021 Highlights. 2022 Directions
Using Redis As Your Online Feature Store: 2021 Highlights. 2022 DirectionsGuy Korland
 
The evolution of DBaaS - israelcloudsummit
The evolution of DBaaS - israelcloudsummitThe evolution of DBaaS - israelcloudsummit
The evolution of DBaaS - israelcloudsummitGuy Korland
 
From kv to multi model RedisDay NYC19
From kv to multi model   RedisDay NYC19From kv to multi model   RedisDay NYC19
From kv to multi model RedisDay NYC19Guy Korland
 
From Key-Value to Multi-Model - RedisConf19
From Key-Value to Multi-Model - RedisConf19From Key-Value to Multi-Model - RedisConf19
From Key-Value to Multi-Model - RedisConf19Guy Korland
 
Building Scalable Producer-Consumer Pools based on Elimination-Diraction Trees
Building Scalable Producer-Consumer  Pools based on Elimination-Diraction TreesBuilding Scalable Producer-Consumer  Pools based on Elimination-Diraction Trees
Building Scalable Producer-Consumer Pools based on Elimination-Diraction TreesGuy Korland
 
Open stack bigdata NY cloudcamp
Open stack bigdata NY cloudcampOpen stack bigdata NY cloudcamp
Open stack bigdata NY cloudcampGuy Korland
 
The Open PaaS Stack
The Open PaaS StackThe Open PaaS Stack
The Open PaaS StackGuy Korland
 
Quasi-Linearizability: relaxed consistency for improved concurrency.
Quasi-Linearizability: relaxed consistency for improved concurrency.Quasi-Linearizability: relaxed consistency for improved concurrency.
Quasi-Linearizability: relaxed consistency for improved concurrency.Guy Korland
 
The Next Generation Application Server – How Event Based Processing yields s...
The Next Generation  Application Server – How Event Based Processing yields s...The Next Generation  Application Server – How Event Based Processing yields s...
The Next Generation Application Server – How Event Based Processing yields s...Guy Korland
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09Guy Korland
 

More from Guy Korland (14)

FalkorDB - Fastest way to your Knowledge
FalkorDB - Fastest way to your KnowledgeFalkorDB - Fastest way to your Knowledge
FalkorDB - Fastest way to your Knowledge
 
Redis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsightRedis Developer Day TLV - Redis Stack & RedisInsight
Redis Developer Day TLV - Redis Stack & RedisInsight
 
Using Redis As Your Online Feature Store: 2021 Highlights. 2022 Directions
Using Redis As Your  Online Feature Store:  2021 Highlights. 2022 DirectionsUsing Redis As Your  Online Feature Store:  2021 Highlights. 2022 Directions
Using Redis As Your Online Feature Store: 2021 Highlights. 2022 Directions
 
Vector database
Vector databaseVector database
Vector database
 
The evolution of DBaaS - israelcloudsummit
The evolution of DBaaS - israelcloudsummitThe evolution of DBaaS - israelcloudsummit
The evolution of DBaaS - israelcloudsummit
 
From kv to multi model RedisDay NYC19
From kv to multi model   RedisDay NYC19From kv to multi model   RedisDay NYC19
From kv to multi model RedisDay NYC19
 
From Key-Value to Multi-Model - RedisConf19
From Key-Value to Multi-Model - RedisConf19From Key-Value to Multi-Model - RedisConf19
From Key-Value to Multi-Model - RedisConf19
 
Building Scalable Producer-Consumer Pools based on Elimination-Diraction Trees
Building Scalable Producer-Consumer  Pools based on Elimination-Diraction TreesBuilding Scalable Producer-Consumer  Pools based on Elimination-Diraction Trees
Building Scalable Producer-Consumer Pools based on Elimination-Diraction Trees
 
Cloudify 10m
Cloudify 10mCloudify 10m
Cloudify 10m
 
Open stack bigdata NY cloudcamp
Open stack bigdata NY cloudcampOpen stack bigdata NY cloudcamp
Open stack bigdata NY cloudcamp
 
The Open PaaS Stack
The Open PaaS StackThe Open PaaS Stack
The Open PaaS Stack
 
Quasi-Linearizability: relaxed consistency for improved concurrency.
Quasi-Linearizability: relaxed consistency for improved concurrency.Quasi-Linearizability: relaxed consistency for improved concurrency.
Quasi-Linearizability: relaxed consistency for improved concurrency.
 
The Next Generation Application Server – How Event Based Processing yields s...
The Next Generation  Application Server – How Event Based Processing yields s...The Next Generation  Application Server – How Event Based Processing yields s...
The Next Generation Application Server – How Event Based Processing yields s...
 
Deuce STM - CMP'09
Deuce STM - CMP'09Deuce STM - CMP'09
Deuce STM - CMP'09
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Paractical Solutions for Multicore Programming

  • 1. Practical Solutions for Multicore Programming Dr. Guy Korland
  • 2.
  • 3.
  • 4. Process 1 a = acc.get() a = a + 100 Process 2 b = acc.get() b = b + 50 acc.set(b) acc.set(a) ... Lost Update! ...
  • 6.
  • 7. Process 1 Process 2 atomic{ a = acc.get() a = a + 100 acc.set(a) } atomic{ b = acc.get() b = b + 50 acc.set(b) } ... WIIIII! ...
  • 8.
  • 9. Intel TSX if(_xbegin()==-1) { if( !fallback_mutex.is_acquired() ) { tions. sums[mygroup] += data[i];e instruc impl } else { d to s e _xabort(1); ● Limit ll-back fa } erency Coh uires ● _xend(); Req Cache } else { ing on ●fallback_mutex.acquire(); Relay sums[mygroup] += data[i]; fallback_mutex.release(); }
  • 10.
  • 11. We still need Software Transactional Memory
  • 12. DSTM2 Maurice Herlihy et al, A flexible framework … [OOPSLA06] @atomic public interface INode{ int getValue (); void setValue (int value ); jects. } to Ob d imite L sive. Factory<INode> factory ru int = Thread.makeFactory(INode.class ); aries. ● final INodeVery factory.create(); ort libr node = factory result = Thread.doIt(new Callable<Boolean>() { ’t supp e (fork). n ● Does public Boolean call nc rma () { return node.setValue(value); perfo ● Bad } }); ●
  • 13. JVSTM João Cachopo and António Rito-Silva, Versioned boxes as the basis for memory transactions [SCOOL05] public class Account{ private VBox<Long> balance = new aries. VBox<Long>(); } rt libr suppo public @Atomic void withdraw(long amount) { esn’t ● Do e. - amount); hared fields balance.put rusiv int(balance.get() nce” s ● Less } nnou to “A ● Need
  • 14. Atom-Java B. Hindman and D. Grossman. Atomicity via source-tosource translation. [MSPC06] public void update ( double value) { Atomic { ord. w commission += value; erved a res tion. ● Add } ompila ries. pre-c } ibra ● eed N ort l ’t supp sive. n ● Does s intru n Les ● Eve
  • 15. Deuce STM - API G. Korland, N. Shavit and P. Felber, “Noninvasive Java Concurrency with Deuce STM”, [MultiProg '10] public class Bank{ rds. ed wo private double commission = 10; serv No re ased. nb tion. @Atomicnnotatio mpila ● A re co pac1,-Account ac2,rdouble amount){ public void transaction( Account ies. d for ee ● No n (amount + commission);lib al ra ol ac1.balance -= xtern ac2.balanceppamount;e += orts rch to ● Su resea } able – d ● Exten } ●
  • 16. Deuce STM - Overview
  • 17. Benchmarks (Sun UltraSPARC T2 Plus – 2 x Quad x 8 HT)
  • 19.
  • 20.
  • 21.
  • 22. Benchmark - the dark side 1.2 1 0.8 0.6 0.4 0.2 0 1 2 3 4 5 6 7 8 9 10
  • 23.
  • 24. Overhead ● Contention – Retries, Aborts, Contention Manager … ● STM Algorithm – Data structures, optimistic, pessimistic… ● Semantic – Consistency model, Privatization… ● Instrumented Memory access – Linear overhead on every read/write
  • 25. Static analysis Optimizations 1. Avoiding instrumentation of accesses to immutable and transaction-local memory. 2. Avoiding lock acquisition and releases for local memory. thread- 3. Avoiding readset population in read-only transactions.
  • 26. Novel Static analysis Optimizations Y. Afek, G. Korland, and A. Zilberstein, “Lowering STM Overhead with Static Analysis”, LCPC'10 1. Reduce amount of instrumented memory reads using load elimination. 2. Reduce amount of instrumented memory writes using scalar promotion. 3. Avoid writeset lookups for memory not yet written to. 4. Avoid writeset record keeping for memory that will not be read. 5. Reduce false conflicts by Transaction re-scoping. ...
  • 28.
  • 29.
  • 31. e.g. Pool • P1 • Get( ) • Put(x) • C2 • P2 •. •. •. • C1 • Put(y) • Get( ) • Pn • Put(z) • Get( ) • pool •. •. •. • Cn
  • 32. Java - pools 1. SynchronousQueue/Stack - pairing up function without buffering. Producers and consumers wait for one another labilty. /FIFO Sca LIFO and leave, mited ● Li 2. LinkedBlockingQueuet- Producers put their value ' need n Consumers wait l does become available. for a value to ● Poo 3. ConcurrentLinkedQueue - Producers put their value and leave, Consumers return null if the pool is empty.
  • 33. ED-Tree Scalable Producer-Consumr Pools Based on Elimination-Diffraction Trees (Y. Afek, G. Korland, M. Natanzon, N. Shavit) : ucture ● Merge ee Str ng-Tr fracti ● Dif ach) d Zem cture an havit e Stru (S n-Tre inatio ● Elim itou) nd Tou ueue a v it a (Sh kingQ Bloc ed ● Link
  • 35.
  • 37. Do we really need Linearizability?
  • 38. Can we make it more formal?
  • 39. The solution: Relax the Linearizability Requirements Y. Afek, G. Korland, and A. Yanovsky, “Quasi-Linearizability: relaxed consistency for improved concurrency”, OPODIS'10
  • 40. e.g. Task Queue Tail Head Task Task Consumers Task Task Task Task Task Producers
  • 42.
  • 44.

Editor's Notes

  1. Circuit routing is the process of automatically producing an interconnection between electronic components. Lee&apos;s routing algorithm is attractive for parallelization since circuits consist of thousands of routes, each of which can potentially be routed concurrently.