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
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
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?
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?
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?
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?
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?
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?
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?
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
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
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
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
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
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
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
The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about
The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP � encapsulation � ✤ memory management � ✤ multiple inheritance ✤
The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP � encapsulation � ✤ memory management � ✤ multiple inheritance ✤ C++ —> Java —> Scala
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
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
The Quest for good Abstractions Expressiveness � Easy to think � Performance Easy to reason about ✤ OOP which abstractions � interoperate � ✤ Types productively? ✤ Functional Programming
The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models…
The Quest for good Abstractions Concurrency Abstractions? � Many Concurreny Models… ✤ Shared Memory Model and “Java Threads”
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()
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)
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)
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)
Many Concurrency Models ✤ Shared Memory which abstractions � interoperate � productively? ✤ Message Passing Model ✤ GPU Concurrency Model
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 :
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
Explore More Topics
Stay informed with curated content and fresh updates.