SlideShare uma empresa Scribd logo
1 de 59
Baixar para ler offline
Just Keep Passing
               the Messages


                                 Dr Russel Winder

                                   It’z Interactive Ltd
                                   russel@itzinteractive.com
                                   @russel_winder
Copyright © 2011 Russel Winder                                 1
Just Keep Passing
               the Messages


                                 Dr Russel Winder

                                   Concertant LLP
                                   russel.winder@concertant.com
                                   @russel_winder
Copyright © 2011 Russel Winder                                    2
Just Keep Passing
               the Messages


                                 Dr Russel Winder

                                   Independent Consultant
                                   russel@russel.org.uk
                                   @russel_winder
Copyright © 2011 Russel Winder                              3
Just Keep Passing
               the Messages


                                 Prof Russel Winder

                                   Wolverhampton University
                                   russel@russel.org.uk
                                   @russel_winder
Copyright © 2011 Russel Winder                                4
Aims and Objectives

                       ●    Investigate why message passing architectures are the
                            software architectures of the future.
                       ●    Have some fun (whilst hopefully learning something).




Copyright © 2011 Russel Winder                                                      5
Audience Aims and Objectives




                                 ?
Copyright © 2011 Russel Winder                 6
Structure of the Session

                       ●    Introduction.
                       ●    Do stuff.
                       ●    Exit stage (left|right|front|back).




                                                  There may well be significant
                                                  dynamic binding of the session.

Copyright © 2011 Russel Winder                                                      7
Protocol

                       ●    Some slides, to kick things off.
                       ●    Some programs to really demonstrate things.


                       ●    NB Interaction between audience and presenter is
                            probably mandatory.

                                     We reserve the right to (shelve|stash) for
                                     later any interaction that appears to go
                                     on longer than seems appropriate.


                                                               NB This is a 50min session!
Copyright © 2011 Russel Winder                                                               8
Enter Manic Mode




Copyright © 2011 Russel Winder                      9
BEGIN

                       ●    History is important:
                                 –   To know today, we look to yesterday. To know tomorrow,
                                     we see today as yesterday.
                                                http://wiki.answers.com/Q/Why_history_is_important
                                 –




Copyright © 2011 Russel Winder                                                                       10
Processes / Threads   Processes / RPC




                                                Threads / Shared memory



                                            Processes / IPC


                                      Multi-tasking


                                 One program at a time.

Copyright © 2011 Russel Winder                                                        11
Historical Summary

                       ●    Shared-memory multi-threading for applications
                            programming is a total aberration:
                                 –   Consequences of operating systems handling of
                                     concurrency have been imposed on all programmers.
                       ●    Cooperating processes is where applications
                            development sanity is:
                                 –   Operating system interprocess communication was slow,
                                     hence threads, but this lead directly to the shared-memory,
                                     multi-threading quagmire.
                                 –   Erlang has shown that processes and message passing can do
                                     the job properly even after the “mainstream” had rejected
                                     process-based working.

Copyright © 2011 Russel Winder                                                                     12
Concurrency
                                      vs.
                                  Parallelism




Copyright © 2011 Russel Winder                  13
Concurrency

                       ●    Running multiple tasks using time-division
                            multiplexing on a single processor.




Copyright © 2011 Russel Winder                                           14
Parallelism

                       ●    Running multiple tasks concurrently.




                                    Note that the word concurrency here is the English
                                    meaning whereas the previous slide gave the
                                    computing jargon meaning of the word.




Copyright © 2011 Russel Winder                                                           15
Concurrency . . .

                       ●    . . . is a technique required for operating systems.
                       ●    . . . can sometimes be required for applications but
                            not as much as might be thought.


                       ●    Applications can use alternative models, for example
                            event-driven systems.
                                 –   Abstract over the control flow rather than manage it with
                                     locks, semaphores, monitors, etc.




Copyright © 2011 Russel Winder                                                                   16
Parallelism . . .

                       ●    . . . is about making an algorithm execute more
                            quickly in the presence of multiple processors.
                       ●    . . . is an architectural and design issue for
                            applications.




Copyright © 2011 Russel Winder                                                17
Concurrency

                       ●    The problem with threads is shared memory:
                                 –   Without writeable shared memory there is no need for
                                     synchronization.
                       ●    Why impose a 1960s, operating system driven view of
                            concurrency management on applications
                            programmers?




Copyright © 2011 Russel Winder                                                              18
Mutable Shared Memory is . . .

                       ●    . . . anathema to parallelism.
                       ●    . . . anathema to concurrency.
                       ●    . . . anathema to modern applications programming.
                       ●    . . . anathema.




Copyright © 2011 Russel Winder                                                   19
Solution . . .

                       ●    . . . do not use mutable shared memory.




                                            Note the caveat here that opens the door
                                            to using shared immutable data.


Copyright © 2011 Russel Winder                                                         20
Operating Systems . . .

                       ●    . . . are inherently a concurrency problem.
                       ●    Applications on the other hand are not, they
                            should be using higher level abstractions.




Copyright © 2011 Russel Winder                                             21
Object
                                 Orientation




