SlideShare ist ein Scribd-Unternehmen logo
1 von 45
Downloaden Sie, um offline zu lesen
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
process_flag(trap_exit, true)

{'EXIT', PidA, Reason}
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)

03/12/2012

$35

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
•
•
•
•
•
•
•
•
03/12/2012

GPIO
UART
I2C
I2S
SPI
PWM
DSI
CSI-2
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

PidC
GPIO
Proxy

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

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to VHDL - Part 1
Introduction to VHDL - Part 1Introduction to VHDL - Part 1
Introduction to VHDL - Part 1Abhilash Nair
 
OliverStoneResume2015-2
OliverStoneResume2015-2OliverStoneResume2015-2
OliverStoneResume2015-2Oliver Stone
 
SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...
SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...
SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...South Tyrol Free Software Conference
 
OliverStoneSWResume2015-05
OliverStoneSWResume2015-05OliverStoneSWResume2015-05
OliverStoneSWResume2015-05Oliver Stone
 
Prepare yourself to switch computing to Open Hardware Power Architecture
Prepare yourself to switch computing to Open Hardware Power ArchitecturePrepare yourself to switch computing to Open Hardware Power Architecture
Prepare yourself to switch computing to Open Hardware Power ArchitectureRoberto Innocenti
 
FEL Flyer F12
FEL Flyer F12FEL Flyer F12
FEL Flyer F12chitlesh
 
Fel Flyer F11
Fel Flyer F11Fel Flyer F11
Fel Flyer F11chitlesh
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdlArshit Rai
 
Digital VLSI Design and FPGA Implementation
Digital VLSI Design and FPGA ImplementationDigital VLSI Design and FPGA Implementation
Digital VLSI Design and FPGA ImplementationAmber Bhaumik
 
Chapter 5 introduction to VHDL
Chapter 5 introduction to VHDLChapter 5 introduction to VHDL
Chapter 5 introduction to VHDLSSE_AndyLi
 
Digital design lect 26 27
Digital design lect 26 27Digital design lect 26 27
Digital design lect 26 27babak danyal
 
Chips alliance omni xtend overview
Chips alliance omni xtend overviewChips alliance omni xtend overview
Chips alliance omni xtend overviewRISC-V International
 
RISC-V Introduction
RISC-V IntroductionRISC-V Introduction
RISC-V IntroductionYi-Hsiu Hsu
 

Was ist angesagt? (20)

Introduction to EDA Tools
Introduction to EDA ToolsIntroduction to EDA Tools
Introduction to EDA Tools
 
Introduction to VHDL - Part 1
Introduction to VHDL - Part 1Introduction to VHDL - Part 1
Introduction to VHDL - Part 1
 
OliverStoneResume2015-2
OliverStoneResume2015-2OliverStoneResume2015-2
OliverStoneResume2015-2
 
SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...
SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...
SFScon18 - Roberto Innocenti - Open Hardware PowerPC Notebook disclose the mo...
 
OliverStoneSWResume2015-05
OliverStoneSWResume2015-05OliverStoneSWResume2015-05
OliverStoneSWResume2015-05
 
Prepare yourself to switch computing to Open Hardware Power Architecture
Prepare yourself to switch computing to Open Hardware Power ArchitecturePrepare yourself to switch computing to Open Hardware Power Architecture
Prepare yourself to switch computing to Open Hardware Power Architecture
 
FEL Flyer F12
FEL Flyer F12FEL Flyer F12
FEL Flyer F12
 
Fel Flyer F11
Fel Flyer F11Fel Flyer F11
Fel Flyer F11
 
Del Sozzo's talk @ ICCD17
Del Sozzo's talk @ ICCD17Del Sozzo's talk @ ICCD17
Del Sozzo's talk @ ICCD17
 
Open j9 jdk on RISC-V
Open j9 jdk on RISC-VOpen j9 jdk on RISC-V
Open j9 jdk on RISC-V
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdl
 
Digital VLSI Design and FPGA Implementation
Digital VLSI Design and FPGA ImplementationDigital VLSI Design and FPGA Implementation
Digital VLSI Design and FPGA Implementation
 
