SlideShare a Scribd company logo
Embracing
                                    Concurrency
                     for Fun, Utility & Simpler Code




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home    Ignite Leeds, Jan 2009
Embracing
                                     Concurrency
                     for Fun, Utility & Simpler Code
                                    Or “what we've learnt as a part of the
                                     Kamaelia project about making concurrency
                                  something that's fun and useful, and usable by
                                     novice and advanced developers alike...
                                     ...rather than a pain in the neck”




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home                     Ignite Leeds, Jan 2009
Why?                             Hardware finally going
              Opportunity!
                                  massively concurrent                                       ...
                                  .... 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
We're Taught Wrong
 Fundamental Control Structures
 ... in imperative languages number greater than 3!

      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
                                                      are most common bugs

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


                Media                      Novice
                                APPS                trainee




                        Network            3rd Party




Michael Sparks
BBC R&D, http://www.kamaelia.org/Home
Speak 'n Write
Think backend               P2P Whiteboard Programming
needed for                                                     Simple
                        ER DB Modeller        (logo)                               P2P Radio
                                                       Kids    Games
youtube/flickr                                                                     Torrent
                                                                                   3D Systems
type 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
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
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
Perspectives in APIs! (1/2)
   st    nd     rd
 1 , 2 , 3 Person
                                        1st Person - I change my state



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
Perspectives in APIs! (2/2)
   st    nd     rd
 1 , 2 , 3 Person
                                           private real methods



 Messages                                        Messages sent
 from public                                     to public outboxes
 inboxes
                      inbox             outbox

                     control            signal

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

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



 Messages
 from public                               No outbox concept
 inboxes                                   Possible issues with
                      inbox                rate limiting*
                     control
                                           Hardcodes recipient
                       ...
                                           in the sender
*system dependent issue
Michael Sparks
BBC R&D, http://www.kamaelia.org/Home
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
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
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
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
Server Example

                              data
                              from
                              user                      data
         Main                        Socket handler
      Server Core                                        to
                                                        user

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


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

                                        You therefore
                                        need to provide
         Main                           this bit.
      Server Core




   Protocol Handler Factory



Michael Sparks
BBC R&D, http://www.kamaelia.org/Home
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
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
Thank you for listening!

            If you have questions, grab me later :-)




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

More Related Content

Viewers also liked

Life Online: Curating the history of the Internet (Tom Woolley)
Life Online: Curating the history of the Internet (Tom Woolley)Life Online: Curating the history of the Internet (Tom Woolley)
Life Online: Curating the history of the Internet (Tom Woolley)LSx Festival of Technology
 
A Digital Will Needs A Digital Way (Ian Pringle)
A Digital Will Needs A Digital Way (Ian Pringle)A Digital Will Needs A Digital Way (Ian Pringle)
A Digital Will Needs A Digital Way (Ian Pringle)LSx Festival of Technology
 
Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)
Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)
Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)LSx Festival of Technology
 
Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)
Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)
Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)LSx Festival of Technology
 
Bringing Social to Coffee on iPhone (Katie Lips)
Bringing Social to Coffee on iPhone (Katie Lips)Bringing Social to Coffee on iPhone (Katie Lips)
Bringing Social to Coffee on iPhone (Katie Lips)LSx Festival of Technology
 

Viewers also liked (8)

Life Online: Curating the history of the Internet (Tom Woolley)
Life Online: Curating the history of the Internet (Tom Woolley)Life Online: Curating the history of the Internet (Tom Woolley)
Life Online: Curating the history of the Internet (Tom Woolley)
 
Smart People, Dumb Objects
Smart People, Dumb ObjectsSmart People, Dumb Objects
Smart People, Dumb Objects
 
A Digital Will Needs A Digital Way (Ian Pringle)
A Digital Will Needs A Digital Way (Ian Pringle)A Digital Will Needs A Digital Way (Ian Pringle)
A Digital Will Needs A Digital Way (Ian Pringle)
 