Copyright © 2011 Russel Winder                 22
Original Model

                       ●    Object-based:
                                 –   A set of (small) closed namespaces, with methods,
                                     exchanging messages requesting services.
                       ●    Object-oriented:
                                 –   Object-based plus classes and inheritance




Copyright © 2011 Russel Winder                                                           23
Implementations

                       ●    Smalltalk realized the object-oriented model
                            correctly.
                       ●    C++ did not: message passing replaced by function
                            call.



                                   C++ destroyed correct appreciation of the
                                   object-oriented model of computation.




Copyright © 2011 Russel Winder                                                  24
Non-contentious (sort of) Syllogism

                       ●    Object-orientation is
                            about objects passing
                            messages to each other:
                            object-orientation is not
                            about function call in a    ●   C++ is not an object-
                            shared memory context.          oriented programming
                       ●    C++ is a programming            language.
                            language based on
                            function call in a shared
                            memory context: C++
                            does not have objects
                            passing messages to
                            each other.
Copyright © 2011 Russel Winder                                                      25
Java




Copyright © 2011 Russel Winder          26
Object-orientation

                       ●    Java follows C++:
                                 –   Function call replaces message passing.
                       ●    Java beats C++, had threads 15 years before C++.
                       ●    Shared memory multi-threading requires all the
                            locks, semaphores, monitors, etc. and Java has it all.




                                              Java is not an object-oriented language.


Copyright © 2011 Russel Winder                                                           27
Partial Solution for JVM

                       ●    Use java.util.concurrent:
                                 –   Provides many high-level tools.
                                 –   Has many low-level tools.


                                            If you are using the low-level tools then you are lost
                                            to the cause of quality application programming.



                                     Use jsr166y (Fork/Join) and extra166y (ParallelArray) in
                                     preference to using stuff in JDK6.


                                             JDK7 has Fork/Join but not ParallelArray, still have to
                                             use extra166y for this – sadly means using jsr166y.
Copyright © 2011 Russel Winder                                                                         28
Interesting Aside

                       ●    Paul King at SpringOne2GX 2011:


                             “Who used synchronized?”
                             Some in audience raise their hands.
                             “You did it wrong!”




Copyright © 2011 Russel Winder                                     29
High Performance
                                    Computing
                                       (HPC)

                                       aka

                                 Real Computing


Copyright © 2011 Russel Winder                      30
Parallelism Rules

                       ●    HPC has been doing parallelism for 40+ years.
                       ●    Combinations of architectures:
                                 –   Vector processors
                                 –   Multi-bus multiprocessors
                                 –   Clusters




Copyright © 2011 Russel Winder                                              31
HPC Extant Solution

                       ●    Message Passing Interface (MPI)




                                     MPI addresses the problem of SPMD or MIMD
                                     parallelism in the context of multiple, possibly
                                     multicore, systems.




Copyright © 2011 Russel Winder                                                          32
HPC Proposed Solution

                       ●    Partitioned Global Address Space (PGAS)
                       ●    Champions:
                                 –   Chapel
                                 –   X10
                                 –   Fortress


                                              Structure the global address space to allow for
                                              multiple processors sharing a single memory and/or
                                              to deal with distributed memory systems.




Copyright © 2011 Russel Winder                                                                     33
Return to a Better Way




Copyright © 2011 Russel Winder                  34
Exit Manic Mode




Copyright © 2011 Russel Winder                     35
Real Solutions?

                       ●    Actor Model
                       ●    Dataflow architectures
                       ●    CSP (Communicating Sequential Processes)


              Return to a process and message passing view of applications.

                      Nothing wrong with threads as a tool.
                      The problem is using shared memory.




Copyright © 2011 Russel Winder                                                36
Return to objects passing
                           messages to each other.


                 Return to being object-oriented.




Copyright © 2011 Russel Winder                         37
Actor Model

                       ●    A program is a collection of actors that send
                            messages to each other.
                       ●    An actor is a process with a “mailbox” for receiving
                            messages.
                       ●    A mailbox is a (thread-safe) queue of messages.




Copyright © 2011 Russel Winder                                                     38
Dataflow Model

                       ●    A program is a graph of operators with some data
                            sources and some data sinks.
                       ●    An operator is an event-triggered computation with
                            some inputs and some output.
                       ●    An operator triggers for a certain state of its inputs.




Copyright © 2011 Russel Winder                                                        39
CSP is . . .

                       ●    . . . mathematics:
                                 VMS = μX. ( in2p → (chocolate → X|out1p → toffee → X)
                                      | in1p → (toffee → X|in1p → (chocolate → X|in1p → STOPαX )))

                       ●    . . . but not scary since the mathematics can be
                            hidden in an API, so it just becomes a programming
                            tool.




Copyright © 2011 Russel Winder                                                                       40
CSP

                       ●    A program is a graph of processes running a
                            sequential computation that take input from input
                            channels and write output to output channels.
                       ●    Data exchange down a channel realizes a rendezvous.




Copyright © 2011 Russel Winder                                                    41
Commentary

                       ●    Actors are non-deterministic, with chaotic
                            communications and hence complex.
                       ●    Dataflow and CSP have much greater determinism
                            with fixed communications channels.




