SlideShare a Scribd company logo
1 of 25
Download to read offline
Computational models in software
engineering
Dmitry Zagorulkin (zagorulkinde@me.com)
Concurrency in practice:
• - Distributed systems;
• - Fault tolerant systems;
• - Mobile systems(mobile phones network, vertices
may connect and disconnect);
• - Parallel systems(running on one node)
Concurrency communication
types:
• Shared memory – usually required the application of
some form of locking. (e.g. mutexes, semaphores,
monitors).
Java/C#
• Message passing – concurrent components
communicate by exchanging messages. Can be done
in synchronous/asynchronous way. Mostly used in
functional programming languages.
Erlang/Scala(Akka)
Shared memory example
Shared memory example
Shared memory example
• Execution # • Synchronized • Not synchronized
1
Incr: 100000000

Decr: 0
Decr: 67356100

Incr: 67356100
2
Incr: 100000000

Decr: 0
Decr: -88564700

Incr: 1407800
3
Incr: 100000000

Decr: 0
Decr: -86920200

Incr: -1667800
Shared memory
• Advantages:
• easy to write such code
• deterministic behaviour
• Disadvantages:
• wrong waste of computer resources
• locking on resource
• hard to scale such code
Message passing example
Message passing example
Message passing
• Advantages:
• scalability out of the box
• possible to use in real time systems
• Disadvantages:
• hard to debug
• hard write code in such style
Models of computation
• λ (lambda) calculus by Church and Kleene (1941);
• π (pi) calculus by Milner et. al. (1992);
• Actor model (1973) by Hewitt et. al;
• Join calculus (1996) by Fournet and Conthier;
• Mobile ambients (2000) by Cardelli and Gordon.
λ (lambda) calculus
• Used as a foundation for sequential computation;
• Heart of functional programming languages;
• Turing-complete; any computable function can be
expressed and evaluated using the calculus;
• In the λ calculus, all functions may only have one
variable;
λ (lambda) calculus
• Function: λx.x2 ( the same f (x) = x2)

• Function application: (λx.x2 2) 22 4. ( the same f (2) = 4)
• Currying and High order functions:

h(x,y) = x + y, h: (Z x Z) -> Z

f : Z -> ( Z -> Z) and gx : Z -> Z

Example 

f(2) = g2, where g2(y) = 2 + y.

f(2)(3) = g2(3) = 2 + 3 = 5

in lambda calculus this function with currying by:

λx.λy.x + y.
(λx.λy.x+y 2) 3) (λy.2+y 3) 2+3 5.

• Functions that operate on functions - ‘first class values’, so function may be
used as the inputs, or be returned as outputs from other functions.
π (pi) calculus
• Pi calculus is a formal model for specification, analysis, and
verification of systems composed of communicating
concurrent processes.
• Concurrent computation is modeled in the Pi calculus as
processes communicating over share channels.
• Calculus consist of processes {P,Q,…R}, channel names
{a,b…c}, interaction (reading, writing) is denoted by prefix α.
• A simple interaction between two processes over a channel
a can be modeled as follows in the π calculus: a(x).P | āb.Q
Actor model
• Asynchronous communication between nodes
• Every actor has it’s own identity ( used for communication)
• In response to message, an actor a may perform following:
1. send a message to a friend(acquaintance), an actor
whose identity is known to the actor a
2. create a new actor a’, with a given behaviour b
3. become ready to receive a new message with new
behaviour b.
Actor model
Problems
• Reference cell problem (a cell contains mutable state.
A simple cell can be created, updated, and queried by
other concurrent computations) – illustrates
nondeterminism problem;
• Mutual exclusion (refers to the need of two or more
concurrent computations to coordinate and avoid
executing at the same some critical region of code) – A
useful abstraction for guaranteeing mutual exclusion is
the notion of semaphores;
Problems
• Dining Philosophers – A typical example of
complexities of concurrent computation is the famous
dining philosophers scenario. Consider n
philosophiers, Ph1, … , Phn -1, dining at a round table
containing n chopsticks ch1, … , chn-1 where each
chopstick is shared by two consecutive philosophers.
– illustrates deadlock problem.
Dining philosophers algorithm
1. Pick left chopstick (if available)
2. Pick right chopstick (if available)
3. Eat
4. Release both chopsticks
5. Think
6. Go to 1
Actor language syntax
Actor model(reference cell problem)
Actor model(mutual exclusion)
Actor model(dining philosophers)
Alan Kay about OOP
• “I thought of objects being like biological cells and/or
individual computers on a network, only able to
communicate with messages (so messaging came at
the very beginning -- it took a while to see how to do
messaging in a programming language efficiently
enough to be useful)” – Alan Kay.
Further Reading
• Programming distributed computing systems (A
foundational approach) Carlos A. Varela
• Making reliable distributed systems in the presence of
software errors JOE Armstrong