Introducing Ignite UK North (Craig Smith)
Introducing Ignite UK North (Craig Smith)Introducing Ignite UK North (Craig Smith)
Introducing Ignite UK North (Craig Smith)
 
Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)
Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)
Don't Forget Voice! Telephony Hacks for Web 2.0 hackers (Tim Panton)
 
Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)
Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)
Could Hardware Hacking Save Us? (Alexandra Dechamps-Sonsino)
 
Aid 2.0: IT In Africa (Jeff Allen)
Aid 2.0: IT In Africa (Jeff Allen)Aid 2.0: IT In Africa (Jeff Allen)
Aid 2.0: IT In Africa (Jeff Allen)
 
Bringing Social to Coffee on iPhone (Katie Lips)
Bringing Social to Coffee on iPhone (Katie Lips)Bringing Social to Coffee on iPhone (Katie Lips)
Bringing Social to Coffee on iPhone (Katie Lips)
 

Similar to Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)

4: Embracing Concurrency (Michael Sparks)
4: Embracing Concurrency (Michael Sparks)4: Embracing Concurrency (Michael Sparks)
4: Embracing Concurrency (Michael Sparks)
Imran Ali
 
Smalltalk In a Nutshell
Smalltalk In a NutshellSmalltalk In a Nutshell
Smalltalk In a NutshellMichele Lanza
 
Mark Logic Digital Publishing Summit, Kellogg
Mark Logic Digital Publishing Summit, KelloggMark Logic Digital Publishing Summit, Kellogg
Mark Logic Digital Publishing Summit, Kellogg
Dave Kellogg
 
Champ Pitch Celtic-Plus Event 2011
Champ Pitch Celtic-Plus Event 2011Champ Pitch Celtic-Plus Event 2011
Champ Pitch Celtic-Plus Event 2011
vrt-medialab
 
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
Christoph Pickl
 
Data First - The Next Mobile Wave
Data First - The Next Mobile WaveData First - The Next Mobile Wave
Data First - The Next Mobile Wave
Paul Golding
 
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 usersJohn Gibbon
 
Multimedia Broadcasting Platform
Multimedia Broadcasting PlatformMultimedia Broadcasting Platform
Multimedia Broadcasting Platform
Francois Lefebvre
 
A Mobile Centric View of Silicon Valley - January 2011
A Mobile Centric View of Silicon Valley - January 2011A Mobile Centric View of Silicon Valley - January 2011
A Mobile Centric View of Silicon Valley - January 2011
Lars Kamp
 
Internet Programming With Python Presentation
Internet Programming With Python PresentationInternet Programming With Python Presentation
Internet Programming With Python PresentationAkramWaseem
 
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
 
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
Enough Software
 
respond_to :voice - the convergence of voice and web interfaces with Rails an...
respond_to :voice - the convergence of voice and web interfaces with Rails an...respond_to :voice - the convergence of voice and web interfaces with Rails an...
respond_to :voice - the convergence of voice and web interfaces with Rails an...
jpalley
 
Alfresco Day Madrid - John Newton - Keynote
Alfresco Day Madrid - John Newton - KeynoteAlfresco Day Madrid - John Newton - Keynote
Alfresco Day Madrid - John Newton - KeynoteToni de la Fuente
 
Alfresco day madrid john newton - key note
Alfresco day madrid   john newton - key noteAlfresco day madrid   john newton - key note
Alfresco day madrid john newton - key noteAlfresco Software
 
What's New in IBM Connections 4.0
What's New in IBM Connections 4.0What's New in IBM Connections 4.0
What's New in IBM Connections 4.0
Luis Benitez
 
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)
Alexandre Borges
 
Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...
Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...
Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...
Kalman Graffi
 
Battle of Music: SDK from iPhone, Nokia, BlackBerry, Android, Palm
Battle of Music: SDK from iPhone, Nokia, BlackBerry, Android, PalmBattle of Music: SDK from iPhone, Nokia, BlackBerry, Android, Palm
Battle of Music: SDK from iPhone, Nokia, BlackBerry, Android, Palm
Bess Ho
 
