SlideShare a Scribd company logo
More Than Java
 Concurrency
                             Darren.Wang(   强)




Thursday, January 20, 2011
Agenda

                      More Than Java Concurrency? What’s More?

                      Several Concurrency Models/Patterns

                      Case Study

                      Questions?

                      The end



Thursday, January 20, 2011
Why concurrency?




Thursday, January 20, 2011
What concurrency
                offers
                      reduce latency

                             divide and conquer, run in parallel reduce
                             the latency

                      hide latency

                             asynchronous

                      increase throughput

                             more tasks can be run without wasting
                             available computing power
Thursday, January 20, 2011
What we do with
                Java Concurrency


                        State             , That’s all of the about.

                             Atomicity - keep state intact

                             Visibility - make right state access




Thursday, January 20, 2011
When Things Go
      Wrong




Thursday, January 20, 2011
What If ...




Thursday, January 20, 2011
What We Will Talk
                Today

                      Share-State Concurrency

                      Share-Nothing Concurrency

                      Software Transaction Memory

                      Data-Flow Concurrency




Thursday, January 20, 2011
Share-State
                             Concurrency




Thursday, January 20, 2011
JMM Simplified




                                     Picture borrowed from <<Java   >>
Thursday, January 20, 2011
JMM escalation




Thursday, January 20, 2011
How to deal with?



                      How many ways can you count?

                      Here we go...




Thursday, January 20, 2011
Immutability

                      immutable anytime

                             Immutable Object

                      immutable before publishing

                             Map & ConcurrencyMap


                                   (1)To Find More in book <<Java Concurrency In Practice>>




Thursday, January 20, 2011
Confinement


                      Thread Confinement

                             Thread-Specific Variables(ThreadLocal)

                      Stack Confinement

                             Method Stack Scope




Thursday, January 20, 2011
Synchronization


                      Synchronized Block(Implicit Lock)

                      Explicit Lock

                      Volatile (Partial Synchronization Support)




Thursday, January 20, 2011
Gotchas With
                             Synchronization
                      Deadlock

                             how to prevent it?




                      Live lock

                      Starvation


Thursday, January 20, 2011
Gotchas With
                             Synchronization
                      Deadlock

                             how to prevent it?

                              Resource Re-ordering



                      Live lock

                      Starvation


Thursday, January 20, 2011
Gotchas With
                             Synchronization
                      Deadlock

                             how to prevent it?

                              Resource Re-ordering
                              Periodic Retry

                      Live lock

                      Starvation


Thursday, January 20, 2011
Performance Tuning
                with Synchronization


                      reduce the time of holding locks

                             break global locks into fine-grained locks

                      what coming next?




Thursday, January 20, 2011
CAS

                      Compare-And-Set | Compare-And-Swap

                      java.util.concurrent.atomic after Java5

                             AtomicInteger

                             AtomicLong

                             AtomicBoolean

                             AtomicReference


Thursday, January 20, 2011
Section Conclusion


                      Pessimistic Model

                             Lock-Based

                      Optimistic Model

                             Lock-Free




Thursday, January 20, 2011
Share-Nothing
                              Concurrency




Thursday, January 20, 2011
Share-Nothing
                              Concurrency


                      AKA. Message Passing Concurrency

                      Confinement In a Big Picture




Thursday, January 20, 2011
Actor Model
                      First proposed by Carl Hewitt in 1973

                      improved by Gul Agha

                      An Actor Can:

                             change internal state

                             send messages to peer actors

                             create new actors

                             migrate to another computing host

Thursday, January 20, 2011
Actor Rocks

                      more light weight

                             event based actors of akka can create
                             6.5million on 4 G RAM (600 bytes each)

                      much easier, just send messages

                             counter ! tick




Thursday, January 20, 2011
Actors Available
                      Erlang Platform

                      Scala Platform

                             TBA, EBA

                             Lift Actor, Akka Actor

                      Java Platform

                             Kilim, SALSA(simple actor language, system
                             and architecture)

                      Other