Copyright © 2011 Russel Winder                                               42
Implementations

                       ●    Actor Model:
                                 –   JVM: GPars, Scala, Akka, Fantom
                                 –   Native: C++/Just::Thread Pro, D
                                 –   Alternative: Erlang
                       ●    Dataflow Model:
                                 –   JVM: GPars, Pervasive DataRush
                                 –   Native: C++/Just::Thread Pro
                       ●    CSP:
                                 –   JVM: GPars, JCSP
                                 –   Native: C++CSP2

Copyright © 2011 Russel Winder                                         43
Acknowledgements




Copyright © 2011 Russel Winder     44
First Example Problem

                       ●    Something small, so the code is small.
                       ●    Something not too “toy”.
                       ●    Something with good parallelism.
                                 –   Embarrassingly parallel to allow checking of scaling.




Copyright © 2011 Russel Winder                                                               45

Copyright © 2011 Russel Winder       46
What is the Value of ?

                       ●    Easy, it's known exactly, it's  (obviously).


                                                                                          †
                                                                     It's simples



                                                                            †
                                                                                Aleksandr Orlov




Copyright © 2011 Russel Winder                                                                    47
Approximating 

                       ●    What is it's value represented as a floating point
                            number?
                                 –   We can only obtain an approximation.
                                 –   A plethora of possible algorithms to choose from, a popular
                                     one is to employ the following integral equation.

                                                       1  1
                                                      =∫0       dx
                                                    4     1x 2




Copyright © 2011 Russel Winder                                                                     48
One Possible Algorithm

                       ●    Use quadrature to estimate the value of the integral
                            – which is the area under the curve.
                                           4 n            1
                                         = ∑i=1
                                           n             i−0.5 2
                                                     1      
                                                            n


                                                                  With n = 3 not much
                                                                  to do, but potentially
                                                                  lots of error.
    Embarrassingly parallel.

Copyright © 2011 Russel Winder                                                             49
Major Minor Hardware Problem

                       ●    Multiple hyperthreads per core on multicore
                            processors can be a serious waste of time.




                                              Ed: Rant about chip manufacturers and
                                              operating systems elided to avoid persecution
                                              prosecution.
Copyright © 2011 Russel Winder                                                                50
Second Example Problem

                       ●    Sleeping Barber Problem
                                 –   A barber shop has a cutting chair and some waiting chairs.
                                     The barber sleeps in the cutting chair if there are no
                                     customers. If a customer enters, the customer checks the
                                     cutting chair and wakes the barber if the barber is asleep in
                                     the chair, sits in the chair and gets a hair cut. If the
                                     entering customer sees the cutting chair in use, the
                                     customer checks to see if there is a waiting chair free. If
                                     there is the customer sits and waits, otherwise the customer
                                     leaves dissatisfied. On finishing a customer cut, the
                                     customer leaves satisfied (we assume), and the barber
                                     checks for waiting customers. If there are any waiting
                                     customers, the customer moves to the cutting chair. If
                                     there are no waiting customers, the barber returns to
                                     sleeping in the cutting chair.
Copyright © 2011 Russel Winder                                                                       51
Sleeping Barber Problem . . .

                       ●    . . . is an interesting recasting of a process
                            synchronization problem in operating systems.
                       ●    . . . is due to Edsgar Dykstra



                                 http://en.wikipedia.org/wiki/Sleeping_barber_problem




Copyright © 2011 Russel Winder                                                          52
If the examples haven't been shown
                    yet, now is the time to show them!




Copyright © 2011 Russel Winder                           53
Summary

                       ●    Multiprocessor programming is now the norm – even
                            if you don't actually need it.
                       ●    Hardware is rapidly heading towards distributed
                            memory architectures, instead of shared memory
                            multi-threading.
                       ●    Shared memory multi-threading requires locks,
                            semaphores, monitors, etc. and programmers find it
                            hard to get that stuff right.
                       ●    Actor Model, Dataflow Model, and CSP are higher
                            level abstractions of managed control flow that are
                            easier for programmers to deal with.

Copyright © 2011 Russel Winder                                                    54
Summary of the Summary

                       ●    Shared-memory multi-threading is like
                            stacks, you know it's there, but you just
                            don't worry about it.




Copyright © 2011 Russel Winder                                          55
Summary of the Summary of the
                Summary
                       ●    If you think locks, semaphores, monitors, etc. are
                            important for your work, you are either working in
                            the concurrency frameworks business (*) OR you are
                            doing it wrong.


                     (*) Which includes operating systems.




Copyright © 2011 Russel Winder                                                   56
END

                     for ( person in roomContents.collect { x -> if ( x instanceof Human ) x } ) {
                        person << "Please leave peaceably."
                     }
                     println "Goodbye all."




Copyright © 2011 Russel Winder                                                                       57
Blatant Advertising

                       Python for Rookies
                       Sarah Mount, James Shuttleworth and
                       Russel Winder
                       Thomson Learning Now called Cengage Learning.


                                          Developing Java Software Third Edition
                                          Russel Winder and Graham Roberts
                                          Wiley




                                                          Buy these books!
Copyright © 2010 Russel Winder                                                     58
Just Keep Passing
               the Messages


                                 Dr Russel Winder

                                   It’z Interactive Ltd
                                   russel@itzinteractive.com
                                   @russel_winder