Embedding Intelligence in Everyday Objects with TJBot
Embedding Intelligence in Everyday Objects with TJBotEmbedding Intelligence in Everyday Objects with TJBot
Embedding Intelligence in Everyday Objects with TJBot
Victor Dibia
 

Similar to Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks) (20)

4: Embracing Concurrency (Michael Sparks)
4: Embracing Concurrency (Michael Sparks)4: Embracing Concurrency (Michael Sparks)
4: Embracing Concurrency (Michael Sparks)
 
Smalltalk In a Nutshell
Smalltalk In a NutshellSmalltalk In a Nutshell
Smalltalk In a Nutshell
 
Mark Logic Digital Publishing Summit, Kellogg
Mark Logic Digital Publishing Summit, KelloggMark Logic Digital Publishing Summit, Kellogg
Mark Logic Digital Publishing Summit, Kellogg
 
Champ Pitch Celtic-Plus Event 2011
Champ Pitch Celtic-Plus Event 2011Champ Pitch Celtic-Plus Event 2011
Champ Pitch Celtic-Plus Event 2011
 
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
 
Data First - The Next Mobile Wave
Data First - The Next Mobile WaveData First - The Next Mobile Wave
Data First - The Next Mobile Wave
 
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
 
Multimedia Broadcasting Platform
Multimedia Broadcasting PlatformMultimedia Broadcasting Platform
Multimedia Broadcasting Platform
 
A Mobile Centric View of Silicon Valley - January 2011
A Mobile Centric View of Silicon Valley - January 2011A Mobile Centric View of Silicon Valley - January 2011
A Mobile Centric View of Silicon Valley - January 2011
 
Internet Programming With Python Presentation
Internet Programming With Python PresentationInternet Programming With Python Presentation
Internet Programming With Python Presentation
 
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...
 
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
 
respond_to :voice - the convergence of voice and web interfaces with Rails an...
respond_to :voice - the convergence of voice and web interfaces with Rails an...respond_to :voice - the convergence of voice and web interfaces with Rails an...
respond_to :voice - the convergence of voice and web interfaces with Rails an...
 
Alfresco Day Madrid - John Newton - Keynote
Alfresco Day Madrid - John Newton - KeynoteAlfresco Day Madrid - John Newton - Keynote
Alfresco Day Madrid - John Newton - Keynote
 
Alfresco day madrid john newton - key note
Alfresco day madrid   john newton - key noteAlfresco day madrid   john newton - key note
Alfresco day madrid john newton - key note
 
What's New in IBM Connections 4.0
What's New in IBM Connections 4.0What's New in IBM Connections 4.0
What's New in IBM Connections 4.0
 
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)
 
Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...
Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...
Dagstuhl 2010 - Kalman Graffi - Alternative, more promising IT Paradigms for ...
 
Battle of Music: SDK from iPhone, Nokia, BlackBerry, Android, Palm
Battle of Music: SDK from iPhone, Nokia, BlackBerry, Android, PalmBattle of Music: SDK from iPhone, Nokia, BlackBerry, Android, Palm
Battle of Music: SDK from iPhone, Nokia, BlackBerry, Android, Palm
 
Embedding Intelligence in Everyday Objects with TJBot
Embedding Intelligence in Everyday Objects with TJBotEmbedding Intelligence in Everyday Objects with TJBot
Embedding Intelligence in Everyday Objects with TJBot
 

More from LSx Festival of Technology

Psycho Teams & Theory Of Mind (Philip Hemsted)
Psycho Teams & Theory Of Mind (Philip Hemsted)Psycho Teams & Theory Of Mind (Philip Hemsted)
Psycho Teams & Theory Of Mind (Philip Hemsted)LSx Festival of Technology
 