Thursday, January 20, 2011
Actor Almighty?

                      when we really have shared states, e.g. bank
                      account?

                      when we need to form unified consensus

                      when we need synchronous behavior

                      a bit verbose compared to method dispatch




Thursday, January 20, 2011
Section Conclusion


                      Actor Model Rocks In Some Situations, But not
                      all

                      Share Nothing Simplify the Architecture Design

                      Prefer Share Nothing to Share State If Possible




Thursday, January 20, 2011
You Know Lego,
                Right?




Thursday, January 20, 2011
Case Study I

                      Session Management

                             Centralized Storage

                                memcached, database...

                             Client-Specific Storage

                                secure cookie

                                other local-storage mechanism


Thursday, January 20, 2011
Case Study II


                      Map-Reduce

                             When Share Nothing can rock in

                             When Share State Is a Must




Thursday, January 20, 2011
Case Study III


                      Symmetric Cluster

                             Share Nothing

                      Asymmetric Cluster

                             Share State




Thursday, January 20, 2011
STM


                      Software Transaction Memory

                      Transaction operations execute in the own
                      thread in parallel, commit will cause One to be
                      successful and others to abort or retry




Thursday, January 20, 2011
Sounds Familiar?


                      Optimistic Model

                      Can be nested

                      Simple Programming Model




Thursday, January 20, 2011
Available Solutions


                      Clojure

                      Concurrent Haskell

                      STM .Net

                      More...




Thursday, January 20, 2011
Cons

                      All operations in scope of a transaction:

                             need to be idempotent

                             can’t have side-effects

                      Memory Concern

                      Conflicting Rate Concern



Thursday, January 20, 2011
Section Conclusion


                      optimistic model

                      simple programming model

                      with restrictions

                             which may cause limitations(MS drops STM)




Thursday, January 20, 2011
Data-Flow
    Concurrency



                      AKA. Declarative Concurrency




Thursday, January 20, 2011
Have you ever...




Thursday, January 20, 2011
Features


                      Single Assignment Variables

                      Data-States trigger process flow




Thursday, January 20, 2011
Available
                Languages



                      LabView




Thursday, January 20, 2011
Usage Scenarios



                      Signal Process System




Thursday, January 20, 2011
Typical Operations


                      create a data-flow variable

                      wait for the variable to be bound

                      bind the variable




Thursday, January 20, 2011
Limitations


                      Can’t have side-effects

                             Exceptions

                             IO

                             Others




Thursday, January 20, 2011
Section Conclusion



                      Data Based Concurrency




Thursday, January 20, 2011
comparison of
                         common facilities

                      Executor (Agent)

                      Actor (HawtDispatch)

                      STM

                      Transactor(Actor + STM)




Thursday, January 20, 2011
Thursday, January 20, 2011
Thank You




Thursday, January 20, 2011
The End




Thursday, January 20, 2011

More Related Content

Viewers also liked

Proof and Emacs
Proof and EmacsProof and Emacs
Proof and Emacs
dico_leque
 
モナドをつくろう
モナドをつくろうモナドをつくろう
モナドをつくろう
dico_leque
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)Continuations in scala (incomplete version)
Continuations in scala (incomplete version)
Fuqiang Wang
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
Carol McDonald
 
Legend of Java Concurrency/Parallelism
Legend of Java Concurrency/ParallelismLegend of Java Concurrency/Parallelism
Legend of Java Concurrency/Parallelism
Yuichi Sakuraba
 
Zookeeper In Simple Words
Zookeeper In Simple WordsZookeeper In Simple Words
Zookeeper In Simple Words
Fuqiang Wang
 
Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrency
feng lee
 
[Java concurrency]01.thread management
[Java concurrency]01.thread management[Java concurrency]01.thread management
[Java concurrency]01.thread management
xuehan zhu
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
ducquoc_vn
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
Alex Miller
 
