SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
Embracing
                                     Concurrency
                     for Fun, Utility & Simpler Code




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Why?        Hardware finally going
             massively concurrent
   Opportunity!
                                                                                             ...
                                  .... PS3, high end servers, trickling down to desktops, laptops)



“many hands make light
work” but Viewed as Hard
... do we just have crap tools?


                         “And one language to in
    Problems
                         the darkness bind them”
                         ... can just we REALLY abandon 50 years of code for Erlang, Haskell
                         and occam?

Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Missing Something?
 Fundamental Control Structures
 ... in imperative languages number greater than 3! (despite what you get taught...!)

       Control Structure            Traditional Abstraction     Biggest Pain Points

         Sequence                        Function                 Global Var
         Selection                       Function                 Global Var
          Iteration                      Function                 Global Var
           Parallel                       Thread                 Shared Data
                            Usually Skipped          Lost or duplicate update
This slide raises the point that
                                                     are most common bugs
teaching of imperative languages
often misses out concurrency as a
Michael Sparks
 fundamental construct, leaving a
BBC R&D, http://www.kamaelia.org/Home.html
conceptual gap for most developers
Regarding using
 concurrency, what
sort of applications
are we talking about
       here?



                                     Desktop            gsoc


                       Media                   Novice
                                    APPS                trainee




                               Network         3rd Party




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Think backend                                        Speak 'n Write
                            P2P Whiteboard Programming
needed for                                                     Simple
                        ER DB Modeller        (logo)                               P2P Radio
youtube/flickr                                         Kids    Games
                                                                                   Torrent
type systems                                                                       3D Systems
                            Compose                                                Realtime Music
          UGC                                Desktop                     gsoc      Paint App
        Backend                                                                    P2P Web Server
                                                                                   Secure “phone”
       Transcoder                                                                  Social Net Vis
                      Media                                 Novice                 ...
Shot Change
Detection                                   APPS                     trainee
                                                                                     MiniAxon
                                                                                     ScriptReader
    Mobile        DVB                                                                MediaPreview
    Reframing                                                                        on Mobile
                                                                                     Reliable

     Macro
                 Podcasts
                                  Network                  3rd Party                 Multicast
                                                                                       Sedna
    “record
  everything”                                                                    XMPP XMLDB
                        Email &                           AWS                   pubsub
                        Spam                   Web      (Amazon)
      SMTP                            IRC                                 Qt
                                              Serving              Gtk
  Greylisting
          Pop3Proxy     ClientSide          AIM                                  microblogging
                        Spam Tools

Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Core Approach:
   Concurrent things with comms points
   Generally send messages
   Keep data private, don't share



                           outbox       inbox     outbox
   inbox
                           signal       control   signal
  control

                             ...          ...       ...
    ...



Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
But I must share data?
Use Software Transactional Memory
ie version control for variables.
                         1. Check out the collection
                            of values you wish to
                            work on
                         2. Change them
                         3. Check them back in
                         4. If conflict/clash, go
                            back to 1



Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Perspectives in APIs! (1/2)
   If you have concurrency it becomes
natural to think in terms of 1 st 2 nd and 3 rd
 person. This affects an API's structure,
  and can be vital for unde rstanding it!
                                                  1st Person - I change my state
 This is one we've found that makes sense




2nd Person – YOU                                                 3rd Person –
want to me to do                                                 Bla should
something                                                        do something
(you send                                              outbox    (I send a message)
                                     inbox
me a message)
                                    control             signal

                                       ...               ...




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Perspectives in APIs! (2/2)
   If you have concurre ncy it become s
natural to think in terms of 1 st 2 nd and 3 rd
 person. This affects an API's structure ,
  and can be vital for understanding it!
                                                     private real methods
 This is one we've found that makes sense




 Messages                                                  Messages sent
 from public                                               to public outboxes
 inboxes
                                     inbox        outbox

                                    control       signal

Also, think                            ...          ...        Also, think
                                                               about stdout
about stdin

Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Actor Systems
         Distinction can be unclear,
         potential source of ambiguity*      private real methods



 Messages
                                              No outbox concept
 from public
                                              Possible issues with
 inboxes
                                              rate limiting*
                      inbox
                                              Hardcodes recipient
                      control
                                              in the sender
                          ...