More Related Content

What's hot

What's hot (20)

Stack and heap allocation
Stack and heap allocationStack and heap allocation
Stack and heap allocation
 
Recursion Lecture in Java
Recursion Lecture in JavaRecursion Lecture in Java
Recursion Lecture in Java
 
Java Foundations: Methods
Java Foundations: MethodsJava Foundations: Methods
Java Foundations: Methods
 
3 recursion
3 recursion3 recursion
3 recursion
 
06 linked list
06 linked list06 linked list
06 linked list
 
Advanced data structures slide 2 2+
Advanced data structures slide 2 2+Advanced data structures slide 2 2+
Advanced data structures slide 2 2+
 
13 recursion-120712074623-phpapp02
13 recursion-120712074623-phpapp0213 recursion-120712074623-phpapp02
13 recursion-120712074623-phpapp02
 
StringTokenizer in java
StringTokenizer in javaStringTokenizer in java
StringTokenizer in java
 
13. Java text processing
13.  Java text processing13.  Java text processing
13. Java text processing
 
Java Foundations: Data Types and Type Conversion
Java Foundations: Data Types and Type ConversionJava Foundations: Data Types and Type Conversion
Java Foundations: Data Types and Type Conversion
 
Stack and Heap
Stack and HeapStack and Heap
Stack and Heap
 
Cpphtp4 ppt 03
Cpphtp4 ppt 03Cpphtp4 ppt 03
Cpphtp4 ppt 03
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set18. Dictionaries, Hash-Tables and Set
18. Dictionaries, Hash-Tables and Set
 
C++ Standard Template Library
C++ Standard Template LibraryC++ Standard Template Library
C++ Standard Template Library
 
(Recursion)ads
(Recursion)ads(Recursion)ads
(Recursion)ads
 
Java Foundations: Arrays
Java Foundations: ArraysJava Foundations: Arrays
Java Foundations: Arrays
 
Core java day2
Core java day2Core java day2
Core java day2
 
Method overloading in java
Method overloading in javaMethod overloading in java
Method overloading in java
 
Functions reading passage
Functions reading passageFunctions reading passage
Functions reading passage
 

Similar to Computational models and concurrency patterns in software

Scala for Machine Learning
Scala for Machine LearningScala for Machine Learning
Scala for Machine LearningPatrick Nicolas
 
Probabilistic programming2
Probabilistic programming2Probabilistic programming2
Probabilistic programming2bredelings
 
Recurrent Neural Networks, LSTM and GRU
Recurrent Neural Networks, LSTM and GRURecurrent Neural Networks, LSTM and GRU
Recurrent Neural Networks, LSTM and GRUananth
 
Accelerating Key Bioinformatics Tasks 100-fold by Improving Memory Access
Accelerating Key Bioinformatics Tasks 100-fold by Improving Memory AccessAccelerating Key Bioinformatics Tasks 100-fold by Improving Memory Access
Accelerating Key Bioinformatics Tasks 100-fold by Improving Memory AccessIgor Sfiligoi
 
Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?greenwop
 
Software Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniquesSoftware Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniquesAngelos Kapsimanis
 
S-CUBE LP: Executing the HOCL: Concept of a Chemical Interpreter
S-CUBE LP: Executing the HOCL: Concept of a Chemical InterpreterS-CUBE LP: Executing the HOCL: Concept of a Chemical Interpreter
S-CUBE LP: Executing the HOCL: Concept of a Chemical Interpretervirtual-campus
 
[Paper Reading] Attention is All You Need
[Paper Reading] Attention is All You Need[Paper Reading] Attention is All You Need
[Paper Reading] Attention is All You NeedDaiki Tanaka
 
The theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerThe theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerRoman Elizarov
 
Ch-7-Part-2-Distributed-System.pptx
Ch-7-Part-2-Distributed-System.pptxCh-7-Part-2-Distributed-System.pptx
Ch-7-Part-2-Distributed-System.pptxKabindra Koirala
 
Presentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional ProgrammingPresentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional ProgrammingFilip De Sutter
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency ConstructsTed Leung
 
Fuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional ProgrammingFuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional ProgrammingShine Xavier
 
Gráficas en python
Gráficas en python Gráficas en python
Gráficas en python Jhon Valle
 
Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...
Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...
Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...Universitat Politècnica de Catalunya
 

Similar to Computational models and concurrency patterns in software (20)