Mass Customisation and the One-to-One Future (Glen Smith)
Mass Customisation and the One-to-One Future (Glen Smith)Mass Customisation and the One-to-One Future (Glen Smith)
Mass Customisation and the One-to-One Future (Glen Smith)LSx Festival of Technology
 
Practical Artificial Intelligence & Machine Learning (Arturo Servin)
Practical Artificial Intelligence & Machine Learning (Arturo Servin)Practical Artificial Intelligence & Machine Learning (Arturo Servin)
Practical Artificial Intelligence & Machine Learning (Arturo Servin)LSx Festival of Technology
 
Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)
Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)
Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)LSx Festival of Technology
 
FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...
FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...
FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...LSx Festival of Technology
 
Art for Art's sake, or for Mankind's sake (Mohammed Ali)
Art for Art's sake, or for Mankind's sake (Mohammed Ali)Art for Art's sake, or for Mankind's sake (Mohammed Ali)
Art for Art's sake, or for Mankind's sake (Mohammed Ali)LSx Festival of Technology
 
We Are Sensors (Julian Tait)
We Are Sensors (Julian Tait)We Are Sensors (Julian Tait)
We Are Sensors (Julian Tait)
LSx Festival of Technology
 
For whom do we Build, Design, Make (Susan Williamson)
For whom do we Build, Design, Make (Susan Williamson)For whom do we Build, Design, Make (Susan Williamson)
For whom do we Build, Design, Make (Susan Williamson)LSx Festival of Technology
 
Creating a Smarter Planet, City by city (Rashik Parmar)
Creating a Smarter Planet, City by city (Rashik Parmar)Creating a Smarter Planet, City by city (Rashik Parmar)
Creating a Smarter Planet, City by city (Rashik Parmar)LSx Festival of Technology
 

More from LSx Festival of Technology (17)

The Politics Of Patterns (James Boardwell)
The Politics Of Patterns (James Boardwell)The Politics Of Patterns (James Boardwell)
The Politics Of Patterns (James Boardwell)
 
Psycho Teams & Theory Of Mind (Philip Hemsted)
Psycho Teams & Theory Of Mind (Philip Hemsted)Psycho Teams & Theory Of Mind (Philip Hemsted)
Psycho Teams & Theory Of Mind (Philip Hemsted)
 
The Future Of Reading (Guy Dickinson)
The Future Of Reading (Guy Dickinson)The Future Of Reading (Guy Dickinson)
The Future Of Reading (Guy Dickinson)
 
Mass Customisation and the One-to-One Future (Glen Smith)
Mass Customisation and the One-to-One Future (Glen Smith)Mass Customisation and the One-to-One Future (Glen Smith)
Mass Customisation and the One-to-One Future (Glen Smith)
 
Practical Artificial Intelligence & Machine Learning (Arturo Servin)
Practical Artificial Intelligence & Machine Learning (Arturo Servin)Practical Artificial Intelligence & Machine Learning (Arturo Servin)
Practical Artificial Intelligence & Machine Learning (Arturo Servin)
 
Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)
Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)
Recovery 2.0: Digital Inclusion & Social Models Of Recovery (Katie Brown)
 
FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...
FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...
FriiSpray: Digital Grafitti with IR tracking (Stuart Childs, Richard Garside,...
 
My Life In Twenty Graphs (Tom Scott)
My Life In Twenty Graphs (Tom Scott)My Life In Twenty Graphs (Tom Scott)
My Life In Twenty Graphs (Tom Scott)
 
Tweetfoxxy (Ian Forrester)
Tweetfoxxy (Ian Forrester)Tweetfoxxy (Ian Forrester)
Tweetfoxxy (Ian Forrester)
 
Art for Art's sake, or for Mankind's sake (Mohammed Ali)
Art for Art's sake, or for Mankind's sake (Mohammed Ali)Art for Art's sake, or for Mankind's sake (Mohammed Ali)
Art for Art's sake, or for Mankind's sake (Mohammed Ali)
 
Turning Design On It’s Side (Paul Kerfoot)
Turning Design On It’s Side (Paul Kerfoot)Turning Design On It’s Side (Paul Kerfoot)
Turning Design On It’s Side (Paul Kerfoot)
 
We Are Sensors (Julian Tait)
We Are Sensors (Julian Tait)We Are Sensors (Julian Tait)
We Are Sensors (Julian Tait)
 
Grand Trunk Road (Irna Qureshi)
Grand Trunk Road (Irna Qureshi)Grand Trunk Road (Irna Qureshi)
Grand Trunk Road (Irna Qureshi)
 
60 Seconds (Stuart Childs)
60 Seconds (Stuart Childs)60 Seconds (Stuart Childs)
60 Seconds (Stuart Childs)
 
For whom do we Build, Design, Make (Susan Williamson)
For whom do we Build, Design, Make (Susan Williamson)For whom do we Build, Design, Make (Susan Williamson)
For whom do we Build, Design, Make (Susan Williamson)
 
Embedding Narrative (Megan Smith)
Embedding Narrative (Megan Smith)Embedding Narrative (Megan Smith)
Embedding Narrative (Megan Smith)
 
Creating a Smarter Planet, City by city (Rashik Parmar)
Creating a Smarter Planet, City by city (Rashik Parmar)Creating a Smarter Planet, City by city (Rashik Parmar)
Creating a Smarter Planet, City by city (Rashik Parmar)
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 

Embracing Concurrency: For Fun, Utility & Simpler Code (Michael Sparks)

  • 1. Embracing Concurrency for Fun, Utility & Simpler Code Michael Sparks BBC R&D, http://www.kamaelia.org/Home Ignite Leeds, Jan 2009
  • 2. Embracing Concurrency for Fun, Utility & Simpler Code Or “what we've learnt as a part of the Kamaelia project about making concurrency something that's fun and useful, and usable by novice and advanced developers alike... ...rather than a pain in the neck” Michael Sparks BBC R&D, http://www.kamaelia.org/Home Ignite Leeds, Jan 2009
  • 3. Why? Hardware finally going Opportunity! massively concurrent ... .... 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
  • 4. We're Taught Wrong Fundamental Control Structures ... in imperative languages number greater than 3! 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 are most common bugs Michael Sparks BBC R&D, http://www.kamaelia.org/Home
  • 5. Desktop gsoc Media Novice APPS trainee Network 3rd Party Michael Sparks BBC R&D, http://www.kamaelia.org/Home
  • 6. Speak 'n Write Think backend P2P Whiteboard Programming needed for Simple ER DB Modeller (logo) P2P Radio Kids Games youtube/flickr Torrent 3D Systems type 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
  • 7. 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
  • 8. 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
  • 9. Perspectives in APIs! (1/2) st nd rd 1 , 2 , 3 Person 1st Person - I change my state 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
  • 10. Perspectives in APIs! (2/2) st nd rd 1 , 2 , 3 Person private real methods Messages Messages sent from public to public outboxes inboxes inbox outbox control signal Also, think ... ... Also, think about stdin about stdout Michael Sparks BBC R&D, http://www.kamaelia.org/Home
  • 11. Actor Systems Distinction can be unclear, potential source of ambiguity* private real methods Messages from public No outbox concept inboxes Possible issues with inbox rate limiting* control Hardcodes recipient ... in the sender *system dependent issue Michael Sparks BBC R&D, http://www.kamaelia.org/Home
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. Server Example data from user data Main Socket handler Server Core to user Created at runtime to handle the Protocol Handler Factory connection Remote Protocol handler User Michael Sparks BBC R&D, http://www.kamaelia.org/Home
  • 17. Server Example You therefore need to provide Main this bit. Server Core Protocol Handler Factory Michael Sparks BBC R&D, http://www.kamaelia.org/Home
  • 18. 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
  • 19. 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
  • 20. Thank you for listening! If you have questions, grab me later :-) Michael Sparks BBC R&D, http://www.kamaelia.org/Home