The Actor Model applied to the Raspberry Pi and the Embedded Domain. Omer

Similar documents
The Actor Model applied to the Raspberry Pi and the Embedded Domain. The Erlang Embedded Project. Omer

FRANCESCO CESARINI. presents ERLANG/OTP. Francesco Cesarini Erlang

Overview of the Raspberry Pi Models 3B & 2B

Message Passing. Advanced Operating Systems Tutorial 7

ECE 598 Advanced Operating Systems Lecture 4

Cooking with Team 279

An Introduction to Erlang

Erlang. Joe Armstrong

Embedded Linux kernel and driver development training 5-day session

EMC2. Prototyping and Benchmarking of PikeOS-based and XTRATUM-based systems on LEON4x4

Raspberry Pi Compute Development board

Starting the System & Basic Erlang Exercises

Real-Time Programming

RASPBERRY PI EXAMPLES WITH CLICK BOARDS

EMBEDDED SYSTEMS WITH ROBOTICS AND SENSORS USING ERLANG

Erlang. Joe Armstrong.

HOW TO INTEGRATE NFC FRONTENDS IN LINUX

Introduction to the Raspberry Pi AND LINUX FOR DUMMIES

Advanced Embedded Systems

Erlang 101. Google Doc

Erlang: An Overview. Part 2 Concurrency and Distribution. Thanks to Richard Carlsson for most of the slides in this part

TechNexion PICO SOM Expansion Board

An Introduction to Erlang

Gumstix Pi Compute USB-Ethernet

Real Safe Times in the Jailhouse Hypervisor Unrestricted Siemens AG All rights reserved

Hardware Software Bring-Up Solutions for ARM v7/v8-based Designs. August 2015

64 bit Bare Metal Programming on RPI-3. Tristan Gingold

SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road QUESTION BANK (DESCRIPTIVE) UNIT I OPERATING SYSTEMS

Migrating to Cortex-M3 Microcontrollers: an RTOS Perspective

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

Software Design Challenges for heterogenic SOC's

An Introduction to Erlang

EMBEDDED SYSTEMS READY TO USE LECTURE MATERIALS FOR UNDERGRADUATES

Ten (or so) Small Computers

The Digital Revolution

RPi General Purpose IO (GPIO) Pins

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4

The Information contained herein is subject to change without notice. Revisions may be issued regarding changes and/or additions.

Atlys (Xilinx Spartan-6 LX45)

Module MI037 Peripherals

Kevin Meehan Stephen Moskal Computer Architecture Winter 2012 Dr. Shaaban

AlphaBot2 robot building kit for Raspberry Pi 3 Model B

Software Driven Verification at SoC Level. Perspec System Verifier Overview

Embedded Technosolutions

An Introduction to Erlang

Embedded Operating Systems. Unit I and Unit II

Francesco Cesarini. Concurrency + Distribution = Availability + Scalability.

Loosely Coupled Actor Systems

Kinetis SDK Release Notes for the TWR-K24F120M Tower System Module

Embedded Elixir. Elixir Taiwan Meetup July 25, 2016 Jake Morrison

DESIGN OF LIGHTWEIGHT E- ATTENDANCE PROTOTYPE USING RASPBERRY PI

December 1, 2015 Jason Kridner

Embedded Linux With Raspberry Pi IOT

ARM Powered SoCs OpenEmbedded: a framework for toolcha. generation and rootfs management

The Information contained herein is subject to change without notice. Revisions may be issued regarding changes and/or additions.

QuartzV: Bringing Quality of Time to Virtual Machines

Outline Background Jaluna-1 Presentation Jaluna-2 Presentation Overview Use Cases Architecture Features Copyright Jaluna SA. All rights reserved

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Simplifying Multiprotocol Industrial Ethernet Communication. Sandeep Kumar December 2016

w w w. b a s e t r a i n i n g i n s t i t u t e. c o

All you need is fun. Cons T Åhs Keeper of The Code

Heterogeneous Software Architecture with OpenAMP

