Erlang Paul Ang, Alex Quintero, Jessica Lombardi, Robin Adams.

Slides:



Advertisements
Similar presentations
OJ Reeves. Agenda  The Boring Stuff Basic syntax, expressions, funcs, records Atoms, BIFs, data types, bools, equality  The not so Boring Stuff Pattern.
Advertisements

CMSC 330: Organization of Programming Languages Tuples, Types, Conditionals and Recursion or “How many different OCaml topics can we cover in a single.
Thomas Arts Industrial Use of a Functional Language Thomas Arts Ericsson Computer Science Laboratory Stockholm, Sweden
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Concurrency The need for speed. Why concurrency? Moore’s law: 1. The number of components on a chip doubles about every 18 months 2. The speed of computation.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
The Spin Model Checker Promela Introduction Nguyen Tuan Duc Shogo Sawai.
Chapter 10.
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
ITERATIVE COMPUTATIONS CONCURRENCY ID1218 Lecture Christian Schulte Software and Computer Systems School of Information and.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 12 Imperative Programming I really hate this.
V Avon High School Tech Club Agenda Old Business –Delete Files New Business –Week 16 Topics: Intro to HTML/CSS –Questions? Tech Club Forums.
Advanced Software Tools Research Seminar Fall 07 Arik Nemtsov.
Erlang/QuickCheck Thomas Arts, IT University John Hughes, Chalmers University Gothenburg.
Evaluating Erlang: Are High-level Languages suitable for Robust Telecoms Software? Jan Nystrom SafeCom'05 – Henry Nystrom, Phil Trinder, David King.
Keneequa Brown Chris Duzan Navaid Khalfay. Originally developed in 1986 by Joe Armstrong as a proprietary language within Ericsson Released as open source.
Multicore Computing Using Erlang Art Gittleman California State University Long Beach
Motorola Internal Use Only Evaluating Erlang for Robust Telecoms Software David King 2004 S 3 Symposium – Henry Nystrom, Phil Trinder, David King.
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Domain Specific Languages in Erlang Dennis Byrne
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Supported by ELTE IKKK, Ericsson Hungary, in cooperation with University of Kent Erlang refactoring with relational database Anikó Víg and Tamás Nagy Supervisors:
Geog Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax.
Practical Erlang Programming Basic Erlang. © Erlang Training and Consulting Ltd2Basic Erlang Practical Erlang Programming.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
I Power Higher Computing Software Development High Level Language Constructs.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
PROGRAMMING LANGUAGES: PROLOG, CLOJURE, F# Jared Wheeler.
Objective-C Drew Cheng CS420. Overview True superset of ANSI C Object-Oriented methods from SmallTalk There is no formal written standard for the language.
Erlang Noah Dietrich Chris Ruffalo.
Principles of programming languages 10: Object oriented languages Isao Sasano Department of Information Science and Engineering.
Practical Erlang Programming OSCON Tutorial July 21 st 2009, San Jose Francesco Cesarini Erlang Training and Consulting Ltd
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Erlang Erricsson and Ellemtel Computer Science Laboratories
Channels. Models for Communications Synchronous communications – E.g. Telephone call Asynchronous communications – E.g. .
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
Message Passing, Concurrency, And Parallelism with Erlang Presented By: Craig R. Kuehn Department of Computer Science and Software Engineering University.
Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Third Edition by Tony Gaddis.
Erlang - a complete development environment for concurrent programming RTLab. Kim Tae-Hyon.
Euphoria Programming Language CSC 507 Kasilingam Vimalan.
Mutation Testing Laraib Zahid & Mariam Arshad. What is Mutation Testing?  Fault-based Testing: directed towards “typical” faults that could occur in.
Functional Processing of Collections (Advanced) 6.0.
Chapter 15 - C++ As A "Better C"
7 - Programming 7J, K, L, M, N, O – Handling Data.
Functional Programming
Basic concepts of C++ Presented by Prof. Satyajit De
Simulink Interface Layer (SIL)
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Coupling and Cohesion Rajni Bhalla.
SECTION 1: INTRODUCTION. SECTION 1: INTRODUCTION.
Parallel Programming By J. H. Wang May 2, 2017.
C Basics.
Erlang 15-Nov-18.
Aaron Bloomfield CS 415 Fall 2005
Programming Language Design
Lecture 23 Pages : Separating Syntactic Analysis from Execution. We omit many details so you have to read the section in the book. The halting.
1. Open Visual Studio 2008.
Iteration: Beyond the Basic PERFORM
Basic Syntax and Semantics
CS 36 – Chapter 11 Functional programming Features Practice
Channels.
Variables In today’s lesson we will look at: what a variable is
Computer Science 312 Concurrent Programming I Processes and Messages 1.
Industrial Use of a Functional Language
Channels.
Channels.
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
Presentation transcript:

Erlang Paul Ang, Alex Quintero, Jessica Lombardi, Robin Adams

History 1986 – Developed by Joe Armstrong – Worked for Ericsson (Telecommunications company). Created for better telephony Influenced by Plex, Lisp, Prolog, and Parlog but needed concurrency and error handling After replacing C++ in the AXE-N software in the Ellemtel phone company, Erlang became commercialized Influenced Clojure, F#, Opa, Reia, Rust, and Scala programming languages Amazon, Yahoo, Facebook, T-Mobile, Call of Duty