Copyright © 2011 Russel Winder                                 59

Mais conteúdo relacionado

Destaque

Arh2050 1730 syllabus
Arh2050 1730 syllabusArh2050 1730 syllabus
Arh2050 1730 syllabus
ProfWillAdams
 
Arh1000 sm2015 syllabus
Arh1000 sm2015 syllabusArh1000 sm2015 syllabus
Arh1000 sm2015 syllabus
ProfWillAdams
 
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
JAX London
 
Power point ulises pedro
Power point ulises pedroPower point ulises pedro
Power point ulises pedro
perepay
 
Lengua anuncio
Lengua anuncioLengua anuncio
Lengua anuncio
franky226
 
2008 Spring Newsletter
2008 Spring Newsletter2008 Spring Newsletter
2008 Spring Newsletter
Direct Relief
 
सुनामी
सुनामीसुनामी
सुनामी
22456651
 
Hum2220 0915 syllabus
Hum2220 0915 syllabusHum2220 0915 syllabus
Hum2220 0915 syllabus
ProfWillAdams
 
Volunteer Recruitment & Management
Volunteer Recruitment & ManagementVolunteer Recruitment & Management
Volunteer Recruitment & Management
Shane-C
 

Destaque (20)

Arh2050 1730 syllabus
Arh2050 1730 syllabusArh2050 1730 syllabus
Arh2050 1730 syllabus
 
Arh1000 sm2015 syllabus
Arh1000 sm2015 syllabusArh1000 sm2015 syllabus
Arh1000 sm2015 syllabus
 
Tsahim 2
Tsahim 2Tsahim 2
Tsahim 2
 
Opportunity Execution Project - Career Mentor Online
Opportunity Execution Project - Career Mentor OnlineOpportunity Execution Project - Career Mentor Online
Opportunity Execution Project - Career Mentor Online
 
DevOps and Performance - Why, How and Best Practices - DevOps Meetup Sydney
DevOps and Performance - Why, How and Best Practices - DevOps Meetup SydneyDevOps and Performance - Why, How and Best Practices - DevOps Meetup Sydney
DevOps and Performance - Why, How and Best Practices - DevOps Meetup Sydney
 
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
Java Tech & Tools | Deploying Java & Play Framework Apps to the Cloud | Sande...
 
Embedding FreeBSD: for large and small beds
Embedding FreeBSD: for large and small bedsEmbedding FreeBSD: for large and small beds
Embedding FreeBSD: for large and small beds
 
Campus Perspectives on OpenRegistry
Campus Perspectives on OpenRegistryCampus Perspectives on OpenRegistry
Campus Perspectives on OpenRegistry
 
L'idrossitirosolo è in grado di proteggere e aumentare l'attività dei mitocon...
L'idrossitirosolo è in grado di proteggere e aumentare l'attività dei mitocon...L'idrossitirosolo è in grado di proteggere e aumentare l'attività dei mitocon...
L'idrossitirosolo è in grado di proteggere e aumentare l'attività dei mitocon...
 
Western New York Educational Service Council Presentation
Western New York Educational Service Council PresentationWestern New York Educational Service Council Presentation
Western New York Educational Service Council Presentation
 
Power point ulises pedro
Power point ulises pedroPower point ulises pedro
Power point ulises pedro
 
Lengua anuncio
Lengua anuncioLengua anuncio
Lengua anuncio
 
2008 Spring Newsletter
2008 Spring Newsletter2008 Spring Newsletter
2008 Spring Newsletter
 
सुनामी
सुनामीसुनामी
सुनामी
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
 
Hum2220 0915 syllabus
Hum2220 0915 syllabusHum2220 0915 syllabus
Hum2220 0915 syllabus
 
Volunteer Recruitment & Management
Volunteer Recruitment & ManagementVolunteer Recruitment & Management
Volunteer Recruitment & Management
 
Lec sequential
Lec sequentialLec sequential
Lec sequential
 
Measure and Learn
Measure and LearnMeasure and Learn
Measure and Learn
 
Obesità e stress ossidativo: una relazione pericolosa.
Obesità e stress ossidativo: una relazione pericolosa. Obesità e stress ossidativo: una relazione pericolosa.
Obesità e stress ossidativo: una relazione pericolosa.
 

Semelhante a Java Tech & Tools | Just Keep Passing the Message | Russel Winder

Cloud Disaster Recovery
Cloud Disaster Recovery Cloud Disaster Recovery
Cloud Disaster Recovery
OpSource
 
Experience in Corporate Training in Virtual Worlds
Experience in Corporate Training in Virtual WorldsExperience in Corporate Training in Virtual Worlds
Experience in Corporate Training in Virtual Worlds
Agile Dimensions LLC
 
Shoretel brilliantly simple_overview
Shoretel brilliantly simple_overviewShoretel brilliantly simple_overview
Shoretel brilliantly simple_overview
Chuck Brown
 
Structured development in BMC Remedy AR System
Structured development in BMC Remedy AR SystemStructured development in BMC Remedy AR System
Structured development in BMC Remedy AR System
gramlin42
 

Semelhante a Java Tech & Tools | Just Keep Passing the Message | Russel Winder (20)