ERLANG EVOLVES FOR MULTI-CORE AND CLOUD ENVIRONMENTS

i.mx 7 - Hetereogenous Multiprocessing Architecture

Enabling IoT OSs for Intel Quark MCU Platforms: the fast way. OpenIoT Summit Europe Andre Guedes

Copyright 2017 Samsung. All Rights Reserved. O-Hoon Kwon, Ph.D. Samsung Electronics

2015 Erlang Solutions Ltd

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

Erlang: distributed programming

IoT.js. Next generation web for connected things. Samsung Electronics Software Center Piotr Marcinkiewicz 2017

Android System Development Training 4-day session

Preempt-RT Raspberry Linux. VMware Tiejun Chen

The Information contained herein is subject to change without notice. Revisions may be issued regarding changes and/or additions.

BCS Raspberry Pi Launch Events Getting started with Raspberry Pi

PRU Hardware Overview. Building Blocks for PRU Development: Module 1

Embedded Technosolutions

Development of Real-Time Systems with Embedded Linux. Brandon Shibley Senior Solutions Architect Toradex Inc.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT-1

OK335xS Users Manual Part I - Introduction

The Information contained herein is subject to change without notice. Revisions may be issued regarding changes and/or additions.

Simplify rich applications & hard real-time

Introduction to the Itron Riva Dev Kits

IoT Project Proposals

"Multicore programming" No more communication in your program, the key to multi-core and distributed programming.

A Closer Look at the Epiphany IV 28nm 64 core Coprocessor. Andreas Olofsson PEGPUM 2013

Concurrent Programming. Implementation Alternatives. Content. Real-Time Systems, Lecture 2. Historical Implementation Alternatives.

F28HS Hardware-Software Interface: Systems Programming

EOS: An Extensible Operating System

Concurrent Programming

Final Exam Study Guide

MYD-SAMA5D3X Development Board

Performance Optimization for an ARM Cortex-A53 System Using Software Workloads and Cycle Accurate Models. Jason Andrews

PERFORMANCE ANALYSIS USING NXP S I.MX RT1050 CROSSOVER PROCESSOR AND THE ZEPHYR OS

Version History. V1.0 Original Version 1 / 13

Modern Embedded Systems Programming: Beyond the RTOS

Programming Language Impact on the Development of Distributed Systems

Orange Pi 2 User Manual. <Version: V0.9 >

The Actor Model, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014

Introduction to Erlang. Franck Petit / Sebastien Tixeuil

Azure Sphere: Fitting Linux Security in 4 MiB of RAM. Ryan Fairfax Principal Software Engineering Lead Microsoft

Transcription:

The Actor Model applied to the Raspberry Pi and the Embedded Domain Omer Kilic @OmerK omer@erlang-solutions.com

Agenda Current state of Embedded Systems Overview of the Actor Model Erlang Embedded Project Modelling and developing systems using Erlang Experiments with the Raspberry Pi Future Explorations Q & A 03/12/2012 Tech Mesh London Slide 2 of 45

Embedded Systems An embedded system is a computer system designed for specific control functions within a larger system, often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range of end-user needs. - Infinite Wisdom of Wikipedia 03/12/2012 Tech Mesh London Slide 3 of 45

#include <stats.h> Source: http://embedded.com/electronics-blogs/programming-pointers/4372180/unexpected-trends 03/12/2012 Tech Mesh London Slide 4 of 45

Current Challenges Complex SoC platforms Internet of Things Connected and distributed systems Multicore and/or heterogeneous devices Time to market constraints 03/12/2012 Tech Mesh London Slide 5 of 45

Embedded Systems Bare Metal No underlying OS or high level abstractions RTOS Minimal interrupt and switching latency, scheduling guarantees, minimal jitter Embedded Linux Slimmed down Linux with hardware interfaces 03/12/2012 Tech Mesh London Slide 6 of 45