Clojure intro
Clojure introClojure intro
Clojure intro
 
Scala for Machine Learning
Scala for Machine LearningScala for Machine Learning
Scala for Machine Learning
 
Probabilistic programming2
Probabilistic programming2Probabilistic programming2
Probabilistic programming2
 
Recurrent Neural Networks, LSTM and GRU
Recurrent Neural Networks, LSTM and GRURecurrent Neural Networks, LSTM and GRU
Recurrent Neural Networks, LSTM and GRU
 
Accelerating Key Bioinformatics Tasks 100-fold by Improving Memory Access
Accelerating Key Bioinformatics Tasks 100-fold by Improving Memory AccessAccelerating Key Bioinformatics Tasks 100-fold by Improving Memory Access
Accelerating Key Bioinformatics Tasks 100-fold by Improving Memory Access
 
Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?Programming Language Memory Models: What do Shared Variables Mean?
Programming Language Memory Models: What do Shared Variables Mean?
 
Software Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniquesSoftware Architectures, Week 2 - Decomposition techniques
Software Architectures, Week 2 - Decomposition techniques
 
S-CUBE LP: Executing the HOCL: Concept of a Chemical Interpreter
S-CUBE LP: Executing the HOCL: Concept of a Chemical InterpreterS-CUBE LP: Executing the HOCL: Concept of a Chemical Interpreter
S-CUBE LP: Executing the HOCL: Concept of a Chemical Interpreter
 
[Paper Reading] Attention is All You Need
[Paper Reading] Attention is All You Need[Paper Reading] Attention is All You Need
[Paper Reading] Attention is All You Need
 
The theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmerThe theory of concurrent programming for a seasoned programmer
The theory of concurrent programming for a seasoned programmer
 
Elixir
ElixirElixir
Elixir
 
Hoard_2022AIM1001.pptx.pdf
Hoard_2022AIM1001.pptx.pdfHoard_2022AIM1001.pptx.pdf
Hoard_2022AIM1001.pptx.pdf
 
P J020
P J020P J020
P J020
 
Ch-7-Part-2-Distributed-System.pptx
Ch-7-Part-2-Distributed-System.pptxCh-7-Part-2-Distributed-System.pptx
Ch-7-Part-2-Distributed-System.pptx
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Presentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional ProgrammingPresentation of GetTogether on Functional Programming
Presentation of GetTogether on Functional Programming
 
A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency Constructs
 
Fuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional ProgrammingFuel Up JavaScript with Functional Programming
Fuel Up JavaScript with Functional Programming
 
Gráficas en python
Gráficas en python Gráficas en python
Gráficas en python
 
Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...
Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...
Multilayer Perceptron (DLAI D1L2 2017 UPC Deep Learning for Artificial Intell...
 

Recently uploaded

Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫qfactory1
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentationtahreemzahra82
 
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRCall Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRlizamodels9
 
Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)DHURKADEVIBASKAR
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett SquareIsiahStephanRadaza
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfSwapnil Therkar
 
Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |aasikanpl
 
Twin's paradox experiment is a meassurement of the extra dimensions.pptx
Twin's paradox experiment is a meassurement of the extra dimensions.pptxTwin's paradox experiment is a meassurement of the extra dimensions.pptx
Twin's paradox experiment is a meassurement of the extra dimensions.pptxEran Akiva Sinbar
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Temporomandibular joint Muscles of Mastication
Temporomandibular joint Muscles of MasticationTemporomandibular joint Muscles of Mastication
Temporomandibular joint Muscles of Masticationvidulajaib
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxmalonesandreagweneth
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.PraveenaKalaiselvan1
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxpriyankatabhane
 
Solution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutionsSolution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutionsHajira Mahmood
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trssuser06f238
 

Recently uploaded (20)

Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫Manassas R - Parkside Middle School 🌎🏫
Manassas R - Parkside Middle School 🌎🏫
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentation
 
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRCall Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
 
Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett Square
 
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdfAnalytical Profile of Coleus Forskohlii | Forskolin .pdf
Analytical Profile of Coleus Forskohlii | Forskolin .pdf
 
Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Hauz Khas Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
 
Twin's paradox experiment is a meassurement of the extra dimensions.pptx
Twin's paradox experiment is a meassurement of the extra dimensions.pptxTwin's paradox experiment is a meassurement of the extra dimensions.pptx
Twin's paradox experiment is a meassurement of the extra dimensions.pptx
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
Temporomandibular joint Muscles of Mastication
Temporomandibular joint Muscles of MasticationTemporomandibular joint Muscles of Mastication
Temporomandibular joint Muscles of Mastication
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
 