Just Keep Sending The Messages
Just Keep Sending The MessagesJust Keep Sending The Messages
Just Keep Sending The Messages
 
ACCU 2012: Go, D, C++ and The Multicore Revolution
ACCU 2012:  Go, D, C++ and The Multicore RevolutionACCU 2012:  Go, D, C++ and The Multicore Revolution
ACCU 2012: Go, D, C++ and The Multicore Revolution
 
It's all about processes communicating - Russel Winder
It's all about processes communicating - Russel WinderIt's all about processes communicating - Russel Winder
It's all about processes communicating - Russel Winder
 
It's All About Processes Communicating
It's All About Processes CommunicatingIt's All About Processes Communicating
It's All About Processes Communicating
 
Testing: Python, Java, Groovy, etc.
Testing: Python, Java, Groovy, etc.Testing: Python, Java, Groovy, etc.
Testing: Python, Java, Groovy, etc.
 
GPars Workshop
GPars WorkshopGPars Workshop
GPars Workshop
 
Cloud Disaster Recovery
Cloud Disaster Recovery Cloud Disaster Recovery
Cloud Disaster Recovery
 
Experience in Corporate Training in Virtual Worlds
Experience in Corporate Training in Virtual WorldsExperience in Corporate Training in Virtual Worlds
Experience in Corporate Training in Virtual Worlds
 
GPars: Parallelism the Right Way
GPars: Parallelism the Right WayGPars: Parallelism the Right Way
GPars: Parallelism the Right Way
 
Project Controls Expo, 13th Nov 2013 - "A new visual way to engage executive ...
Project Controls Expo, 13th Nov 2013 - "A new visual way to engage executive ...Project Controls Expo, 13th Nov 2013 - "A new visual way to engage executive ...
Project Controls Expo, 13th Nov 2013 - "A new visual way to engage executive ...
 
Shoretel brilliantly simple_overview
Shoretel brilliantly simple_overviewShoretel brilliantly simple_overview
Shoretel brilliantly simple_overview
 
Structured development in BMC Remedy AR System
Structured development in BMC Remedy AR SystemStructured development in BMC Remedy AR System
Structured development in BMC Remedy AR System
 
What We are Learning About DNS Security: DNSSEC and Much More..
What We are Learning About DNS Security:  DNSSEC and Much More..What We are Learning About DNS Security:  DNSSEC and Much More..
What We are Learning About DNS Security: DNSSEC and Much More..
 
A Cognitive Design for User Assistance 1: Users Become Learners
A Cognitive Design for User Assistance 1: Users Become LearnersA Cognitive Design for User Assistance 1: Users Become Learners
A Cognitive Design for User Assistance 1: Users Become Learners
 
Behind the curtain secrets to mobile app wizardry - paul gelb razrofish sxsw
Behind the curtain   secrets to mobile app wizardry - paul gelb razrofish sxswBehind the curtain   secrets to mobile app wizardry - paul gelb razrofish sxsw
Behind the curtain secrets to mobile app wizardry - paul gelb razrofish sxsw
 
Why Groovy When Java 8 or Scala, or…
Why Groovy When Java 8 or Scala, or…Why Groovy When Java 8 or Scala, or…
Why Groovy When Java 8 or Scala, or…
 
Cloud Back Up and Disaster Recovery
Cloud Back Up and Disaster RecoveryCloud Back Up and Disaster Recovery
Cloud Back Up and Disaster Recovery
 
Jenkins Enterprise by CloudBees Webinar
Jenkins Enterprise by CloudBees WebinarJenkins Enterprise by CloudBees Webinar
Jenkins Enterprise by CloudBees Webinar
 
Intersect
IntersectIntersect
Intersect
 
DDS in a Nutshell
DDS in a NutshellDDS in a Nutshell
DDS in a Nutshell
 

Mais de JAX London

Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver GierkeSpring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
JAX London
 
Keynote | The Rise and Fall and Rise of Java | James Governor
Keynote | The Rise and Fall and Rise of Java | James GovernorKeynote | The Rise and Fall and Rise of Java | James Governor
Keynote | The Rise and Fall and Rise of Java | James Governor
JAX London
 
Java Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily JiangJava Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily Jiang
JAX London
 
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
JAX London
 
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben EvansJava Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
JAX London
 

Mais de JAX London (20)

Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
Java Tech & Tools | Continuous Delivery - the Writing is on the Wall | John S...
 
Java Tech & Tools | Mapping, GIS and Geolocating Data in Java | Joachim Van d...
Java Tech & Tools | Mapping, GIS and Geolocating Data in Java | Joachim Van d...Java Tech & Tools | Mapping, GIS and Geolocating Data in Java | Joachim Van d...
Java Tech & Tools | Mapping, GIS and Geolocating Data in Java | Joachim Van d...
 
Keynote | Middleware Everywhere - Ready for Mobile and Cloud | Dr. Mark Little
Keynote | Middleware Everywhere - Ready for Mobile and Cloud | Dr. Mark LittleKeynote | Middleware Everywhere - Ready for Mobile and Cloud | Dr. Mark Little
Keynote | Middleware Everywhere - Ready for Mobile and Cloud | Dr. Mark Little
 
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
Spring Day | WaveMaker - Spring Roo - SpringSource Tool Suite: Choosing the R...
 