Vhdl design flow
Vhdl design flowVhdl design flow
Vhdl design flow
 
Chapter 5 introduction to VHDL
Chapter 5 introduction to VHDLChapter 5 introduction to VHDL
Chapter 5 introduction to VHDL
 
Digital design lect 26 27
Digital design lect 26 27Digital design lect 26 27
Digital design lect 26 27
 
CPLDs
CPLDsCPLDs
CPLDs
 
Chips alliance omni xtend overview
Chips alliance omni xtend overviewChips alliance omni xtend overview
Chips alliance omni xtend overview
 
Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
RISC-V Introduction
RISC-V IntroductionRISC-V Introduction
RISC-V Introduction
 
Security and functional safety
Security and functional safetySecurity and functional safety
Security and functional safety
 

Ähnlich wie The Actor Model applied to the Raspberry Pi and the Embedded Domain

Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...
Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...
Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...David Meyer
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1Béo Tú
 
Technology Abstraction Eases Silicon Intellectual Property Portability
Technology Abstraction Eases Silicon Intellectual Property PortabilityTechnology Abstraction Eases Silicon Intellectual Property Portability
Technology Abstraction Eases Silicon Intellectual Property Portabilityjgpecor
 
Preserving Computer-Aided Design, Digital Preservation Coalition Report
Preserving Computer-Aided Design, Digital Preservation Coalition ReportPreserving Computer-Aided Design, Digital Preservation Coalition Report
Preserving Computer-Aided Design, Digital Preservation Coalition ReportRuggero Lancia
 
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing WorldCloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing WorldOmer Kilic
 
Distributing your pandas ETL job using Modin and Ray.pdf
Distributing your pandas ETL job using Modin and Ray.pdfDistributing your pandas ETL job using Modin and Ray.pdf
Distributing your pandas ETL job using Modin and Ray.pdfAndrew Li
 
Verilog overview
Verilog overviewVerilog overview
Verilog overviewposdege
 
SDN the network becomes the application
SDN the network becomes the applicationSDN the network becomes the application
SDN the network becomes the applicationEduardo_Jacob
 
CHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopCHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopObject Automation
 
Redis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
Redis for Data Science and Engineering by Dmitry Polyakovsky of OracleRedis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
Redis for Data Science and Engineering by Dmitry Polyakovsky of OracleRedis Labs
 
End-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNXEnd-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNXNick Pentreath
 
DRESD Project Presentation - December 2006
DRESD Project Presentation - December 2006DRESD Project Presentation - December 2006
DRESD Project Presentation - December 2006santa
 
Mulvery Detail - English
Mulvery Detail - EnglishMulvery Detail - English
Mulvery Detail - EnglishDaichi Teruya
 
Software Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectSoftware Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectGreat Wide Open
 

Ähnlich wie The Actor Model applied to the Raspberry Pi and the Embedded Domain (20)

Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...
Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...
Introduction to OpenDaylight and Hydrogen, Learnings from the Year, What's Ne...
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1
 
C# in depth
C# in depthC# in depth
C# in depth
 
Technology Abstraction Eases Silicon Intellectual Property Portability
Technology Abstraction Eases Silicon Intellectual Property PortabilityTechnology Abstraction Eases Silicon Intellectual Property Portability
Technology Abstraction Eases Silicon Intellectual Property Portability
 
Preserving Computer-Aided Design, Digital Preservation Coalition Report
Preserving Computer-Aided Design, Digital Preservation Coalition ReportPreserving Computer-Aided Design, Digital Preservation Coalition Report
Preserving Computer-Aided Design, Digital Preservation Coalition Report
 
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing WorldCloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
Cloud, Distributed, Embedded: Erlang in the Heterogeneous Computing World
 
Distributing your pandas ETL job using Modin and Ray.pdf
Distributing your pandas ETL job using Modin and Ray.pdfDistributing your pandas ETL job using Modin and Ray.pdf
Distributing your pandas ETL job using Modin and Ray.pdf
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
 
SDN the network becomes the application
SDN the network becomes the applicationSDN the network becomes the application
SDN the network becomes the application
 
CHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopCHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshop
 
Redis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
Redis for Data Science and Engineering by Dmitry Polyakovsky of OracleRedis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
Redis for Data Science and Engineering by Dmitry Polyakovsky of Oracle
 
Embedded system
Embedded systemEmbedded system
Embedded system
 
End-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNXEnd-to-End Deep Learning Deployment with ONNX
End-to-End Deep Learning Deployment with ONNX
 
DRESD Project Presentation - December 2006
DRESD Project Presentation - December 2006DRESD Project Presentation - December 2006
DRESD Project Presentation - December 2006
 
Mulvery Detail - English
Mulvery Detail - EnglishMulvery Detail - English
Mulvery Detail - English
 
RDBMS vs NoSQL
RDBMS vs NoSQLRDBMS vs NoSQL
RDBMS vs NoSQL
 
3DD 1e 31 Luglio Apertura
3DD 1e 31 Luglio Apertura3DD 1e 31 Luglio Apertura
3DD 1e 31 Luglio Apertura
 
Software Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight ProjectSoftware Defined Networking: The OpenDaylight Project
Software Defined Networking: The OpenDaylight Project
 
Lecture VLSI
Lecture VLSILecture VLSI
Lecture VLSI
 
Net prog
Net progNet prog
Net prog
 

Mehr von Omer Kilic

Bare Metal from a Hardware Perspective: Embedded Frameworks & Build Systems
Bare Metal from a Hardware Perspective: Embedded Frameworks & Build SystemsBare Metal from a Hardware Perspective: Embedded Frameworks & Build Systems
Bare Metal from a Hardware Perspective: Embedded Frameworks & Build SystemsOmer Kilic
 
Gearing up for Volume Manufacturing
Gearing up for Volume ManufacturingGearing up for Volume Manufacturing
Gearing up for Volume ManufacturingOmer Kilic
 
The Process of Shipping Hardware Products
The Process of Shipping Hardware ProductsThe Process of Shipping Hardware Products
The Process of Shipping Hardware ProductsOmer Kilic
 
Confusion of Things — The IoT Hardware Kerfuffle
Confusion of Things — The IoT Hardware KerfuffleConfusion of Things — The IoT Hardware Kerfuffle
Confusion of Things — The IoT Hardware KerfuffleOmer Kilic
 
Fast and Furious: Overclocking chips for fun and profit
Fast and Furious: Overclocking chips for fun and profitFast and Furious: Overclocking chips for fun and profit
Fast and Furious: Overclocking chips for fun and profitOmer Kilic
 
Interfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the WorldInterfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the WorldOmer Kilic
 
A Quick Introduction to Programmable Logic
A Quick Introduction to Programmable LogicA Quick Introduction to Programmable Logic
A Quick Introduction to Programmable LogicOmer Kilic
 
concurrency.cc OSHUG #3
concurrency.cc OSHUG #3concurrency.cc OSHUG #3
concurrency.cc OSHUG #3Omer Kilic
 
BURO Arduino Workshop
BURO Arduino WorkshopBURO Arduino Workshop
BURO Arduino WorkshopOmer Kilic
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to ArduinoOmer Kilic
 
Interfacing with Arduino
Interfacing with ArduinoInterfacing with Arduino
Interfacing with ArduinoOmer Kilic
 
Introduction to XMOS Software Defined Silicon Technology
Introduction to XMOS Software Defined Silicon TechnologyIntroduction to XMOS Software Defined Silicon Technology
Introduction to XMOS Software Defined Silicon TechnologyOmer Kilic
 
TinkerSoc Electronics 101
TinkerSoc Electronics 101TinkerSoc Electronics 101
TinkerSoc Electronics 101Omer Kilic
 
Beer Bottle Night Lamp
Beer Bottle Night LampBeer Bottle Night Lamp
Beer Bottle Night LampOmer Kilic
 

Mehr von Omer Kilic (14)

Bare Metal from a Hardware Perspective: Embedded Frameworks & Build Systems
Bare Metal from a Hardware Perspective: Embedded Frameworks & Build SystemsBare Metal from a Hardware Perspective: Embedded Frameworks & Build Systems
Bare Metal from a Hardware Perspective: Embedded Frameworks & Build Systems
 