Java Concurrency, Memory Model, and Trends
Java Concurrency, Memory Model, and TrendsJava Concurrency, Memory Model, and Trends
Java Concurrency, Memory Model, and Trends
Carol McDonald
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and Concurrency
Anton Keks
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
Heartin Jacob
 
Java Concurrency in Practice
Java Concurrency in PracticeJava Concurrency in Practice
Java Concurrency in Practice
Alina Dolgikh
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practice
Mikalai Alimenkou
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
parag
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
Raghu nath
 
Java multi threading
Java multi threadingJava multi threading
Java multi threading
Raja Sekhar
 
Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in Java
Allan Huang
 

Viewers also liked (19)

Proof and Emacs
Proof and EmacsProof and Emacs
Proof and Emacs
 
モナドをつくろう
モナドをつくろうモナドをつくろう
モナドをつくろう
 
Continuations in scala (incomplete version)
Continuations in scala (incomplete version)Continuations in scala (incomplete version)
Continuations in scala (incomplete version)
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
 
Legend of Java Concurrency/Parallelism
Legend of Java Concurrency/ParallelismLegend of Java Concurrency/Parallelism
Legend of Java Concurrency/Parallelism
 
Zookeeper In Simple Words
Zookeeper In Simple WordsZookeeper In Simple Words
Zookeeper In Simple Words
 
Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrency
 
[Java concurrency]01.thread management
[Java concurrency]01.thread management[Java concurrency]01.thread management
[Java concurrency]01.thread management
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
Java Concurrency, Memory Model, and Trends
Java Concurrency, Memory Model, and TrendsJava Concurrency, Memory Model, and Trends
Java Concurrency, Memory Model, and Trends
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and Concurrency
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
 
Java Concurrency in Practice
Java Concurrency in PracticeJava Concurrency in Practice
Java Concurrency in Practice
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practice
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Java multi threading
Java multi threadingJava multi threading
Java multi threading
 
Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in Java
 

Recently uploaded

Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
GDSC PJATK
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 

Recently uploaded (20)

Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 