Solution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutionsSolution chemistry, Moral and Normal solutions
Solution chemistry, Moral and Normal solutions
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 tr
 

Computational models and concurrency patterns in software

  • 1. Computational models in software engineering Dmitry Zagorulkin (zagorulkinde@me.com)
  • 2. Concurrency in practice: • - Distributed systems; • - Fault tolerant systems; • - Mobile systems(mobile phones network, vertices may connect and disconnect); • - Parallel systems(running on one node)
  • 3. Concurrency communication types: • Shared memory – usually required the application of some form of locking. (e.g. mutexes, semaphores, monitors). Java/C# • Message passing – concurrent components communicate by exchanging messages. Can be done in synchronous/asynchronous way. Mostly used in functional programming languages. Erlang/Scala(Akka)
  • 6. Shared memory example • Execution # • Synchronized • Not synchronized 1 Incr: 100000000 Decr: 0 Decr: 67356100 Incr: 67356100 2 Incr: 100000000 Decr: 0 Decr: -88564700 Incr: 1407800 3 Incr: 100000000 Decr: 0 Decr: -86920200 Incr: -1667800
  • 7. Shared memory • Advantages: • easy to write such code • deterministic behaviour • Disadvantages: • wrong waste of computer resources • locking on resource • hard to scale such code
  • 10. Message passing • Advantages: • scalability out of the box • possible to use in real time systems • Disadvantages: • hard to debug • hard write code in such style
  • 11. Models of computation • λ (lambda) calculus by Church and Kleene (1941); • π (pi) calculus by Milner et. al. (1992); • Actor model (1973) by Hewitt et. al; • Join calculus (1996) by Fournet and Conthier; • Mobile ambients (2000) by Cardelli and Gordon.
  • 12. λ (lambda) calculus • Used as a foundation for sequential computation; • Heart of functional programming languages; • Turing-complete; any computable function can be expressed and evaluated using the calculus; • In the λ calculus, all functions may only have one variable;
  • 13. λ (lambda) calculus • Function: λx.x2 ( the same f (x) = x2) • Function application: (λx.x2 2) 22 4. ( the same f (2) = 4) • Currying and High order functions: h(x,y) = x + y, h: (Z x Z) -> Z f : Z -> ( Z -> Z) and gx : Z -> Z Example f(2) = g2, where g2(y) = 2 + y. f(2)(3) = g2(3) = 2 + 3 = 5 in lambda calculus this function with currying by: λx.λy.x + y. (λx.λy.x+y 2) 3) (λy.2+y 3) 2+3 5. • Functions that operate on functions - ‘first class values’, so function may be used as the inputs, or be returned as outputs from other functions.
  • 14. π (pi) calculus • Pi calculus is a formal model for specification, analysis, and verification of systems composed of communicating concurrent processes. • Concurrent computation is modeled in the Pi calculus as processes communicating over share channels. • Calculus consist of processes {P,Q,…R}, channel names {a,b…c}, interaction (reading, writing) is denoted by prefix α. • A simple interaction between two processes over a channel a can be modeled as follows in the π calculus: a(x).P | āb.Q
  • 15. Actor model • Asynchronous communication between nodes • Every actor has it’s own identity ( used for communication) • In response to message, an actor a may perform following: 1. send a message to a friend(acquaintance), an actor whose identity is known to the actor a 2. create a new actor a’, with a given behaviour b 3. become ready to receive a new message with new behaviour b.
  • 17. Problems • Reference cell problem (a cell contains mutable state. A simple cell can be created, updated, and queried by other concurrent computations) – illustrates nondeterminism problem; • Mutual exclusion (refers to the need of two or more concurrent computations to coordinate and avoid executing at the same some critical region of code) – A useful abstraction for guaranteeing mutual exclusion is the notion of semaphores;
  • 18. Problems • Dining Philosophers – A typical example of complexities of concurrent computation is the famous dining philosophers scenario. Consider n philosophiers, Ph1, … , Phn -1, dining at a round table containing n chopsticks ch1, … , chn-1 where each chopstick is shared by two consecutive philosophers. – illustrates deadlock problem.
  • 19. Dining philosophers algorithm 1. Pick left chopstick (if available) 2. Pick right chopstick (if available) 3. Eat 4. Release both chopsticks 5. Think 6. Go to 1
  • 24. Alan Kay about OOP • “I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning -- it took a while to see how to do messaging in a programming language efficiently enough to be useful)” – Alan Kay.
  • 25. Further Reading • Programming distributed computing systems (A foundational approach) Carlos A. Varela • Making reliable distributed systems in the presence of software errors JOE Armstrong