*system dependent issue


Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Advantages of outboxes
                                     No hardcoding of recipient
                                     allows:
                                        - Late Binding
                                        - Dynamic rewiring

   inbox                   outbox
                                     Concurrency Patterns as
  control                  signal    Reusable Code
    ...                      ...     ... a concurrency DSL


Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
A Core Concurrency DSL
    Pipeline(A,B,C)
    Graphline(A=A,B=B, C=C, linkages = {})
    Tpipe(cond, C)
    Seq(A,B,C), PAR(), ALT()
    Backplane(“name”), PublishTo(“name”), SubscribeTo(“name”)
    Carousel(...)
    PureTransformer(...)
    StatefulTransformer(...)
    PureServer(...)
    MessageDemuxer(...)
    Source(*messages)
    NullSink
                                             Some of these are work in progress –
                                             they've been identified as useful, but
                                             not implemented as chassis, yet



Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Pipeline Example
    Pipeline(
        MyGamesEventsComponent(up="p", down="l", left="a", right="s"),
        BasicSprite("cat.png", name = "cat", border=40),
    ).activate()                                            MyGames
                                                             Events
                                                           Component




                                                             Basic
                                                             Sprite




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Graphline Example
    Graphline(
      NEXT = Button(...),
      PREVIOUS = Button(...),                PREVIOUS       NEXT
      FIRST = Button(...),                    (button)     (button)
      LAST = Button(...),
      CHOOSER = Chooser(...),
      IMAGE = Image(...),              FIRST                            LAST
                                      (button)                        (button)
      ...
    ).run()

                                                     Chooser




                                                                  Image
Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Server Example

                              data
                              from
                              user                     data
         Main                        Socket handler
      Server Core                                       to
                                                       user

                                                      Created at
                                                      runtime to
   Protocol Handler Factory
                                                      handle the   Remote
                                Protocol handler      connection    User


Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Server Example

                                        You
                                        therefore
         Main                           need to
      Server Core
                                        provide
                                        this bit.

   Protocol Handler Factory



Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Server Example
    from Kamaelia.Chassis.ConnectedServer import ServerCore
    from Kamaelia.Util.PureTransformer import PureTransformer

    def greeter(*argv, **argd):
        return PureTransformer(lambda x: "hello" +x)

    class GreeterServer(ServerCore):
        protocol=greeter
        port=1601

    GreeterServer().run()




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Backplane Example
    # Streaming Server for raw DVB of Radio 1
    Backplane(“Radio”).activate()

    Pipeline(
       DVB_Multiplex(850.16, [6210], feparams), # RADIO ONE
       PublishTo("RADIO"),
    ).activate()

    def radio(*argv,**argd):
         return SubscribeTo(“RADIO”)

    ServerCore(protocol=radio, port=1600).run()




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html
Thank you for listening!

             If you have questions, grab me later :-)

             Kamaelia is open source

             Kamaelia Tutorial (from Europython 09) :
               - http://tinyurl.com/kamaelia




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home.html

Weitere ähnliche Inhalte

Andere mochten auch

Photoshop Club
Photoshop ClubPhotoshop Club
Photoshop Club
Kitara
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009
Paolo Negri
 
Data Analysis and Statistics in Python using pandas and statsmodels
Data Analysis and Statistics in Python using pandas and statsmodelsData Analysis and Statistics in Python using pandas and statsmodels
Data Analysis and Statistics in Python using pandas and statsmodels
Wes McKinney
 
Python for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandasPython for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandas
Wes McKinney
 

Andere mochten auch (20)

Open Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & HowOpen Source at the BBC: When, Why, Why not & How
Open Source at the BBC: When, Why, Why not & How
 
Photoshop Club
Photoshop ClubPhotoshop Club
Photoshop Club
 
Bleach
BleachBleach
Bleach
 
Kamaelia Grey
Kamaelia GreyKamaelia Grey
Kamaelia Grey
 
The Selfish Programmer
The Selfish ProgrammerThe Selfish Programmer
The Selfish Programmer
 
