Multicore Computing Using Erlang Art Gittleman California State University Long Beach

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

PRAM Algorithms Sathish Vadhiyar. PRAM Model - Introduction Parallel Random Access Machine Allows parallel-algorithm designers to treat processing power.
Chapter 7 Introduction to Procedures. So far, all programs written in such way that all subtasks are integrated in one single large program. There is.
Thomas Arts Industrial Use of a Functional Language Thomas Arts Ericsson Computer Science Laboratory Stockholm, Sweden
Erlang Paul Ang, Alex Quintero, Jessica Lombardi, Robin Adams.
Functional Programming. Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends.
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.
A Dynamic World, what can Grids do for Multi-Core computing? Daniel Goodman, Anne Trefethen and Douglas Creager
Parallel Algorithms Lecture Notes. Motivation Programs face two perennial problems:: –Time: Run faster in solving a problem Example: speed up time needed.
Advanced Topics in Algorithms and Data Structures Classification of the PRAM model In the PRAM model, processors communicate by reading from and writing.
Erlang concurrency. Where were we? Finished talking about sequential Erlang Left with two questions  retry – not an issue; I mis-read the statement in.
ISBN Chapter 15 Functional Programming Languages Mathematical Functions Fundamentals of Functional Programming Languages Introduction to.
Based on Silberschatz, Galvin and Gagne  2009 Threads Definition and motivation Multithreading Models Threading Issues Examples.
3.5 Interprocess Communication
Aho-Corasick String Matching An Efficient String Matching.
ITERATIVE COMPUTATIONS CONCURRENCY ID1218 Lecture Christian Schulte Software and Computer Systems School of Information and.
FUNCTIONAL PROGRAMMING IN ERLANG ID1218 Lecture Christian Schulte Software and Computer Systems School of Information and.
Flynn’s Taxonomy of Computer Architectures Source: Wikipedia Michael Flynn 1966 CMPS 5433 – Parallel Processing.
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Exercise problems for students taking the Programming Parallel Computers course. Janusz Kowalik Piotr Arlukowicz Tadeusz Puzniakowski Informatics Institute.
Erlang/QuickCheck Thomas Arts, IT University John Hughes, Chalmers University Gothenburg.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
Parallel Algorithms Sorting and more. Keep hardware in mind When considering ‘parallel’ algorithms, – We have to have an understanding of the hardware.
ISBN Chapter 15 Functional Programming Languages.
Threads by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
Chapter 2 Parallel Architecture. Moore’s Law The number of transistors on a chip doubles every years. – Has been valid for over 40 years – Can’t.
5-1 Chapter 5 - Languages and the Machine Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of Computer.
CS 346 – Chapter 4 Threads –How they differ from processes –Definition, purpose Threads of the same process share: code, data, open files –Types –Support.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
Functional Programming With examples in F#. Pure Functional Programming Functional programming involves evaluating expressions rather than executing commands.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Lecture 20: Parallelism & Concurrency CS 62 Spring 2013 Kim Bruce & Kevin Coogan CS 62 Spring 2013 Kim Bruce & Kevin Coogan Some slides based on those.
Early Adopter: Integration of Parallel Topics into the Undergraduate CS Curriculum at Calvin College Joel C. Adams Chair, Department of Computer Science.
ISBN Chapter 15 Functional Programming Languages.
Static Detection of Race Conditions in Erlang Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas.
 Frequent Word Combinations Mining and Indexing on HBase Hemanth Gokavarapu Santhosh Kumar Saminathan.