Erlang Development First Version Second Version- 10 times more efficient than original Presented at ISS’ Third Version- interfaces and compiler added Commercialized to multiple companies

Programming Basics “Erlang was designed to run concurrent programs forever” – Joe Armstrong Functional, not procedural Recursive, no loops Concurrent through the use of signal passing Small functions, but many processes Benefits: – Fault tolerant – Dynamically upgradable – Works well for parallelism

Data Types Numbers: Integers and floats Atoms – similar to constants (true and false are atoms) Funs – anonymous functions – Sum = fun(X,Y) -> X+Y end. – Sum(5,5) Tuples – Fixed amount of data. Any item can be accessed in constant time Lists – Group of data types; varying amount. First item can be accessed in constant time, while other elements can be accessed in O(n) time. Records – similar to structs in c

Hello World Hello.erl -module(hello). -export([hello_world/0]). hello_world() -> io:fwrite("hello, world\n"). Compile/Run

Recursive Functions Recursive.erl -module(recursive). -export([fact/1, qsort/1]). fact(1) -> 1; fact(N) -> N * fact(N - 1). qsort([]) -> []; qsort([H | T]) -> qsort([X || X <- T, X < H]) ++ [H] ++ qsort([X || X = H]). Compile/Run

Guarded Commands Compare.erl -module(guarded). -export([gt/2]). greaterThan(N, M) -> if N > M -> true; N false; true -> equal end. while(N) when N == 5 -> io:fwrite("~n~B ",[N]), while(N-1); while(N) when N > 0 -> io:fwrite("~B ",[N]), while(N-1); while(_) when true -> done. Compile/Run

Concurrency -module(concurrent). -export([go/1]). go(List) -> Buffer = spawn(fun() -> buff([],5) end), spawn(fun() -> c(Buffer, 1) end), spawn(fun() -> c(Buffer, 2) end), spawn(fun() -> p(List, 1, Buffer) end), spawn(fun() -> p(List, 2, Buffer) end), spawn(fun() -> p(List, 3, Buffer) end), ok. p([], ID, _) -> io:fwrite("P~B Done~n",[ID]); p([H | T], ID, Buffer) -> % Send item to buffer Buffer ! {self(), ID, H}, receive % Check buffer received {_} -> p(T, ID, Buffer) end. c(Buffer,ID) -> Buffer ! {self(), ID}, % Signal buffer to send item receive %Process consumed item {A} -> c(Buffer, ID) % Receive item from buffer end. buff(List, Size) -> io:fwrite("buffer: ~w~n", [List]), receive % Send to the consumer {From, ID} when length(List) > 0 -> [A|B] = List, From ! {A}, % Send message to consumer io:fwrite("C~B Consumed: ~B~n", [ID, A]), buff(B,Size); % Receive from the producer {From, Id, Msg} when length(List) From ! {self()}, % Send message to producer io:fwrite("P~B Produced: ~B~n", [Id, Msg]), buff(List ++ [Msg], Size) end.

Concurrency (Output) buffer: [] ok P1 Produced: 1 buffer: [1] C1 Consumed: 1 buffer: [] P2 Produced: 1 buffer: [1] C2 Consumed: 1 buffer: [] P3 Produced: 1 buffer: [1] P1 Produced: 2 buffer: [1,2] C1 Consumed: 1 buffer: [2] P2 Produced: 2 buffer: [2,2] C2 Consumed: 2 buffer: [2] P3 Produced: 2 buffer: [2,2] P1 Produced: 3 buffer: [2,2,3] C1 Consumed: 2 buffer: [2,3] P2 Produced: 3 buffer: [2,3,3] C2 Consumed: 2 buffer: [3,3] P3 Produced: 3 buffer: [3,3,3] P1 Produced: 4 buffer: [3,3,3,4] C1 Consumed: 3 buffer: [3,3,4] P2 Produced: 4 buffer: [3,3,4,4] C2 Consumed: 3 buffer: [3,4,4] P3 Produced: 4 buffer: [3,4,4,4] P1 Produced: 5 buffer: [3,4,4,4,5] C1 Consumed: 3 buffer: [4,4,4,5] P2 Produced: 5 buffer: [4,4,4,5,5] C2 Consumed: 4 buffer: [4,4,5,5] P3 Produced: 5 buffer: [4,4,5,5,5] C1 Consumed: 4 buffer: [4,5,5,5] P1 Produced: 6 P1 Done buffer: [4,5,5,5,6] C2 Consumed: 4 buffer: [5,5,5,6] P2 Produced: 6 P2 Done buffer: [5,5,5,6,6] C1 Consumed: 5 buffer: [5,5,6,6] P3 Produced: 6 P3 Done buffer: [5,5,6,6,6] C2 Consumed: 5 buffer: [5,6,6,6] C1 Consumed: 5 buffer: [6,6,6] C2 Consumed: 6 buffer: [6,6] C1 Consumed: 6 buffer: [6] C2 Consumed: 6 buffer: []

QUESTIONS???