Managing Creativity
Managing CreativityManaging Creativity
Managing Creativity
 
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with KamaeliaTimeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
Timeshift Everything, Miss Nothing - Mashup your PVR with Kamaelia
 
RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009RabbitMQ with python and ruby RuPy 2009
RabbitMQ with python and ruby RuPy 2009
 
Descriptors In Python
Descriptors In PythonDescriptors In Python
Descriptors In Python
 
Messaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQPMessaging with RabbitMQ and AMQP
Messaging with RabbitMQ and AMQP
 
Django introduction
Django introductionDjango introduction
Django introduction
 
Data Analysis and Statistics in Python using pandas and statsmodels
Data Analysis and Statistics in Python using pandas and statsmodelsData Analysis and Statistics in Python using pandas and statsmodels
Data Analysis and Statistics in Python using pandas and statsmodels
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for Beginners
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Python for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandasPython for Financial Data Analysis with pandas
Python for Financial Data Analysis with pandas
 
Advance OOP concepts in Python
Advance OOP concepts in PythonAdvance OOP concepts in Python
Advance OOP concepts in Python
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundation
 
Python Tricks That You Can't Live Without
Python Tricks That You Can't Live WithoutPython Tricks That You Can't Live Without
Python Tricks That You Can't Live Without
 
Improving Python and Spark Performance and Interoperability: Spark Summit Eas...
Improving Python and Spark Performance and Interoperability: Spark Summit Eas...Improving Python and Spark Performance and Interoperability: Spark Summit Eas...
Improving Python and Spark Performance and Interoperability: Spark Summit Eas...
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 

Ähnlich wie Kamaelia lightning2010opensource

Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)
Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)
Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)
LSx Festival of Technology
 
Smalltalk In a Nutshell
Smalltalk In a NutshellSmalltalk In a Nutshell
Smalltalk In a Nutshell
Michele Lanza
 
Http Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...
Http   Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...Http   Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...
Http Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...
qedanne
 
Future of technical innovation 3 trends that impact enterprise users
Future of technical innovation   3 trends that impact enterprise usersFuture of technical innovation   3 trends that impact enterprise users
Future of technical innovation 3 trends that impact enterprise users
John Gibbon
 

Ähnlich wie Kamaelia lightning2010opensource (20)

Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)
Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)
Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)
 
Smalltalk In a Nutshell
Smalltalk In a NutshellSmalltalk In a Nutshell
Smalltalk In a Nutshell
 
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven DolgJSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
JSUG - Cocoon3 Student Project Idea by Reinhard Poetz and Steven Dolg
 
Champ Pitch Celtic-Plus Event 2011
Champ Pitch Celtic-Plus Event 2011Champ Pitch Celtic-Plus Event 2011
Champ Pitch Celtic-Plus Event 2011
 
AppSalute & Marmalade SDK: одна игра на все платформы за 6 минут
AppSalute & Marmalade SDK: одна игра на все платформы за 6 минутAppSalute & Marmalade SDK: одна игра на все платформы за 6 минут
AppSalute & Marmalade SDK: одна игра на все платформы за 6 минут
 
Mozilla In Malaysia
Mozilla In MalaysiaMozilla In Malaysia
Mozilla In Malaysia
 
Data First - The Next Mobile Wave
Data First - The Next Mobile WaveData First - The Next Mobile Wave
Data First - The Next Mobile Wave
 
On the Future of Libraries: How? not What? (Skills Assessment) - METRO - 13_0115
On the Future of Libraries: How? not What? (Skills Assessment) - METRO - 13_0115On the Future of Libraries: How? not What? (Skills Assessment) - METRO - 13_0115
On the Future of Libraries: How? not What? (Skills Assessment) - METRO - 13_0115
 
Fast Track - Windows 8 Apps
Fast Track - Windows 8 AppsFast Track - Windows 8 Apps
Fast Track - Windows 8 Apps
 
Http Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...
Http   Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...Http   Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...
Http Jaoo.Com.Au Sydney 2008 File Path= Jaoo Aus2008 Slides Dave Thomas Lif...
 
TheTrendwatch #06
TheTrendwatch #06TheTrendwatch #06
TheTrendwatch #06
 
