Successfully reported this slideshow.

More Related Content

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Erlang Embedded — Concurrent Blinkenlights and More!

  1. 1. Erlang Embedded Concurrent Blinkenlights and More! Omer Kilic || @OmerK omer@erlang-solutions.com
  2. 2. Agenda ● Challenges in Modern Embedded Systems ● Overview of Erlang ● Erlang Embedded ● Q&A 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 2/26
  3. 3. Challenges in Embedded Systems (I) ● Larger, more complex systems than ever before ● Multi-core processing ● Harder to develop for using the standard embedded development flow ● Harder to utilise the full processing potential ● Much harder to debug (and fix!) 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 3/26
  4. 4. Challenges in Embedded Systems (II) ● Increasingly higher degrees of heterogeneity in terms of: ● Cores ● Hardware acceleration (GPU, co-processor etc) ● Interconnect ● Memory hierarchies 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 4/26
  5. 5. Internet of Things (I) 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 5/26
  6. 6. Internet of Things (II) http://blogs.cisco.com/news/the-internet-of-things-infographic/ 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 6/26
  7. 7. Erlang? ● {functional, concurrent/parallel, garbage-collected, soft real-time, fault-tolerant, distributed, message- passing} ● First version developed in 1986 ● Open-sourced in 1998. ● Battle-tested at Ericsson and many other companies ● Originally designed for Embedded Systems! 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 7/26
  8. 8. Erlang Advantage (I) ● Declarative ● Functional programming language, high abstraction level, concise readable programs. ● Concurrent and Parallel ● Highly scalable, transparent or explicit concurrency, lightweight processes. Takes full advantage of multicore architectures. 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 8/26
  9. 9. Erlang Advantage (II) ● Robust ● Simple and consistent error recovery and supervision hierarchies, built-in fault tolerance. ● Portable, Distributed ● Runs on a variety of platforms, network-aware runtime, supports heterogeneous networks. 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 9/26
  10. 10. Erlang Advantage (III) ● External Interfaces ● NIFs and ports used to interface external world to the Erlang runtime. ● Soft Real-Time ● Response time (can be) in the order of milliseconds, per-process garbage collection. ● Hot-code loading ● Dynamic reconfiguration. 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 10/26
  11. 11. Erlang, the Maestro (flickr/dereckesanches) 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 11/26
  12. 12. External Interfaces ● Native Implemented Functions (NIFs) and ports used to interface external world to the Erlang runtime. Erlang VM app hw_if hw_driver.c 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 12/26
  13. 13. #include “stats.h” Source: http://embedded.com/electronics-blogs/programming-pointers/4372180/Unexpected-trends 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 13/26
  14. 14. Actor Model ● Proposed in 1973 by Hewitt, Bishop, and Steiger ● “Universal primitives of concurrent computation” ● Building blocks for modular, distributed and concurrent systems ● No shared-state, self-contained and atomic ● Implemented in a variety of programming languages ● Erlang, Scala (AKKA), Java (Kilim), Ruby (Celluloid), C++11 (libcppa) 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 14/26
  15. 15. Actor Model ● Asynchronous message passing ● Messages kept in a mailbox and processes in the order they are received in ● Upon receiving a message, actors can: ● Make local decisions and change internal state ● Spawn new actors state ● Send messages to other actors functionality mailbox 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 15/26
  16. 16. Example: GPIO proc_a {in it, 17 ,o ut pu t} GPIO pin17 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 16/26
  17. 17. Example: GPIO proc_a proc_b } ,l ow 7 {s ,1 ta te te {s ta ,1 7, hi proc_c gh } } ,1 7, high GPIO {state pin17 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 17/26
  18. 18. GPIO “Proxy” ● Replaces the “locks” in traditional sense of embedded design ● Access control/mutual exclusion ● Can be used to implement safety constraints ● Toggling rate, sequence detection, direction control, etc. 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 18/26
  19. 19. TI OMAP Reference System 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 19/26
  20. 20. Fine Grain Abstraction ● Advantages ● Application code becomes simpler – Concise and shorter modules – Testing becomes easier – Code re-use (potentially) increases ● Disadvantages ● Architecting fine grain systems is difficult 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 20/26
  21. 21. Erlang Embedded “The aim of this KTP project is to bring the benefits of concurrent systems development using Erlang to the field of embedded systems; through investigation, analysis, software development and evaluation." 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 21/26
  22. 22. Hardware Projects 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 22/26
  23. 23. Future Explorations Parallella! 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 23/26
  24. 24. Interested in Erlang? ● http://www.erlang.org/doc/ ● http://learnyousomeerlang.com/ http://www.youtube.com/watch?v=xrIjfIjssLE :) 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 24/26
  25. 25. Erlang Embedded Training Stack ● A complete package for people interested in developing the next generation of concurrent/distributed Embedded Systems ● Training Modules Erlang Embedded Framework ● Embedded Linux Primer Erlang/OTP 101 ● Erlang/OTP 101 ● Erlang Embedded Framework Embedded Linux Primer ● Hardware included! Hardware Platform 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 25/26
  26. 26. Thank you ● www.erlang-embedded.com ● embedded@erlang-solutions.com ● @ErlangEmbedded “ Any sufficiently complicated concurrent program in another language contains an ad-hoc, informally- specified, bug-ridden, slow implementation of half of Erlang. – Robert Virding Co-Inventor of Erlang 15/11/2012 Open Source Hardware User Group Meetup #22 Slide 26/26

×