More Than Java Concurrency                             Darren.Wang(   强)Thursday, January 20, 2011
Agenda                      More Than Java Concurrency? What’s More?                      Several Concurrency Models/Patte...
Why concurrency?Thursday, January 20, 2011
What concurrency                offers                      reduce latency                             divide and conquer,...
What we do with                Java Concurrency                        State             , That’s all of the about.       ...
When Things Go      WrongThursday, January 20, 2011
What If ...Thursday, January 20, 2011
What We Will Talk                Today                      Share-State Concurrency                      Share-Nothing Con...
Share-State                             ConcurrencyThursday, January 20, 2011
JMM Simplified                                     Picture borrowed from <<Java   >>Thursday, January 20, 2011
JMM escalationThursday, January 20, 2011
How to deal with?                      How many ways can you count?                      Here we go...Thursday, January 20...
Immutability                      immutable anytime                             Immutable Object                      immu...
Confinement                      Thread Confinement                             Thread-Specific Variables(ThreadLocal)    ...
Synchronization                      Synchronized Block(Implicit Lock)                      Explicit Lock                 ...
Gotchas With                             Synchronization                      Deadlock                             how to ...
Gotchas With                             Synchronization                      Deadlock                             how to ...
Gotchas With                             Synchronization                      Deadlock                             how to ...
Performance Tuning                with Synchronization                      reduce the time of holding locks              ...
CAS                      Compare-And-Set | Compare-And-Swap                      java.util.concurrent.atomic after Java5  ...
Section Conclusion                      Pessimistic Model                             Lock-Based                      Opti...
Share-Nothing                              ConcurrencyThursday, January 20, 2011
Share-Nothing                              Concurrency                      AKA. Message Passing Concurrency              ...
Actor Model                      First proposed by Carl Hewitt in 1973                      improved by Gul Agha          ...
Actor Rocks                      more light weight                             event based actors of akka can create      ...
Actors Available                      Erlang Platform                      Scala Platform                             TBA,...
Actor Almighty?                      when we really have shared states, e.g. bank                      account?           ...
Section Conclusion                      Actor Model Rocks In Some Situations, But not                      all            ...
You Know Lego,                Right?Thursday, January 20, 2011
Case Study I                      Session Management                             Centralized Storage                      ...
Case Study II                      Map-Reduce                             When Share Nothing can rock in                  ...
Case Study III                      Symmetric Cluster                             Share Nothing                      Asymm...
STM                      Software Transaction Memory                      Transaction operations execute in the own       ...
Sounds Familiar?                      Optimistic Model                      Can be nested                      Simple Prog...
Available Solutions                      Clojure                      Concurrent Haskell                      STM .Net    ...
Cons                      All operations in scope of a transaction:                             need to be idempotent     ...
Section Conclusion                      optimistic model                      simple programming model                    ...
Data-Flow    Concurrency                      AKA. Declarative ConcurrencyThursday, January 20, 2011
Have you ever...Thursday, January 20, 2011
Features                      Single Assignment Variables                      Data-States trigger process flowThursday, J...
Available                Languages                      LabViewThursday, January 20, 2011
Usage Scenarios                      Signal Process SystemThursday, January 20, 2011
Typical Operations                      create a data-flow variable                      wait for the variable to be bound...
Limitations                      Can’t have side-effects                             Exceptions                           ...
Section Conclusion                      Data Based ConcurrencyThursday, January 20, 2011
comparison of                         common facilities                      Executor (Agent)                      Actor (...
Thursday, January 20, 2011
Thank YouThursday, January 20, 2011
The EndThursday, January 20, 2011
Upcoming SlideShare
Loading in...5
×

More Than Java Concurrency

2,618

Published on

more choices for java's default share-state concurrency model

the doc is incomplete

Published in: Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,618
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
100
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

More Than Java Concurrency

  1. 1. More Than Java Concurrency Darren.Wang( 强)Thursday, January 20, 2011
  2. 2. Agenda More Than Java Concurrency? What’s More? Several Concurrency Models/Patterns Case Study Questions? The endThursday, January 20, 2011
  3. 3. Why concurrency?Thursday, January 20, 2011
  4. 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 powerThursday, January 20, 2011
  5. 5. What we do with Java Concurrency State , That’s all of the about. Atomicity - keep state intact Visibility - make right state accessThursday, January 20, 2011
  6. 6. When Things Go WrongThursday, January 20, 2011
  7. 7. What If ...Thursday, January 20, 2011
  8. 8. What We Will Talk Today Share-State Concurrency Share-Nothing Concurrency Software Transaction Memory Data-Flow ConcurrencyThursday, January 20, 2011
  9. 9. Share-State ConcurrencyThursday, January 20, 2011
  10. 10. JMM Simplified Picture borrowed from <<Java >>Thursday, January 20, 2011
  11. 11. JMM escalationThursday, January 20, 2011
  12. 12. How to deal with? How many ways can you count? Here we go...Thursday, January 20, 2011
  13. 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. 14. Confinement Thread Confinement Thread-Specific Variables(ThreadLocal) Stack Confinement Method Stack ScopeThursday, January 20, 2011
  15. 15. Synchronization Synchronized Block(Implicit Lock) Explicit Lock Volatile (Partial Synchronization Support)Thursday, January 20, 2011
  16. 16. Gotchas With Synchronization Deadlock how to prevent it? Live lock StarvationThursday, January 20, 2011
  17. 17. Gotchas With Synchronization Deadlock how to prevent it? Resource Re-ordering Live lock StarvationThursday, January 20, 2011
  18. 18. Gotchas With Synchronization Deadlock how to prevent it? Resource Re-ordering Periodic Retry Live lock StarvationThursday, January 20, 2011
  19. 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. 20. CAS Compare-And-Set | Compare-And-Swap java.util.concurrent.atomic after Java5 AtomicInteger AtomicLong AtomicBoolean AtomicReferenceThursday, January 20, 2011
  21. 21. Section Conclusion Pessimistic Model Lock-Based Optimistic Model Lock-FreeThursday, January 20, 2011
  22. 22. Share-Nothing ConcurrencyThursday, January 20, 2011
  23. 23. Share-Nothing Concurrency AKA. Message Passing Concurrency Confinement In a Big PictureThursday, January 20, 2011
  24. 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 hostThursday, January 20, 2011
  25. 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 ! tickThursday, January 20, 2011
  26. 26. Actors Available Erlang Platform Scala Platform TBA, EBA Lift Actor, Akka Actor Java Platform Kilim, SALSA(simple actor language, system and architecture) OtherThursday, January 20, 2011
  27. 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 dispatchThursday, January 20, 2011
  28. 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 PossibleThursday, January 20, 2011
  29. 29. You Know Lego, Right?Thursday, January 20, 2011
  30. 30. Case Study I Session Management Centralized Storage memcached, database... Client-Specific Storage secure cookie other local-storage mechanismThursday, January 20, 2011
  31. 31. Case Study II Map-Reduce When Share Nothing can rock in When Share State Is a MustThursday, January 20, 2011
  32. 32. Case Study III Symmetric Cluster Share Nothing Asymmetric Cluster Share StateThursday, January 20, 2011
  33. 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 retryThursday, January 20, 2011
  34. 34. Sounds Familiar? Optimistic Model Can be nested Simple Programming ModelThursday, January 20, 2011
  35. 35. Available Solutions Clojure Concurrent Haskell STM .Net More...Thursday, January 20, 2011
  36. 36. Cons All operations in scope of a transaction: need to be idempotent can’t have side-effects Memory Concern Conflicting Rate ConcernThursday, January 20, 2011
  37. 37. Section Conclusion optimistic model simple programming model with restrictions which may cause limitations(MS drops STM)Thursday, January 20, 2011
  38. 38. Data-Flow Concurrency AKA. Declarative ConcurrencyThursday, January 20, 2011
  39. 39. Have you ever...Thursday, January 20, 2011
  40. 40. Features Single Assignment Variables Data-States trigger process flowThursday, January 20, 2011
  41. 41. Available Languages LabViewThursday, January 20, 2011
  42. 42. Usage Scenarios Signal Process SystemThursday, January 20, 2011
  43. 43. Typical Operations create a data-flow variable wait for the variable to be bound bind the variableThursday, January 20, 2011
  44. 44. Limitations Can’t have side-effects Exceptions IO OthersThursday, January 20, 2011
  45. 45. Section Conclusion Data Based ConcurrencyThursday, January 20, 2011
  46. 46. comparison of common facilities Executor (Agent) Actor (HawtDispatch) STM Transactor(Actor + STM)Thursday, January 20, 2011
  47. 47. Thursday, January 20, 2011
  48. 48. Thank YouThursday, January 20, 2011
  49. 49. The EndThursday, January 20, 2011
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×