Future of technical innovation 3 trends that impact enterprise users
Future of technical innovation   3 trends that impact enterprise usersFuture of technical innovation   3 trends that impact enterprise users
Future of technical innovation 3 trends that impact enterprise users
 
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
 
Semantics And Multimedia
Semantics And MultimediaSemantics And Multimedia
Semantics And Multimedia
 
MTC Spring 2013 - crossplatform woes - robert virkus - 2013-03-13
MTC Spring 2013 -  crossplatform woes - robert virkus - 2013-03-13MTC Spring 2013 -  crossplatform woes - robert virkus - 2013-03-13
MTC Spring 2013 - crossplatform woes - robert virkus - 2013-03-13
 
Windows Phone and Open Source 1
Windows Phone and Open Source 1Windows Phone and Open Source 1
Windows Phone and Open Source 1
 
Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5
Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5
Valtech Days 2009 Paris Presentation: WCM in 2010 and an intro to CQ5
 
Non techie journey in social internet age noiselessinnovation
Non techie journey in social internet age noiselessinnovationNon techie journey in social internet age noiselessinnovation
Non techie journey in social internet age noiselessinnovation
 
Going Mobile - A Pragmatic Look At Mobile Design
Going Mobile - A Pragmatic Look At Mobile DesignGoing Mobile - A Pragmatic Look At Mobile Design
Going Mobile - A Pragmatic Look At Mobile Design
 
Multimedia Broadcasting Platform
Multimedia Broadcasting PlatformMultimedia Broadcasting Platform
Multimedia Broadcasting Platform
 

Mehr von kamaelian

Mehr von kamaelian (9)

Sharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using KamaeliaSharing Data and Services Safely in Concurrent Systems using Kamaelia
Sharing Data and Services Safely in Concurrent Systems using Kamaelia
 
Sociable Software
Sociable SoftwareSociable Software
Sociable Software
 
Open Source at the BBC
Open Source at the BBCOpen Source at the BBC
Open Source at the BBC
 
Kamaelia - Fave 2005
Kamaelia - Fave 2005Kamaelia - Fave 2005
Kamaelia - Fave 2005
 
SWP - A Generic Language Parser
SWP - A Generic Language ParserSWP - A Generic Language Parser
SWP - A Generic Language Parser
 
Kamaelia - Networking Using Generators
Kamaelia - Networking Using GeneratorsKamaelia - Networking Using Generators
Kamaelia - Networking Using Generators
 
Kamaelia Internals
Kamaelia InternalsKamaelia Internals
Kamaelia Internals
 
Building systems with Kamaelia
Building systems with KamaeliaBuilding systems with Kamaelia
Building systems with Kamaelia
 
Free software: How does it work?
Free software: How does it work?Free software: How does it work?
Free software: How does it work?
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
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
 

