SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
10/21/2012 Races'12
A Case for Relativistic
Programming
Philip W. Howard
West Virginia University Institute of Technology
Jonathan Walpole
Portland State University
10/21/2012 Races'12 2
Events
E1
E2
O1
O2
10/21/2012 Races'12 3
Triangle inequality: a + b >= c
E1
E2
O2
a
c
b
Causality
10/21/2012 Races'12 4
Causalty in Computers
• If computers were just wires, we’d be OK
• Computers are wires + illogic
10/21/2012 Races'12 5
illogic example
A B D
C
C = malloc();
C->data = data;
C->next = D;
B->next = C;
rp-publish(B->next, C);
10/21/2012 Races'12 6
Need for causal delays
A B D
CC
B->next = D;
wait-for-readers();
free(C);
10/21/2012 Races'12 7
Rules for Placing Relativistic
Programming Primitives
1. Write globally visible pointers with
rp_publish()
2. When performing two writes, one earlier
in traversal order and one later in
traversal order, separate the two with
wait-for-readers()
10/21/2012 Races'12 8
Relativistic vs. Concurrent
Balanced Trees
•Relativistic Red Black Trees
•Concurrent AVL Trees
A practical concurrent binary search tree.
PPoPP ’10; Bronson et al
10/21/2012 Races'12 9
Concurrent AVL get
20 V get(K k) {
21 return (V)attemptGet(k, rootHolder, 1, 0);
22 }
23
24 Object attemptGet(
25 K k, Node node, int dir, long nodeV) {
26 while (true) {
27 Node child = node.child(dir);
28 if (((node.version^nodeV) & IgnoreGrow) != 0)
29 return Retry;
30 if (child == null)
31 return null;
32 int nextD = k.compareTo(child.key);
33 if (nextD == 0)
34 return child.value;
35 long chV = child.version;
36 if ((chV & Shrinking) != 0) {
37 waitUntilNotChanging(child);
38 } else if (chV != Unlinked &&
39 child == node.child(dir)) {
40 if (((node.version^nodeV) & IgnoreGrow) != 0)
41 return Retry;
42 Object p = attemptGet(k, child, nextD, chV);
43 if (p != Retry)
10/21/2012 Races'12 10
Relativistic RBTree Get
void *rb_find(rbtree *tree, long key)
{
void *value;
rbnode_t *node = tree->root;
start_read();
while (node != NULL) {
if (key == node->key)
break;
else if (key < node->key)
node = rp-dereference(node->left);
else
node = rp-dereference(node->right);
}
if (node != NULL)
value = node->value;
else
value = NULL;
10/21/2012 Races'12 11
RBTree Delete
10/21/2012 Races'12 12
RP Delete
rbnode_t *new_node = rbnode_copy(swap);
rp-publish(new_node->left, node->left);
node->left->parent = new_node;
rp-publish(new_node->right, node->right);
node->right->parent = new_node;
if (is_left(node))
rp-publish(prev->left, new_node);
else
rp-publish (prev->right, new_node);
new_node->parent = prev;
// need to make sure new_node is seen before path to b is erased
wait-for-readers(tree->lock);
prev = swap->parent;
next = swap->right;
rp-publish(prev->left, swap->right);
if (swap->right != NULL) swap->right->parent = prev;
10/21/2012 Races'12 13
0
7500000
15000000
22500000
30000000
0 18 35 53 70
Read Performance
Reads/Sec
Read Threads
NOLOCK reads
NOLOCK cont. reads
RP reads
RP cont. reads
ccavl reads
ccavl cont. reads
10/21/2012 Races'12 14
0
50000
100000
150000
200000
0 18 35 53 70
Contended Write Performance
Writes/sec
Read Threads
NOLOCK writes
RP writes
ccavl writes
10/21/2012 Races'12 15
Benefits of RP
• High performance, Highly scalable reads
• Simple Code
• Strong correctness properties

Mais conteúdo relacionado

Mais procurados

CDAC CCAT examination important question
CDAC CCAT examination important questionCDAC CCAT examination important question
CDAC CCAT examination important question
prabhatjon
 
GPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by AltenGPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by Alten
Arjan Somers
 

Mais procurados (20)

Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...Android Developer Days: Increasing performance of big arrays processing on An...
Android Developer Days: Increasing performance of big arrays processing on An...
 
Declarative Datalog Debugging for Mere Mortals
Declarative Datalog Debugging for Mere MortalsDeclarative Datalog Debugging for Mere Mortals
Declarative Datalog Debugging for Mere Mortals
 
Practical Introduction to Java Memory Model
Practical Introduction to Java Memory ModelPractical Introduction to Java Memory Model
Practical Introduction to Java Memory Model
 
CppConcurrencyInAction - Chapter07
CppConcurrencyInAction - Chapter07CppConcurrencyInAction - Chapter07
CppConcurrencyInAction - Chapter07
 
Vectorization in ATLAS
Vectorization in ATLASVectorization in ATLAS
Vectorization in ATLAS
 
An OCL-based bridge from CS to AS
An OCL-based bridge from CS to ASAn OCL-based bridge from CS to AS
An OCL-based bridge from CS to AS
 
Technical aptitude test 2 CSE
Technical aptitude test 2 CSETechnical aptitude test 2 CSE
Technical aptitude test 2 CSE
 
Programming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive SystemsProgramming Actor-based Collective Adaptive Systems
Programming Actor-based Collective Adaptive Systems
 
Tech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применениеTech Talks @NSU: DLang: возможности языка и его применение
Tech Talks @NSU: DLang: возможности языка и его применение
 
Learn basics of Clojure/script and Reagent
Learn basics of Clojure/script and ReagentLearn basics of Clojure/script and Reagent
Learn basics of Clojure/script and Reagent
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
 
Temporal logic and functional reactive programming
Temporal logic and functional reactive programmingTemporal logic and functional reactive programming
Temporal logic and functional reactive programming
 
Part - 2 Cpp programming Solved MCQ
Part - 2  Cpp programming Solved MCQ Part - 2  Cpp programming Solved MCQ
Part - 2 Cpp programming Solved MCQ
 
Technical aptitude Test 1 CSE
Technical aptitude Test 1 CSETechnical aptitude Test 1 CSE
Technical aptitude Test 1 CSE
 
CDAC CCAT examination important question
CDAC CCAT examination important questionCDAC CCAT examination important question
CDAC CCAT examination important question
 
C#, What Is Next?
C#, What Is Next?C#, What Is Next?
C#, What Is Next?
 
GPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by AltenGPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by Alten
 
Cs gate-2011
Cs gate-2011Cs gate-2011
Cs gate-2011
 
Beyond C++17
Beyond C++17Beyond C++17
Beyond C++17
 
C test
C testC test
C test
 

Destaque

Destaque (10)

Welcome and Lightning Intros
Welcome and Lightning IntrosWelcome and Lightning Intros
Welcome and Lightning Intros
 
Nondeterminism is unavoidable, but data races are pure evil
Nondeterminism is unavoidable, but data races are pure evilNondeterminism is unavoidable, but data races are pure evil
Nondeterminism is unavoidable, but data races are pure evil
 
(Relative) Safety Properties for Relaxed Approximate Programs
(Relative) Safety Properties for Relaxed Approximate Programs(Relative) Safety Properties for Relaxed Approximate Programs
(Relative) Safety Properties for Relaxed Approximate Programs
 
Does Better Throughput Require Worse Latency?
Does Better Throughput Require Worse Latency?Does Better Throughput Require Worse Latency?
Does Better Throughput Require Worse Latency?
 
Edge Chasing Delayed Consistency: Pushing the Limits of Weak Memory Models
Edge Chasing Delayed Consistency: Pushing the Limits of Weak Memory ModelsEdge Chasing Delayed Consistency: Pushing the Limits of Weak Memory Models
Edge Chasing Delayed Consistency: Pushing the Limits of Weak Memory Models
 
Programming with Relaxed Synchronization
Programming with Relaxed SynchronizationProgramming with Relaxed Synchronization
Programming with Relaxed Synchronization
 
Dancing with Uncertainty
Dancing with UncertaintyDancing with Uncertainty
Dancing with Uncertainty
 
Parallel Sorting on a Spatial Computer
Parallel Sorting on a Spatial ComputerParallel Sorting on a Spatial Computer
Parallel Sorting on a Spatial Computer
 
Keynote, LambdaConf 2015 - Ipecac for the Ouroboros
Keynote, LambdaConf 2015 - Ipecac for the OuroborosKeynote, LambdaConf 2015 - Ipecac for the Ouroboros
Keynote, LambdaConf 2015 - Ipecac for the Ouroboros
 
Beyond Expert-Only Parallel Programming
Beyond Expert-Only Parallel ProgrammingBeyond Expert-Only Parallel Programming
Beyond Expert-Only Parallel Programming
 

Semelhante a A Case for Relativistic Programming

20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers
Computer Science Club
 
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxDivide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
jacksnathalie
 

Semelhante a A Case for Relativistic Programming (19)

Implementing Link-Prediction for Social Networks in a Database System (DBSoci...
Implementing Link-Prediction for Social Networks in a Database System (DBSoci...Implementing Link-Prediction for Social Networks in a Database System (DBSoci...
Implementing Link-Prediction for Social Networks in a Database System (DBSoci...
 
Fast matrix primitives for ranking, link-prediction and more
Fast matrix primitives for ranking, link-prediction and moreFast matrix primitives for ranking, link-prediction and more
Fast matrix primitives for ranking, link-prediction and more
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
 
Practical Consistency
Practical ConsistencyPractical Consistency
Practical Consistency
 
05-Debug.pdf
05-Debug.pdf05-Debug.pdf
05-Debug.pdf
 
What did you miss in Java from 9-13?
What did you miss in Java from 9-13?What did you miss in Java from 9-13?
What did you miss in Java from 9-13?
 
Map, flatmap and reduce are your new best friends (javaone, svcc)
Map, flatmap and reduce are your new best friends (javaone, svcc)Map, flatmap and reduce are your new best friends (javaone, svcc)
Map, flatmap and reduce are your new best friends (javaone, svcc)
 
Ruby on Big Data @ Philly Ruby Group
Ruby on Big Data @ Philly Ruby GroupRuby on Big Data @ Philly Ruby Group
Ruby on Big Data @ Philly Ruby Group
 
Scala meetup - Intro to spark
Scala meetup - Intro to sparkScala meetup - Intro to spark
Scala meetup - Intro to spark
 
Neo4j
Neo4jNeo4j
Neo4j
 
Introduction to Verilog & code coverage
Introduction to Verilog & code coverageIntroduction to Verilog & code coverage
Introduction to Verilog & code coverage
 
A MuDDy Experience - ML Bindings to a BDD Library
A MuDDy Experience - ML Bindings to a BDD LibraryA MuDDy Experience - ML Bindings to a BDD Library
A MuDDy Experience - ML Bindings to a BDD Library
 
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and TasksSegmentation Faults, Page Faults, Processes, Threads, and Tasks
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
 
20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers20101017 program analysis_for_security_livshits_lecture02_compilers
20101017 program analysis_for_security_livshits_lecture02_compilers
 
Foundations of streaming SQL: stream & table theory
Foundations of streaming SQL: stream & table theoryFoundations of streaming SQL: stream & table theory
Foundations of streaming SQL: stream & table theory
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the race
 
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxDivide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
 
important C questions and_answers praveensomesh
important C questions and_answers praveensomeshimportant C questions and_answers praveensomesh
important C questions and_answers praveensomesh
 
A MuDDy Experience - ML Bindings to a BDD Library
A MuDDy Experience - ML Bindings to a BDD LibraryA MuDDy Experience - ML Bindings to a BDD Library
A MuDDy Experience - ML Bindings to a BDD Library
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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?
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 

A Case for Relativistic Programming

  • 1. 10/21/2012 Races'12 A Case for Relativistic Programming Philip W. Howard West Virginia University Institute of Technology Jonathan Walpole Portland State University
  • 3. 10/21/2012 Races'12 3 Triangle inequality: a + b >= c E1 E2 O2 a c b Causality
  • 4. 10/21/2012 Races'12 4 Causalty in Computers • If computers were just wires, we’d be OK • Computers are wires + illogic
  • 5. 10/21/2012 Races'12 5 illogic example A B D C C = malloc(); C->data = data; C->next = D; B->next = C; rp-publish(B->next, C);
  • 6. 10/21/2012 Races'12 6 Need for causal delays A B D CC B->next = D; wait-for-readers(); free(C);
  • 7. 10/21/2012 Races'12 7 Rules for Placing Relativistic Programming Primitives 1. Write globally visible pointers with rp_publish() 2. When performing two writes, one earlier in traversal order and one later in traversal order, separate the two with wait-for-readers()
  • 8. 10/21/2012 Races'12 8 Relativistic vs. Concurrent Balanced Trees •Relativistic Red Black Trees •Concurrent AVL Trees A practical concurrent binary search tree. PPoPP ’10; Bronson et al
  • 9. 10/21/2012 Races'12 9 Concurrent AVL get 20 V get(K k) { 21 return (V)attemptGet(k, rootHolder, 1, 0); 22 } 23 24 Object attemptGet( 25 K k, Node node, int dir, long nodeV) { 26 while (true) { 27 Node child = node.child(dir); 28 if (((node.version^nodeV) & IgnoreGrow) != 0) 29 return Retry; 30 if (child == null) 31 return null; 32 int nextD = k.compareTo(child.key); 33 if (nextD == 0) 34 return child.value; 35 long chV = child.version; 36 if ((chV & Shrinking) != 0) { 37 waitUntilNotChanging(child); 38 } else if (chV != Unlinked && 39 child == node.child(dir)) { 40 if (((node.version^nodeV) & IgnoreGrow) != 0) 41 return Retry; 42 Object p = attemptGet(k, child, nextD, chV); 43 if (p != Retry)
  • 10. 10/21/2012 Races'12 10 Relativistic RBTree Get void *rb_find(rbtree *tree, long key) { void *value; rbnode_t *node = tree->root; start_read(); while (node != NULL) { if (key == node->key) break; else if (key < node->key) node = rp-dereference(node->left); else node = rp-dereference(node->right); } if (node != NULL) value = node->value; else value = NULL;
  • 12. 10/21/2012 Races'12 12 RP Delete rbnode_t *new_node = rbnode_copy(swap); rp-publish(new_node->left, node->left); node->left->parent = new_node; rp-publish(new_node->right, node->right); node->right->parent = new_node; if (is_left(node)) rp-publish(prev->left, new_node); else rp-publish (prev->right, new_node); new_node->parent = prev; // need to make sure new_node is seen before path to b is erased wait-for-readers(tree->lock); prev = swap->parent; next = swap->right; rp-publish(prev->left, swap->right); if (swap->right != NULL) swap->right->parent = prev;
  • 13. 10/21/2012 Races'12 13 0 7500000 15000000 22500000 30000000 0 18 35 53 70 Read Performance Reads/Sec Read Threads NOLOCK reads NOLOCK cont. reads RP reads RP cont. reads ccavl reads ccavl cont. reads
  • 14. 10/21/2012 Races'12 14 0 50000 100000 150000 200000 0 18 35 53 70 Contended Write Performance Writes/sec Read Threads NOLOCK writes RP writes ccavl writes
  • 15. 10/21/2012 Races'12 15 Benefits of RP • High performance, Highly scalable reads • Simple Code • Strong correctness properties