erlang embedded — concurrent blinkenlights and more!
Post on 13-May-2015
885 Views
Preview:
TRANSCRIPT
Erlang EmbeddedConcurrent Blinkenlights and More!
Omer Kilic || @OmerKomer@erlang-solutions.com
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 2/26
Agenda
● Challenges in Modern Embedded Systems● Overview of Erlang● Erlang Embedded● Q & A
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 3/26
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 4/26
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 5/26
Internet of Things (I)
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 6/26
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 7/26
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 8/26
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 9/26
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 10/26
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 11/26
Erlang, the Maestro
(flickr/dereckesanches)
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 12/26
External Interfaces● Native Implemented Functions (NIFs) and ports
used to interface external world to the Erlang runtime.
app
hw_if hw_driver.c
Erlang VM
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 13/26
#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 14/26
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 15/26
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● Send messages to other actors
functionality
mailbox
state
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 16/26
Example: GPIO
GPIO
proc_a
pin17
{init, 17, output}
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 17/26
Example: GPIO
GPIO
proc_a
pin17
{state, 17, high}
proc_b
{state, 1
7, low}
proc_c
{state, 17, high}
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 18/26
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 19/26
TI OMAP Reference System
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 20/26
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 21/26
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 22/26
Hardware Projects
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 23/26
Future ExplorationsParallella!
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 24/26
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 25/26
Erlang Embedded Training Stack
● A complete package for people interested in developing the next generation of concurrent/distributed Embedded Systems
● Training Modules● Embedded Linux Primer● Erlang/OTP 101● Erlang Embedded Framework
● Hardware included!
Erlang Embedded Framework
Erlang/OTP 101
Embedded Linux Primer
Hardware Platform
15/11/2012 Open Source Hardware User Group Meetup #22 Slide 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 VirdingCo-Inventor of Erlang
“
top related