Kürzlich hochgeladen (20)

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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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...
 
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...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - 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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Kamaelia lightning2010opensource

  • 1. Embracing Concurrency for Fun, Utility & Simpler Code Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 2. Why? Hardware finally going massively concurrent Opportunity! ... .... PS3, high end servers, trickling down to desktops, laptops) “many hands make light work” but Viewed as Hard ... do we just have crap tools? “And one language to in Problems the darkness bind them” ... can just we REALLY abandon 50 years of code for Erlang, Haskell and occam? Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 3. Missing Something? Fundamental Control Structures ... in imperative languages number greater than 3! (despite what you get taught...!) Control Structure Traditional Abstraction Biggest Pain Points Sequence Function Global Var Selection Function Global Var Iteration Function Global Var Parallel Thread Shared Data Usually Skipped Lost or duplicate update This slide raises the point that are most common bugs teaching of imperative languages often misses out concurrency as a Michael Sparks fundamental construct, leaving a BBC R&D, http://www.kamaelia.org/Home.html conceptual gap for most developers
  • 4. Regarding using concurrency, what sort of applications are we talking about here? Desktop gsoc Media Novice APPS trainee Network 3rd Party Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 5. Think backend Speak 'n Write P2P Whiteboard Programming needed for Simple ER DB Modeller (logo) P2P Radio youtube/flickr Kids Games Torrent type systems 3D Systems Compose Realtime Music UGC Desktop gsoc Paint App Backend P2P Web Server Secure “phone” Transcoder Social Net Vis Media Novice ... Shot Change Detection APPS trainee MiniAxon ScriptReader Mobile DVB MediaPreview Reframing on Mobile Reliable Macro Podcasts Network 3rd Party Multicast Sedna “record everything” XMPP XMLDB Email & AWS pubsub Spam Web (Amazon) SMTP IRC Qt Serving Gtk Greylisting Pop3Proxy ClientSide AIM microblogging Spam Tools Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 6. Core Approach: Concurrent things with comms points Generally send messages Keep data private, don't share outbox inbox outbox inbox signal control signal control ... ... ... ... Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 7. But I must share data? Use Software Transactional Memory ie version control for variables. 1. Check out the collection of values you wish to work on 2. Change them 3. Check them back in 4. If conflict/clash, go back to 1 Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 8. Perspectives in APIs! (1/2) If you have concurrency it becomes natural to think in terms of 1 st 2 nd and 3 rd person. This affects an API's structure, and can be vital for unde rstanding it! 1st Person - I change my state This is one we've found that makes sense 2nd Person – YOU 3rd Person – want to me to do Bla should something do something (you send outbox (I send a message) inbox me a message) control signal ... ... Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 9. Perspectives in APIs! (2/2) If you have concurre ncy it become s natural to think in terms of 1 st 2 nd and 3 rd person. This affects an API's structure , and can be vital for understanding it! private real methods This is one we've found that makes sense Messages Messages sent from public to public outboxes inboxes inbox outbox control signal Also, think ... ... Also, think about stdout about stdin Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 10. Actor Systems Distinction can be unclear, potential source of ambiguity* private real methods Messages No outbox concept from public Possible issues with inboxes rate limiting* inbox Hardcodes recipient control in the sender ... *system dependent issue Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 11. Advantages of outboxes No hardcoding of recipient allows: - Late Binding - Dynamic rewiring inbox outbox Concurrency Patterns as control signal Reusable Code ... ... ... a concurrency DSL Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 12. A Core Concurrency DSL Pipeline(A,B,C) Graphline(A=A,B=B, C=C, linkages = {}) Tpipe(cond, C) Seq(A,B,C), PAR(), ALT() Backplane(“name”), PublishTo(“name”), SubscribeTo(“name”) Carousel(...) PureTransformer(...) StatefulTransformer(...) PureServer(...) MessageDemuxer(...) Source(*messages) NullSink Some of these are work in progress – they've been identified as useful, but not implemented as chassis, yet Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 13. Pipeline Example Pipeline( MyGamesEventsComponent(up="p", down="l", left="a", right="s"), BasicSprite("cat.png", name = "cat", border=40), ).activate() MyGames Events Component Basic Sprite Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 14. Graphline Example Graphline( NEXT = Button(...), PREVIOUS = Button(...), PREVIOUS NEXT FIRST = Button(...), (button) (button) LAST = Button(...), CHOOSER = Chooser(...), IMAGE = Image(...), FIRST LAST (button) (button) ... ).run() Chooser Image Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 15. Server Example data from user data Main Socket handler Server Core to user Created at runtime to Protocol Handler Factory handle the Remote Protocol handler connection User Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 16. Server Example You therefore Main need to Server Core provide this bit. Protocol Handler Factory Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 17. Server Example from Kamaelia.Chassis.ConnectedServer import ServerCore from Kamaelia.Util.PureTransformer import PureTransformer def greeter(*argv, **argd): return PureTransformer(lambda x: "hello" +x) class GreeterServer(ServerCore): protocol=greeter port=1601 GreeterServer().run() Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 18. Backplane Example # Streaming Server for raw DVB of Radio 1 Backplane(“Radio”).activate() Pipeline( DVB_Multiplex(850.16, [6210], feparams), # RADIO ONE PublishTo("RADIO"), ).activate() def radio(*argv,**argd): return SubscribeTo(“RADIO”) ServerCore(protocol=radio, port=1600).run() Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html
  • 19. Thank you for listening! If you have questions, grab me later :-) Kamaelia is open source Kamaelia Tutorial (from Europython 09) : - http://tinyurl.com/kamaelia Michael Sparks BBC R&D, http://www.kamaelia.org/Home.html