LOGO Erlang 11 ACM 王浩然. Company Logo concurrency  in real world  in computer.
Advanced Computer Networks Lecture 1 - Parallelization 1.
Memory Management Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only storage.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
ECE 526 – Network Processing Systems Design Programming Model Chapter 21: D. E. Comer.
COMP7330/7336 Advanced Parallel and Distributed Computing Task Partitioning Dr. Xiao Qin Auburn University
MULTIPROCESSING MODULE OF PYTHON. CPYTHON  CPython is the default, most-widely used implementation of the Python programming language.  CPython - single-threaded.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
Item Based Recommender System SUPERVISED BY: DR. MANISH KUMAR BAJPAI TARUN BHATIA ( ) VAIBHAV JAISWAL( )
INTRODUCTION TO HIGH PERFORMANCE COMPUTING AND TERMINOLOGY.
Lecture 5. Example for periority The average waiting time : = 41/5= 8.2.
Chapter 4: Threads Modified by Dr. Neerja Mhaskar for CS 3SH3.
Introduction to threads
Homework Assignment #2 J. H. Wang Oct. 25, 2016.
Functional Programming Languages
ITCS-3190.
Operating System (013022) Dr. H. Iwidat
Computer Engg, IIT(BHU)
Erlang: What, Why and How
Introduction to Parallelism.
Chapter 4: Threads.
Unit-2 Divide and Conquer
Functional Programming Languages
Background and Motivation
Data Structures (CS212D) Week # 2: Arrays.
Multithreaded Programming
Arrays Week 2.
Threads.
Chapter 4: Threads & Concurrency
Computer Science 312 Concurrent Programming I Processes and Messages 1.
Parallelism Can we make it faster? 8-May-19.
Outline Chapter 3: Processes Chapter 4: Threads So far - Next -
Presentation transcript:

Multicore Computing Using Erlang Art Gittleman California State University Long Beach

Motivation David Patterson – 2006 article The number of processors per chip is expected to double every two years Educating faculty to train students in concurrency is not a trivial problem

Using Multiple Processors Most languages Shared memory – must protect against simultaneous modification Erlang Asynchronous message passing Create processes Scheduler uses available processors

Erlang Functional programming language Developed at Ericsson Open Source, runs on Windows, Linux, Mac Applications Amazon SimpleDB Facebook chat (70 million+ users)

Teaching Erlang Survey of Programming Languages Five week module on functional programming Used machines with two cores Basic Erlang and some concurrency Advanced Programming Languages Ten-week unit Used Beowulf cluster, 30 processors

Erlang Intro Binding variables Uses pattern matching X = 4. binds X to 4 Y = X + 2. binds Y to 6 X = 3. error – X bound to 4 Z + 1 = Y. binds Z to 5

Data Structures Tuples – fixed size X = {hat, cat, fat}. {A, cat, fat} = X. binds A to hat Lists – variable size L = [3, 4, 5, 6]. [X | Y] = L. binds X to 3, Y to [4,5,6]

Functions Recursive definition -module(append). -export([append/2]). append([ ], L) → L; append([H | T], L) → [H | append(T, L).

Concurrency Primitives Create a process Pid = spawn(Fun) % Fun executes % in new process Send a process a message Pid ! Message Receive a message receive … end

-module(times2). -export([run/1]). times2() -> % executed in a process receive {From, X} -> From ! 2*X, % send back ans times2() end. run(Num) → % run(10) returns 20 Pid = spawn(fun times2/0), % create Pid ! {self(), Num}, % send receive Result -> Result end.

Three Assignments 1. Write three recursive functions Generate a list of squares of random numbers Sum two lists, element by element Count the number of items < 1 in a list 2. Estimate pi. Send number of random trials to a process that computes pi and returns result. 3. Estimate pi using four processes. Speedup shown with two-core machines

Higher-Order Functions Map L = [1,2,3,4]. lists:map(fun(X) → 2*X end, L). % returns [2,4,6,8] List-comprehension [2*X || X ← L].

Ten most frequent words From Adam Turoff, Haskell article Used text of Emma by Jane Austen Develop simple functions to find the ten most frequent words Read text as list, split into sublists of equal words, create sublists of [freq, word] pairs, reverse sort, return top ten. Many functions such as 'sort' are provided.

Strassen Matrix Multiplication Recursive, more efficient than standard method NxN matrix requires 7 N/2xN/2 multiplications Used seven machines on a Beowulf cluster. Compare 14 processors to 1. Time in seconds 256x x x | |

Conclusions Erlang was easy to use for concurrency. The programmer spawns processes and the scheduler uses available processors either on the same machine or distributed. Erlang fits well in a programing languages course.