This document discusses the shift towards concurrent programming due to the end of Moore's Law and the rise of multi-core processors. It covers key concepts in concurrent programming like parallelism, concurrency, shared state, synchronization, and message passing. The document recommends using languages and models that avoid shared state through message passing between actors or processes. It introduces several concurrent programming languages - Erlang, Go, Scala, Haskell - that use models like actors or software transactional memory. The goal of the course is to learn concurrent programming idioms using one of these languages.
4. The End of Moore’s Law
Why we don’t have 10 GHz chips today
Chips are too big
Signals can no longer reach the whole chip in a
clock cycle
Problems with heat dissipation
5. The Multicore Era
Manufactures have turned towards multi-core
processors in order to increase speed
They are capable of doing multiple calculations in
parallel
CPU speeds are likely to stay relatively flat
7. The Concurrency
Revolution
Intel HyperThreading - hardware supported
Future computer architectures will have greater
number of cores, from the desktop (12 typical for
workstation) to the smartphone (2 in iPhone)
You will need to develop well-written concurrent
applications to gain from this hardware
development
8. Vocabulary
Parallelism
Programming as the simultaneous execution of
(possibly related) computations
Concurrency
Programming as the composition of
independently executing processes
12. Shared State
Concurrency
Threads concurrently execute code
Contains resources that must be shared
Synchronization is required via locks
Data consistency
Visibility
Correct ordering
14. Why locking is evil
“non-trivial multi-threaded programs are
incomprehensible to human …” - Edward A. Lee,
The Problem with Threads
“humans are quickly overwhelmed by concurrency
and find it much more difficult to reason about
concurrent than sequential code” - Sutter and
Larus
“I have a firm belief that locking primitives are evil”
16. Message Passing
Carl Hewitt, Richard Steiger and Peter Bishop
released a paper in 1973 introducing the Actor
Model concept
C.A.R. Hoare: Communicating Sequential
Processes (CSP). Introduced in 1978.
Very similar concepts. We shall refer to them both
as “message passing” (aka process calculus)
23. Goals for this course:
Learn Concurrent Programming using CSP/Actor model
Become familiar with concurrent programming idioms
All assignments can be fulfilled using Language of choice
•Elixir (Erlang)
•Go (the new “C”)
•Scala (Java)
•Haskell (purely functional)
Grade
•Weekly HW
•Mid-term quiz
•Final Project
26. Erlang in the real world
Ericsson ATM switch (301 model)
99.9999999 percent uptime
Facebook chat
100s of millions concurrent users
RabbitMQ
High performance AMQP
Apache CouchDB
distributed, fault-tolerant document DB
31. Go Language
Developed by Rob Pike, formerly of Bell Labs
Statically compiled and typed language, loosely
based upon C syntax
Supports Garbage Collection, and Concurrency
Used internally at Google
Strong community support and documentation
33. Scala
The new “Java”. Runs on Java VM
Object oriented and functional design
Very flexible
Can use Java libraries
Syntax can be tough due to mix of OO and F
35. Haskell
Purely functional programming language
Built-in support for concurrency and parallelism
Typically used more in research community than
commercially
Powerful but confusing syntax
38. Homework
Research language that you would like to use
Watch http://blog.golang.org/concurrency-is-not-
parallelism video by Rob Pike
Work on Assignment #1 for next week