RTOS Concepts Notion of tasks OS-supervised interprocess messaging Shared memory Mutexes/Semaphores/Locks Scheduling Pre-emptive: event driven Round-robin: time multiplexed 03/12/2012 Tech Mesh London Slide 7 of 45

Embedded Linux Not a new concept, increased popularity due to abundant supply of cheap boards Raspberry Pi, Beagleboard/Beaglebone, Gumstix et al. Familiar set of tools for software developers, new territory for embedded engineers No direct mapping for RTOS concepts, especially tasks Complex device driver framework Here be dragons 03/12/2012 Tech Mesh London Slide 8 of 45

Actor Model Proposed in 1973 by Hewitt, Bishop and Steiger Universal primitives for concurrent computation No shared-state, self-contained and atomic Building blocks for modular, distributed and concurrent systems Implemented in a variety of programming languages 03/12/2012 Tech Mesh London Slide 9 of 45

Actor Model Asynchronous message passing Messages kept in a mailbox and processed in the order they are received in Upon receiving messages, actors can: Make local decisions and change internal state Spawn new actors Send messages to other actors 03/12/2012 Tech Mesh London Slide 10 of 45

Actor Model 03/12/2012 Tech Mesh London Slide 11 of 45

Actor Model 03/12/2012 Tech Mesh London Slide 12 of 45

Limitations of the Actor Model No notion of inheritance or general hierarchy Specific to language and library implementation Asynchronous message passing can be problematic for certain applications Ordering of messages received from multiple processes Abstract definition may lead to inconsistency in larger systems Fine/Coarse Grain argument 03/12/2012 Tech Mesh London Slide 13 of 45

Erlang Embedded Knowledge Transfer Partnership between Erlang Solutions and University of Kent Aim of the project: Bring the benefits of concurrent systems development using Erlang to the field of embedded systems; through investigation, analysis, software development and evaluation. http://erlang-embedded.com 03/12/2012 Tech Mesh London Slide 14 of 45

Why Erlang? Implements the Actor model Battle-tested at Ericsson and many other companies Originally designed for embedded applications Support for concurrency and distributed systems out of the box Easy to create robust systems (...and more!) 03/12/2012 Tech Mesh London Slide 15 of 45

High Availability/Reliability Simple and consistent error recovery and supervision hierarchies Built in fault-tolerance Isolation of Actors Support for dynamic reconfiguration Hot code loading 03/12/2012 Tech Mesh London Slide 16 of 45

Creating an Actor Pid1 spawn(math, fact, [5]) Pid2 math:fact(5) 03/12/2012 Tech Mesh London Slide 17 of 45

Communication Pid1 {Pid1, msg} Pid2 Pid2! {self(), msg} 03/12/2012 Tech Mesh London Slide 18 of 45

Bidirectional Links Pid1 Pid2 link(pid2) 03/12/2012 Tech Mesh London Slide 19 of 45

Process Error Handling Let it Fail! Abstract error handling away from the modules Results in leaner modules Supervision hierarchies 03/12/2012 Tech Mesh London Slide 20 of 45

Propagating Exit Signals {'EXIT', PidA, Reason} PidA PidB {'EXIT', PidB, Reason} PidC 03/12/2012 Tech Mesh London Slide 21 of 45

Trapping Exits {'EXIT', PidA, Reason} process_flag(trap_exit, true) PidA PidB PidC 03/12/2012 Tech Mesh London Slide 22 of 45

External Interfaces Native Implemented Functions (NIFs) and ports used to interface external world to the Erlang runtime. 03/12/2012 Tech Mesh London Slide 23 of 45

Erlang, the Maestro (flickr/dereckesanches) 03/12/2012 Tech Mesh London Slide 24 of 45

Raspberry Pi 700 MHz ARM11 256 MB DDR2 RAM 10/100Mb Ethernet 2x USB 2.0 (HDMI, Composite Video, 3.5mm Stereo Jack, DSI, CSI-2) $35 03/12/2012 Tech Mesh London Slide 25 of 45