More Than Java Concurrency

  • 1. More Than Java Concurrency Darren.Wang( 强) Thursday, January 20, 2011
  • 2. Agenda More Than Java Concurrency? What’s More? Several Concurrency Models/Patterns Case Study Questions? The end Thursday, January 20, 2011
  • 4. What concurrency offers reduce latency divide and conquer, run in parallel reduce the latency hide latency asynchronous increase throughput more tasks can be run without wasting available computing power Thursday, January 20, 2011
  • 5. What we do with Java Concurrency State , That’s all of the about. Atomicity - keep state intact Visibility - make right state access Thursday, January 20, 2011
  • 6. When Things Go Wrong Thursday, January 20, 2011
  • 7. What If ... Thursday, January 20, 2011
  • 8. What We Will Talk Today Share-State Concurrency Share-Nothing Concurrency Software Transaction Memory Data-Flow Concurrency Thursday, January 20, 2011
  • 9. Share-State Concurrency Thursday, January 20, 2011
  • 10. JMM Simplified Picture borrowed from <<Java >> Thursday, January 20, 2011
  • 12. How to deal with? How many ways can you count? Here we go... Thursday, January 20, 2011
  • 13. Immutability immutable anytime Immutable Object immutable before publishing Map & ConcurrencyMap (1)To Find More in book <<Java Concurrency In Practice>> Thursday, January 20, 2011
  • 14. Confinement Thread Confinement Thread-Specific Variables(ThreadLocal) Stack Confinement Method Stack Scope Thursday, January 20, 2011
  • 15. Synchronization Synchronized Block(Implicit Lock) Explicit Lock Volatile (Partial Synchronization Support) Thursday, January 20, 2011
  • 16. Gotchas With Synchronization Deadlock how to prevent it? Live lock Starvation Thursday, January 20, 2011
  • 17. Gotchas With Synchronization Deadlock how to prevent it? Resource Re-ordering Live lock Starvation Thursday, January 20, 2011
  • 18. Gotchas With Synchronization Deadlock how to prevent it? Resource Re-ordering Periodic Retry Live lock Starvation Thursday, January 20, 2011
  • 19. Performance Tuning with Synchronization reduce the time of holding locks break global locks into fine-grained locks what coming next? Thursday, January 20, 2011
  • 20. CAS Compare-And-Set | Compare-And-Swap java.util.concurrent.atomic after Java5 AtomicInteger AtomicLong AtomicBoolean AtomicReference Thursday, January 20, 2011
  • 21. Section Conclusion Pessimistic Model Lock-Based Optimistic Model Lock-Free Thursday, January 20, 2011
  • 22. Share-Nothing Concurrency Thursday, January 20, 2011
  • 23. Share-Nothing Concurrency AKA. Message Passing Concurrency Confinement In a Big Picture Thursday, January 20, 2011
  • 24. Actor Model First proposed by Carl Hewitt in 1973 improved by Gul Agha An Actor Can: change internal state send messages to peer actors create new actors migrate to another computing host Thursday, January 20, 2011
  • 25. Actor Rocks more light weight event based actors of akka can create 6.5million on 4 G RAM (600 bytes each) much easier, just send messages counter ! tick Thursday, January 20, 2011
  • 26. Actors Available Erlang Platform Scala Platform TBA, EBA Lift Actor, Akka Actor Java Platform Kilim, SALSA(simple actor language, system and architecture) Other Thursday, January 20, 2011
  • 27. Actor Almighty? when we really have shared states, e.g. bank account? when we need to form unified consensus when we need synchronous behavior a bit verbose compared to method dispatch Thursday, January 20, 2011
  • 28. Section Conclusion Actor Model Rocks In Some Situations, But not all Share Nothing Simplify the Architecture Design Prefer Share Nothing to Share State If Possible Thursday, January 20, 2011
  • 29. You Know Lego, Right? Thursday, January 20, 2011
  • 30. Case Study I Session Management Centralized Storage memcached, database... Client-Specific Storage secure cookie other local-storage mechanism Thursday, January 20, 2011
  • 31. Case Study II Map-Reduce When Share Nothing can rock in When Share State Is a Must Thursday, January 20, 2011
  • 32. Case Study III Symmetric Cluster Share Nothing Asymmetric Cluster Share State Thursday, January 20, 2011
  • 33. STM Software Transaction Memory Transaction operations execute in the own thread in parallel, commit will cause One to be successful and others to abort or retry Thursday, January 20, 2011
  • 34. Sounds Familiar? Optimistic Model Can be nested Simple Programming Model Thursday, January 20, 2011
  • 35. Available Solutions Clojure Concurrent Haskell STM .Net More... Thursday, January 20, 2011
  • 36. Cons All operations in scope of a transaction: need to be idempotent can’t have side-effects Memory Concern Conflicting Rate Concern Thursday, January 20, 2011
  • 37. Section Conclusion optimistic model simple programming model with restrictions which may cause limitations(MS drops STM) Thursday, January 20, 2011
  • 38. Data-Flow Concurrency AKA. Declarative Concurrency Thursday, January 20, 2011
  • 39. Have you ever... Thursday, January 20, 2011
  • 40. Features Single Assignment Variables Data-States trigger process flow Thursday, January 20, 2011
  • 41. Available Languages LabView Thursday, January 20, 2011
  • 42. Usage Scenarios Signal Process System Thursday, January 20, 2011
  • 43. Typical Operations create a data-flow variable wait for the variable to be bound bind the variable Thursday, January 20, 2011
  • 44. Limitations Can’t have side-effects Exceptions IO Others Thursday, January 20, 2011
  • 45. Section Conclusion Data Based Concurrency Thursday, January 20, 2011
  • 46. comparison of common facilities Executor (Agent) Actor (HawtDispatch) STM Transactor(Actor + STM) Thursday, January 20, 2011