concurrency theory vs concurrent languages
play

Concurrency Theory vs Concurrent Languages Silvia Crafa Universita - PowerPoint PPT Presentation

Concurrency Theory vs Concurrent Languages Silvia Crafa Universita di Padova Bertinoro, OPCT 2014 Bisimulation inside Concurrency Theory vs Concurrent Languages Silvia Crafa Universita di Padova Bertinoro, OPCT 2014


  1. Concurrency Theory vs Concurrent Languages Silvia Crafa � Universita’ di Padova � Bertinoro, OPCT 2014

  2. Bisimulation inside Concurrency Theory vs Concurrent Languages Silvia Crafa � Universita’ di Padova � Bertinoro, OPCT 2014

  3. The Quest for good Abstractions Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  4. The Quest for good Abstractions Add structure � to the code Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  5. The Quest for good Abstractions OOP to handle � industrial complex � software systems � Encapsulation/Modularity Add structure � Interfaces/Code Reuse to the code Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  6. The Quest for good Abstractions OOP to handle � industrial complex � software systems � Encapsulation/Modularity Add structure � Interfaces/Code Reuse to the code Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  7. The Quest for good Abstractions less Efficiency � OOP to handle � industrial complex � more Portability � software systems � Security (Types) � Encapsulation/Modularity Add structure � GUIs and IDEs Interfaces/Code Reuse to the code Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  8. The Quest for good Abstractions less Efficiency � OOP to handle � industrial complex � more Portability � software systems � Security (Types) � Productivity � Encapsulation/Modularity Add structure � Types are burdensome GUIs and IDEs Interfaces/Code Reuse to the code Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  9. The Quest for good Abstractions less Efficiency � OOP to handle � industrial complex � more Portability � software systems � Security (Types) � Productivity � Encapsulation/Modularity Add structure � Types are burdensome GUIs and IDEs Interfaces/Code Reuse to the code Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET CONCURRENCY ✤ When a language has been invented VS when became popular ? � ✤ Why has been invented VS why became popular?

  10. The Quest for good Abstractions Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET CONCURRENCY ✤ Changes need a catalyser

  11. The Quest for good Abstractions Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET CONCURRENCY ✤ Changes need a catalyser ✤ new hardware can only be parallel � ✤ new software must be concurrent

  12. The Quest for good Abstractions Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET CONCURRENCY Popular ✤ Changes need a catalyser Parallel Programming ✤ new hardware can only be parallel � Grand Challenge ✤ new software must be concurrent

  13. How hard is Concurrent Programming? ✤ (correct) concurrent programming is difficult � Intrinsic reasons � nondeterminism ✤ Adding concurrency to sequential code is even harder Accidental reasons � improper � programming model

  14. How hard is Concurrent Programming? ✤ (correct) concurrent programming is difficult � Intrinsic reasons � nondeterminism ✤ Adding concurrency to sequential code is even harder Accidental reasons � improper � programming model Think concurrently � Translate into � (Concurrent Algorithm) a concurrent code

  15. How hard is Concurrent Programming? ✤ (correct) concurrent programming is difficult � Intrinsic reasons � nondeterminism ✤ Adding concurrency to sequential code is even harder Accidental reasons � improper � programming model Think concurrently � Translate into � (Concurrent Algorithm) a concurrent code DESIGN of � concurrent language

  16. How hard is Concurrent Programming? ✤ (correct) concurrent programming is difficult � Intrinsic reasons � nondeterminism ✤ Adding concurrency to sequential code is even harder Accidental reasons � improper � programming model Think concurrently � Translate into � (Concurrent Algorithm) a concurrent code High-level DESIGN of � concurrent language Concurrency Abstraction

  17. The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about

  18. The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP � encapsulation � ✤ memory management � ✤ multiple inheritance ✤

  19. The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP � encapsulation � ✤ memory management � ✤ multiple inheritance ✤ C++ —> Java —> Scala

  20. The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP � encapsulation � ✤ ✤ Types � memory management � ✤ multiple inheritance documentation vs verbosity ✤ ✤ C++ —> Java —> Ruby —>Scala C++ —> Java —> Scala

  21. The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP � encapsulation � ✤ ✤ Types � memory management � ✤ multiple inheritance documentation vs verbosity ✤ ✤ C++ —> Java —> Ruby —>Scala C++ —> Java —> Scala ✤ Functional Programming � composing and passing behaviours � ✤ sometimes imperative style is easier to reason about ✤ C#—> Scala C++11, Java8

  22. The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP which abstractions � interoperate � ✤ Types productively? ✤ Functional Programming

  23. The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models…

  24. The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models… ✤ Shared Memory Model and “Java Threads”

  25. The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models… ✤ Shared Memory Model and “Java Threads” STM Java X10 synchronized(lock) � atomic {…} � async{} � lock.wait() � when(cond){…} finish{} lock.notify()

  26. The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models… ✤ Shared Memory Model and “Java Threads” STM Java X10 synchronized(lock) � atomic {…} � async{} � lock.wait() � when(cond){…} finish{} lock.notify() Scalability! logical threads distinguished from executors ✤ (activities/tasks) (pool of thread workers)

  27. The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models… ✤ Shared Memory Model and “Java Threads” STM Java X10 synchronized(lock) � atomic {…} � async{} � lock.wait() � when(cond){…} finish{} lock.notify() Lightweight threads in the program � new Thread().start() � Pool of Executors in the runtime JVM thread Scalability! logical threads distinguished from executors ✤ (activities/tasks) (pool of thread workers)

  28. Many Concurrency Models ✤ Shared Memory � is very natural for “centralised algorithms” ✤ and components operating on shared data � is error-prone when the sole purpose of SM ✤ is thread communication ✤ Message Passing Model � It is the message that carries the state! � ✤ C hannel based : Google’s GO � ✤ Actor Model : Erlang, Scala. It fits well ✤ both OOP and FP � ✤ GPU Concurrency Model � Sessions ✤ Massive data parallelism � ✤ integration with high-level concurrent language ✤ (X10, Nova, Scala heterogeneous compiler)

  29. Many Concurrency Models ✤ Shared Memory which abstractions � interoperate � productively? ✤ Message Passing Model ✤ GPU Concurrency Model

  30. The Quest for good Abstractions Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET CONCURRENCY ✤ New catalyser :

  31. The Quest for good Abstractions Fortran � Pascal C � C++ � JavaScript Go Java C# Lisp � Ruby � ML Haskell Scala X10 PHP Cobol Python INTERNET CONCURRENCY DISTRIBUTION ✤ New catalyser : ✤ multicore —> concurrent programming � ✤ cloud computing —> distributed programming

Recommend


More recommend