Raspberry Pi in Education The Raspberry Pi Foundation is a UK registered charity. Mission statement: "...to promote the study of computer science and related topics, especially at school level, and to put the fun back into learning computing." Future Engineers/Programmers! (flickr/lebeus) 03/12/2012 Tech Mesh London Slide 26 of 45

Raspberry Pi Peripherals GPIO UART I2C I2S SPI PWM DSI CSI-2 03/12/2012 Tech Mesh London Slide 27 of 45

Accessing peripherals Peripherals are memory mapped Access via /dev/mem Faster, needs root, potentially dangerous! Use kernel modules/sysfs Slower, doesn t need root, easier, relatively safer 03/12/2012 Tech Mesh London Slide 28 of 45

GPIO Interface (I) init(pin, Direction) -> {ok, FdExport} = file:open("/sys/class/gpio/export", [write]), file:write(fdexport, integer_to_list(pin)), file:close(fdexport), {ok, FdPinDir} = file:open("/sys/class/gpio/gpio" ++ integer_to_list(pin) ++ "/direction", [write]), case Direction of in -> file:write(fdpindir, "in"); out -> file:write(fdpindir, "out") end, file:close(fdpindir), {ok, FdPinVal} = file:open("/sys/class/gpio/gpio" ++ integer_to_list(pin) ++ "/value", [read, write]), FdPinVal. 03/12/2012 Tech Mesh London Slide 29 of 45

GPIO Interface (II) write(fd, Val) -> file:position(fd, 0), file:write(fd, integer_to_list(val)). read(fd) -> file:position(fd, 0), {ok, Val} = file:read(fd, 1), Val. release(pin) -> {ok, FdUnexport} = file:open("/sys/class/gpio/unexport", [write]), file:write(fdunexport, integer_to_list(pin)), file:close(fdunexport). 03/12/2012 Tech Mesh London Slide 30 of 45

Concurrency Demo http://vimeo.com/40769788 03/12/2012 Tech Mesh London Slide 31 of 45

Example: GPIO PidA PidB PidC Pin17??? 03/12/2012 Tech Mesh London Slide 32 of 45

Example: GPIO PidA PidB GPIO Proxy PidC Pin17 03/12/2012 Tech Mesh London Slide 33 of 45

GPIO Proxy Replaces 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. 03/12/2012 Tech Mesh London Slide 34 of 45

Fine Grain Abstraction Advantages Application code becomes simpler Concise and shorter modules Testing becomes easier Code re-use (potentially) increases Disadvantage Architecting fine grain systems is difficult 03/12/2012 Tech Mesh London Slide 35 of 45

Universal Peripheral/Component Modules 03/12/2012 Tech Mesh London Slide 36 of 45

Universal Peripheral/Component Modules 03/12/2012 Tech Mesh London Slide 37 of 45

TI OMAP Reference System 03/12/2012 Tech Mesh London Slide 38 of 45

Hardware Projects Ponte 03/12/2012 Tech Mesh London Slide 39 of 45

Hardware Projects Demo Board 03/12/2012 Tech Mesh London Slide 40 of 45

Hardware Simulator 03/12/2012 Tech Mesh London Slide 41 of 45

Future Explorations Parallella: 03/12/2012 Tech Mesh London Slide 42 of 45

Packages for Embedded Architectures https://www.erlang-solutions.com/downloads/download-erlang-otp 03/12/2012 Tech Mesh London Slide 43 of 45

Erlang Embedded Training Stack A complete package for people interested in developing the next generation of concurrent and distributed Embedded Systems Training Modules: Embedded Linux Primer Erlang/OTP 101 Erlang Embedded Framework Get in touch if you re interested. 03/12/2012 Tech Mesh London Slide 44 of 45

Thank you http://erlang-embedded.com embedded@erlang-solutions.com @ErlangEmbedded The world is concurrent. Things in the world don't share data. Things communicate with messages. Things fail. - Joe Armstrong Co-inventor of Erlang 03/12/2012 Tech Mesh London Slide 45 of 45