Gearing up for Volume Manufacturing
Gearing up for Volume ManufacturingGearing up for Volume Manufacturing
Gearing up for Volume Manufacturing
 
The Process of Shipping Hardware Products
The Process of Shipping Hardware ProductsThe Process of Shipping Hardware Products
The Process of Shipping Hardware Products
 
Confusion of Things — The IoT Hardware Kerfuffle
Confusion of Things — The IoT Hardware KerfuffleConfusion of Things — The IoT Hardware Kerfuffle
Confusion of Things — The IoT Hardware Kerfuffle
 
Fast and Furious: Overclocking chips for fun and profit
Fast and Furious: Overclocking chips for fun and profitFast and Furious: Overclocking chips for fun and profit
Fast and Furious: Overclocking chips for fun and profit
 
Interfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the WorldInterfacing the Raspberry Pi to the World
Interfacing the Raspberry Pi to the World
 
A Quick Introduction to Programmable Logic
A Quick Introduction to Programmable LogicA Quick Introduction to Programmable Logic
A Quick Introduction to Programmable Logic
 
concurrency.cc OSHUG #3
concurrency.cc OSHUG #3concurrency.cc OSHUG #3
concurrency.cc OSHUG #3
 
BURO Arduino Workshop
BURO Arduino WorkshopBURO Arduino Workshop
BURO Arduino Workshop
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Interfacing with Arduino
Interfacing with ArduinoInterfacing with Arduino
Interfacing with Arduino
 
Introduction to XMOS Software Defined Silicon Technology
Introduction to XMOS Software Defined Silicon TechnologyIntroduction to XMOS Software Defined Silicon Technology
Introduction to XMOS Software Defined Silicon Technology
 
TinkerSoc Electronics 101
TinkerSoc Electronics 101TinkerSoc Electronics 101
TinkerSoc Electronics 101
 
Beer Bottle Night Lamp
Beer Bottle Night LampBeer Bottle Night Lamp
Beer Bottle Night Lamp
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
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...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
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...Martijn de Jong
 
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, Adobeapidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 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...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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...
 
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...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 

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

  • 1. The Actor Model applied to the Raspberry Pi and the Embedded Domain Omer Kilic || @OmerK omer@erlang-solutions.com
  • 2. 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
  • 3. 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
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. Actor Model 03/12/2012 Tech Mesh London Slide 11 of 45
  • 12. Actor Model 03/12/2012 Tech Mesh London Slide 12 of 45
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. Creating an Actor Pid1 spawn(math, fact, [5]) Pid2 math:fact(5) 03/12/2012 Tech Mesh London Slide 17 of 45
  • 18. Communication Pid1 {Pid1, msg} Pid2 Pid2 ! {self(), msg} 03/12/2012 Tech Mesh London Slide 18 of 45
  • 20. 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
  • 21. Propagating Exit Signals {'EXIT', PidA, Reason} PidA PidB {'EXIT', PidB, Reason} PidC 03/12/2012 Tech Mesh London Slide 21 of 45
  • 22. Trapping Exits process_flag(trap_exit, true) {'EXIT', PidA, Reason} PidA PidB PidC 03/12/2012 Tech Mesh London Slide 22 of 45
  • 23. 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
  • 25. 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) 03/12/2012 $35 Tech Mesh London Slide 25 of 45
  • 26. 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
  • 28. 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
  • 29. 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
  • 30. 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
  • 34. 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
  • 35. 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
  • 38. TI OMAP Reference System 03/12/2012 Tech Mesh London Slide 38 of 45
  • 39. Hardware Projects – Ponte 03/12/2012 Tech Mesh London Slide 39 of 45
  • 40. Hardware Projects – Demo Board 03/12/2012 Tech Mesh London Slide 40 of 45
  • 43. Packages for Embedded Architectures https://www.erlang-solutions.com/downloads/download-erlang-otp 03/12/2012 Tech Mesh London Slide 43 of 45
  • 44. 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
  • 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