Spring Day | Behind the Scenes at Spring Batch | Dave Syer
Spring Day | Behind the Scenes at Spring Batch | Dave SyerSpring Day | Behind the Scenes at Spring Batch | Dave Syer
Spring Day | Behind the Scenes at Spring Batch | Dave Syer
 
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam BrannenSpring Day | Spring 3.1 in a Nutshell | Sam Brannen
Spring Day | Spring 3.1 in a Nutshell | Sam Brannen
 
Spring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Identity Management with Spring Security | Dave SyerSpring Day | Identity Management with Spring Security | Dave Syer
Spring Day | Identity Management with Spring Security | Dave Syer
 
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver GierkeSpring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
 
Keynote | The Rise and Fall and Rise of Java | James Governor
Keynote | The Rise and Fall and Rise of Java | James GovernorKeynote | The Rise and Fall and Rise of Java | James Governor
Keynote | The Rise and Fall and Rise of Java | James Governor
 
Java Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily JiangJava Tech & Tools | OSGi Best Practices | Emily Jiang
Java Tech & Tools | OSGi Best Practices | Emily Jiang
 
Java Tech & Tools | Beyond the Data Grid: Coherence, Normalisation, Joins and...
Java Tech & Tools | Beyond the Data Grid: Coherence, Normalisation, Joins and...Java Tech & Tools | Beyond the Data Grid: Coherence, Normalisation, Joins and...
Java Tech & Tools | Beyond the Data Grid: Coherence, Normalisation, Joins and...
 
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
Java Tech & Tools | Big Blobs: Moving Big Data In and Out of the Cloud | Adri...
 
Java Tech & Tools | Social Media in Programming in Java | Khanderao Kand
Java Tech & Tools | Social Media in Programming in Java | Khanderao KandJava Tech & Tools | Social Media in Programming in Java | Khanderao Kand
Java Tech & Tools | Social Media in Programming in Java | Khanderao Kand
 
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Grails in the Java Enterprise | Peter LedbrookJava Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
 
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJava EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
 
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
Java Core | Understanding the Disruptor: a Beginner's Guide to Hardcore Concu...
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
 
Java Core | JavaFX 2.0: Great User Interfaces in Java | Simon Ritter
Java Core | JavaFX 2.0: Great User Interfaces in Java | Simon RitterJava Core | JavaFX 2.0: Great User Interfaces in Java | Simon Ritter
Java Core | JavaFX 2.0: Great User Interfaces in Java | Simon Ritter
 
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben EvansJava Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
Java Core | Modern Java Concurrency | Martijn Verburg & Ben Evans
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Java Tech & Tools | Just Keep Passing the Message | Russel Winder

  • 1. Just Keep Passing the Messages Dr Russel Winder It’z Interactive Ltd russel@itzinteractive.com @russel_winder Copyright © 2011 Russel Winder 1
  • 2. Just Keep Passing the Messages Dr Russel Winder Concertant LLP russel.winder@concertant.com @russel_winder Copyright © 2011 Russel Winder 2
  • 3. Just Keep Passing the Messages Dr Russel Winder Independent Consultant russel@russel.org.uk @russel_winder Copyright © 2011 Russel Winder 3
  • 4. Just Keep Passing the Messages Prof Russel Winder Wolverhampton University russel@russel.org.uk @russel_winder Copyright © 2011 Russel Winder 4
  • 5. Aims and Objectives ● Investigate why message passing architectures are the software architectures of the future. ● Have some fun (whilst hopefully learning something). Copyright © 2011 Russel Winder 5
  • 6. Audience Aims and Objectives ? Copyright © 2011 Russel Winder 6
  • 7. Structure of the Session ● Introduction. ● Do stuff. ● Exit stage (left|right|front|back). There may well be significant dynamic binding of the session. Copyright © 2011 Russel Winder 7
  • 8. Protocol ● Some slides, to kick things off. ● Some programs to really demonstrate things. ● NB Interaction between audience and presenter is probably mandatory. We reserve the right to (shelve|stash) for later any interaction that appears to go on longer than seems appropriate. NB This is a 50min session! Copyright © 2011 Russel Winder 8
  • 9. Enter Manic Mode Copyright © 2011 Russel Winder 9
  • 10. BEGIN ● History is important: – To know today, we look to yesterday. To know tomorrow, we see today as yesterday. http://wiki.answers.com/Q/Why_history_is_important – Copyright © 2011 Russel Winder 10
  • 11. Processes / Threads Processes / RPC Threads / Shared memory Processes / IPC Multi-tasking One program at a time. Copyright © 2011 Russel Winder 11
  • 12. Historical Summary ● Shared-memory multi-threading for applications programming is a total aberration: – Consequences of operating systems handling of concurrency have been imposed on all programmers. ● Cooperating processes is where applications development sanity is: – Operating system interprocess communication was slow, hence threads, but this lead directly to the shared-memory, multi-threading quagmire. – Erlang has shown that processes and message passing can do the job properly even after the “mainstream” had rejected process-based working. Copyright © 2011 Russel Winder 12
  • 13. Concurrency vs. Parallelism Copyright © 2011 Russel Winder 13
  • 14. Concurrency ● Running multiple tasks using time-division multiplexing on a single processor. Copyright © 2011 Russel Winder 14
  • 15. Parallelism ● Running multiple tasks concurrently. Note that the word concurrency here is the English meaning whereas the previous slide gave the computing jargon meaning of the word. Copyright © 2011 Russel Winder 15
  • 16. Concurrency . . . ● . . . is a technique required for operating systems. ● . . . can sometimes be required for applications but not as much as might be thought. ● Applications can use alternative models, for example event-driven systems. – Abstract over the control flow rather than manage it with locks, semaphores, monitors, etc. Copyright © 2011 Russel Winder 16
  • 17. Parallelism . . . ● . . . is about making an algorithm execute more quickly in the presence of multiple processors. ● . . . is an architectural and design issue for applications. Copyright © 2011 Russel Winder 17
  • 18. Concurrency ● The problem with threads is shared memory: – Without writeable shared memory there is no need for synchronization. ● Why impose a 1960s, operating system driven view of concurrency management on applications programmers? Copyright © 2011 Russel Winder 18
  • 19. Mutable Shared Memory is . . . ● . . . anathema to parallelism. ● . . . anathema to concurrency. ● . . . anathema to modern applications programming. ● . . . anathema. Copyright © 2011 Russel Winder 19
  • 20. Solution . . . ● . . . do not use mutable shared memory. Note the caveat here that opens the door to using shared immutable data. Copyright © 2011 Russel Winder 20
  • 21. Operating Systems . . . ● . . . are inherently a concurrency problem. ● Applications on the other hand are not, they should be using higher level abstractions. Copyright © 2011 Russel Winder 21
  • 22. Object Orientation Copyright © 2011 Russel Winder 22
  • 23. Original Model ● Object-based: – A set of (small) closed namespaces, with methods, exchanging messages requesting services. ● Object-oriented: – Object-based plus classes and inheritance Copyright © 2011 Russel Winder 23
  • 24. Implementations ● Smalltalk realized the object-oriented model correctly. ● C++ did not: message passing replaced by function call. C++ destroyed correct appreciation of the object-oriented model of computation. Copyright © 2011 Russel Winder 24
  • 25. Non-contentious (sort of) Syllogism ● Object-orientation is about objects passing messages to each other: object-orientation is not about function call in a ● C++ is not an object- shared memory context. oriented programming ● C++ is a programming language. language based on function call in a shared memory context: C++ does not have objects passing messages to each other. Copyright © 2011 Russel Winder 25
  • 26. Java Copyright © 2011 Russel Winder 26
  • 27. Object-orientation ● Java follows C++: – Function call replaces message passing. ● Java beats C++, had threads 15 years before C++. ● Shared memory multi-threading requires all the locks, semaphores, monitors, etc. and Java has it all. Java is not an object-oriented language. Copyright © 2011 Russel Winder 27
  • 28. Partial Solution for JVM ● Use java.util.concurrent: – Provides many high-level tools. – Has many low-level tools. If you are using the low-level tools then you are lost to the cause of quality application programming. Use jsr166y (Fork/Join) and extra166y (ParallelArray) in preference to using stuff in JDK6. JDK7 has Fork/Join but not ParallelArray, still have to use extra166y for this – sadly means using jsr166y. Copyright © 2011 Russel Winder 28
  • 29. Interesting Aside ● Paul King at SpringOne2GX 2011: “Who used synchronized?” Some in audience raise their hands. “You did it wrong!” Copyright © 2011 Russel Winder 29
  • 30. High Performance Computing (HPC) aka Real Computing Copyright © 2011 Russel Winder 30
  • 31. Parallelism Rules ● HPC has been doing parallelism for 40+ years. ● Combinations of architectures: – Vector processors – Multi-bus multiprocessors – Clusters Copyright © 2011 Russel Winder 31
  • 32. HPC Extant Solution ● Message Passing Interface (MPI) MPI addresses the problem of SPMD or MIMD parallelism in the context of multiple, possibly multicore, systems. Copyright © 2011 Russel Winder 32
  • 33. HPC Proposed Solution ● Partitioned Global Address Space (PGAS) ● Champions: – Chapel – X10 – Fortress Structure the global address space to allow for multiple processors sharing a single memory and/or to deal with distributed memory systems. Copyright © 2011 Russel Winder 33
  • 34. Return to a Better Way Copyright © 2011 Russel Winder 34
  • 35. Exit Manic Mode Copyright © 2011 Russel Winder 35
  • 36. Real Solutions? ● Actor Model ● Dataflow architectures ● CSP (Communicating Sequential Processes) Return to a process and message passing view of applications. Nothing wrong with threads as a tool. The problem is using shared memory. Copyright © 2011 Russel Winder 36
  • 37. Return to objects passing messages to each other. Return to being object-oriented. Copyright © 2011 Russel Winder 37
  • 38. Actor Model ● A program is a collection of actors that send messages to each other. ● An actor is a process with a “mailbox” for receiving messages. ● A mailbox is a (thread-safe) queue of messages. Copyright © 2011 Russel Winder 38
  • 39. Dataflow Model ● A program is a graph of operators with some data sources and some data sinks. ● An operator is an event-triggered computation with some inputs and some output. ● An operator triggers for a certain state of its inputs. Copyright © 2011 Russel Winder 39
  • 40. CSP is . . . ● . . . mathematics: VMS = μX. ( in2p → (chocolate → X|out1p → toffee → X) | in1p → (toffee → X|in1p → (chocolate → X|in1p → STOPαX ))) ● . . . but not scary since the mathematics can be hidden in an API, so it just becomes a programming tool. Copyright © 2011 Russel Winder 40
  • 41. CSP ● A program is a graph of processes running a sequential computation that take input from input channels and write output to output channels. ● Data exchange down a channel realizes a rendezvous. Copyright © 2011 Russel Winder 41
  • 42. Commentary ● Actors are non-deterministic, with chaotic communications and hence complex. ● Dataflow and CSP have much greater determinism with fixed communications channels. Copyright © 2011 Russel Winder 42
  • 43. Implementations ● Actor Model: – JVM: GPars, Scala, Akka, Fantom – Native: C++/Just::Thread Pro, D – Alternative: Erlang ● Dataflow Model: – JVM: GPars, Pervasive DataRush – Native: C++/Just::Thread Pro ● CSP: – JVM: GPars, JCSP – Native: C++CSP2 Copyright © 2011 Russel Winder 43
  • 45. First Example Problem ● Something small, so the code is small. ● Something not too “toy”. ● Something with good parallelism. – Embarrassingly parallel to allow checking of scaling. Copyright © 2011 Russel Winder 45
  • 46.  Copyright © 2011 Russel Winder 46
  • 47. What is the Value of ? ● Easy, it's known exactly, it's  (obviously). † It's simples † Aleksandr Orlov Copyright © 2011 Russel Winder 47
  • 48. Approximating  ● What is it's value represented as a floating point number? – We can only obtain an approximation. – A plethora of possible algorithms to choose from, a popular one is to employ the following integral equation.  1 1 =∫0 dx 4 1x 2 Copyright © 2011 Russel Winder 48
  • 49. One Possible Algorithm ● Use quadrature to estimate the value of the integral – which is the area under the curve. 4 n 1 = ∑i=1 n i−0.5 2 1  n With n = 3 not much to do, but potentially lots of error. Embarrassingly parallel. Copyright © 2011 Russel Winder 49
  • 50. Major Minor Hardware Problem ● Multiple hyperthreads per core on multicore processors can be a serious waste of time. Ed: Rant about chip manufacturers and operating systems elided to avoid persecution prosecution. Copyright © 2011 Russel Winder 50
  • 51. Second Example Problem ● Sleeping Barber Problem – A barber shop has a cutting chair and some waiting chairs. The barber sleeps in the cutting chair if there are no customers. If a customer enters, the customer checks the cutting chair and wakes the barber if the barber is asleep in the chair, sits in the chair and gets a hair cut. If the entering customer sees the cutting chair in use, the customer checks to see if there is a waiting chair free. If there is the customer sits and waits, otherwise the customer leaves dissatisfied. On finishing a customer cut, the customer leaves satisfied (we assume), and the barber checks for waiting customers. If there are any waiting customers, the customer moves to the cutting chair. If there are no waiting customers, the barber returns to sleeping in the cutting chair. Copyright © 2011 Russel Winder 51
  • 52. Sleeping Barber Problem . . . ● . . . is an interesting recasting of a process synchronization problem in operating systems. ● . . . is due to Edsgar Dykstra http://en.wikipedia.org/wiki/Sleeping_barber_problem Copyright © 2011 Russel Winder 52
  • 53. If the examples haven't been shown yet, now is the time to show them! Copyright © 2011 Russel Winder 53
  • 54. Summary ● Multiprocessor programming is now the norm – even if you don't actually need it. ● Hardware is rapidly heading towards distributed memory architectures, instead of shared memory multi-threading. ● Shared memory multi-threading requires locks, semaphores, monitors, etc. and programmers find it hard to get that stuff right. ● Actor Model, Dataflow Model, and CSP are higher level abstractions of managed control flow that are easier for programmers to deal with. Copyright © 2011 Russel Winder 54
  • 55. Summary of the Summary ● Shared-memory multi-threading is like stacks, you know it's there, but you just don't worry about it. Copyright © 2011 Russel Winder 55
  • 56. Summary of the Summary of the Summary ● If you think locks, semaphores, monitors, etc. are important for your work, you are either working in the concurrency frameworks business (*) OR you are doing it wrong. (*) Which includes operating systems. Copyright © 2011 Russel Winder 56
  • 57. END for ( person in roomContents.collect { x -> if ( x instanceof Human ) x } ) { person << "Please leave peaceably." } println "Goodbye all." Copyright © 2011 Russel Winder 57
  • 58. Blatant Advertising Python for Rookies Sarah Mount, James Shuttleworth and Russel Winder Thomson Learning Now called Cengage Learning. Developing Java Software Third Edition Russel Winder and Graham Roberts Wiley Buy these books! Copyright © 2010 Russel Winder 58
  • 59. Just Keep Passing the Messages Dr Russel Winder It’z Interactive Ltd russel@itzinteractive.com @russel_winder Copyright © 2011 Russel Winder 59