SlideShare a Scribd company logo
Concurrency &
Parallel Programming
by Ramazan AYYILDIZ
rayyildiz.me@rayyildiz
Gordon Moore
Intel co-founder
Moore’s Law
ansistors incorporated in a chip will approximately double e
Multi Core CPUs
Concurrency
vs
Parallel Programming
Parallel Programming
• Uses a multiplicity of computational hardware (e.g.,
several processor cores) to perform a computation
more quickly
Concurrency
• A programming structuring technique in which there
are multiple threads of control.
Concurrency & Parallel Programming
Concurrency & Parallel Programming
Beyond the Multiple
Cores
Parallel Architecture
• Instruction Level Parallelism
• 8 bit —> 16 bit —> 32 bit —> 64 bit —> …
• Data parallelism
• GPU
• Intel accured Altera ~17 Billion USD
Concurrency & Parallel Programming
Threads
Threads
• Simple thread for java
• java.util.Thread
• Mutex, Deadlock, Race Condition, Lock
Simple Thread
• Why Thread.yield()
• a hint to schedule that the current thread is willing
to yield its current use of processor
• Why Thread.join()
Concurrency & Parallel Programming
Race Condition
Solution of Race Condition
• synronized keyword
• java.util.Lock
• Immutable
• Atomic Integer
Multiple Locks?
Dining Philosophers
• A philosopher is either hungry
or thinking
• If he is hungry, he picks up a
chopsticks on either side of
him and eats for a while.
• When he is done, he puts
them down
DEADLOCKS
• java 6 has java.util.concurrent package.
• This package has great features
• Use case :
• XBRL instance creation ( 5-6 financial table in
parallel by Executer Tasks)
• Load tests 75 —> 150 concurrent user
If it Hurts,Stop doing it
FUNCTIONAL
PROGRAMMING
Functional Programming
• Imperative program has series of statements that
changes global state when executed
• A functional programming ( aka FP) computation as
evaluation of expression.
• Those expressions are built from pure
mathematical functions
• Side effect free
• FP is useful for concurrency because lack of side
effect makes reasoning about thread safety much
easier.
• FP allows parallelism to be represented directly.
• If data is immutable ( not shared mutable state) can
be accessed by multiple threads without any kind
of locking.
History of FP
• FP invented in 1930s, Lambda Calculus
• in 1950s, LISP was created by John McCarthy
• in 1970s, ML was created Robin Milner and David
Turner.
• in 1987, Haskell began with a consensus (open
standards)
Haskell Basic Features
• Pure Function
• First Class and higher order function
• Recursion
• Immutable
• Lazy evaluation
Concurrency & Parallel Programming
Fibonacci Number in Haskell
Use Case : Facebook Spam
detection ( HAXL)
Actor Model
Concurrency & Parallel Programming
Elixir
• Created by Jose Valim in 2012
• Syntax is similar to Ruby
• Runs on Erlang Virtual
Machine (BEAM)
• Functional
• Erlang process (actor)
Concurrency & Parallel Programming
Use Case : Pinterest
• 14000 notification per seconds
• Runs on 15 server( old one runs on 30 server)
• Pinterest API : response time is about 500 µs
https://engineering.pinterest.com/blog/introducing-new-open-source-tools-elixir-community
Use Case : Whatsapp
• Run on Erlang BEAM/OTP
• 1+ Million user signup per day
• 50 Million messages per day
• 14 Million active users per day
• Total 450 Million users
• >8000 cores
• > 70Million Erlang messages per day
• 2 Million connection per server
http://highscalability.com/blog/2014/2/26/the-whatsapp-architecture-facebook-bought-for-19-billion.html
Questions ?
Bonus Sections
Bonus - 1
• Clojure
• Created by Rich Hickey in
2007
• Inspired by LISP
• Runs on JVM
• Clojure Agent: shared access
to mutable state.
• No blocking receive
Bonus - 2
• Is FP (Haskell) ready for
industry ?
• Linq invented by Eric Meijer
• Scala, F# , Swift, even Java
8 has FP features
Bonus - 3
• I love imperative style, which
programming language may I
use ?
• GOLANG :
• is invented after multi core
• Has Garbage Collector
• Has go-routine & chain

More Related Content

PDF
Docker 101: Introduction to Docker
PDF
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
PPT
Monitoring using Prometheus and Grafana
PPT
Introduction to redis
PPT
presentation on Docker
PDF
CS9222 ADVANCED OPERATING SYSTEMS
PPTX
GOOGLE FILE SYSTEM
PPTX
OpenTelemetry For Operators
Docker 101: Introduction to Docker
A GitOps Kubernetes Native CICD Solution with Argo Events, Workflows, and CD
Monitoring using Prometheus and Grafana
Introduction to redis
presentation on Docker
CS9222 ADVANCED OPERATING SYSTEMS
GOOGLE FILE SYSTEM
OpenTelemetry For Operators

What's hot (20)

ODP
Monitoring With Prometheus
PPTX
Maven tutorial
PDF
Parallelization of Structured Streaming Jobs Using Delta Lake
PPTX
Pymongo password change made easy
PPTX
Node js Introduction
PDF
Introduction to OpenMP
PPT
Architecture of Linux
PDF
NoSQL
PDF
Docker & kubernetes
PDF
Introduction to Nexus Repository Manager.pdf
PDF
Infrastructure & System Monitoring using Prometheus
PPT
Step-by-Step Introduction to Apache Flink
PDF
PPTX
PDF
OpenShift 4, the smarter Kubernetes platform
PPTX
Introduction to jenkins
PDF
Introduction to elasticsearch
ODP
Elasticsearch for beginners
PDF
Introduction to OpenMP
PDF
asyncio internals
Monitoring With Prometheus
Maven tutorial
Parallelization of Structured Streaming Jobs Using Delta Lake
Pymongo password change made easy
Node js Introduction
Introduction to OpenMP
Architecture of Linux
NoSQL
Docker & kubernetes
Introduction to Nexus Repository Manager.pdf
Infrastructure & System Monitoring using Prometheus
Step-by-Step Introduction to Apache Flink
OpenShift 4, the smarter Kubernetes platform
Introduction to jenkins
Introduction to elasticsearch
Elasticsearch for beginners
Introduction to OpenMP
asyncio internals
Ad

Viewers also liked (20)

PPTX
Delphi Parallel Programming Library
PPTX
Hardware and software parallelism
PPTX
Uses of java
KEY
The Joy Of Functional Programming
PDF
Perl 6 for Concurrency and Parallel Computing
PDF
Ateji PX for Java
PPT
Parallel programming
PPTX
Transactional Memory
PDF
Concurrent/ parallel programming
PPT
Hardware and Software parallelism
PPTX
Effective java - concurrency
PDF
Concurrency: Best Practices
PPTX
Java8 training - class 2
PPTX
Java8 training - class 3
PPTX
Java8 training - Class 1
PPTX
Concurrency with java
PDF
Comparing different concurrency models on the JVM
PDF
Building Applications with a Graph Database
DOCX
What is concurrency
PDF
Delphi Parallel Programming Library
Hardware and software parallelism
Uses of java
The Joy Of Functional Programming
Perl 6 for Concurrency and Parallel Computing
Ateji PX for Java
Parallel programming
Transactional Memory
Concurrent/ parallel programming
Hardware and Software parallelism
Effective java - concurrency
Concurrency: Best Practices
Java8 training - class 2
Java8 training - class 3
Java8 training - Class 1
Concurrency with java
Comparing different concurrency models on the JVM
Building Applications with a Graph Database
What is concurrency
Ad

Similar to Concurrency & Parallel Programming (20)

PDF
Introduction to multicore .ppt
PPTX
Concurrency Constructs Overview
PDF
If You Think You Can Stay Away from Functional Programming, You Are Wrong
PDF
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
ODP
Mario Fusco - Comparing different concurrency models on the JVM | Codemotion ...
PPTX
Functional Programming and Concurrency Patterns in Scala
PPTX
Functional programming
PPTX
Why functional programming in C# & F#
PPT
BayFP: Concurrent and Multicore Haskell
PDF
A Survey of Concurrency Constructs
PDF
Functional Programming with Immutable Data Structures
PDF
Simon Peyton Jones: Managing parallelism
PDF
Peyton jones-2011-parallel haskell-the_future
PPTX
Seminar on Parallel and Concurrent Programming
PDF
Introducing Parallel Pixie Dust
PPT
Oscon keynote: Working hard to keep it simple
PPT
Bay NET Aug 19 2009 presentation ppt
PDF
Functional Programming #FTW
PDF
The Need for Async @ ScalaWorld
PDF
GeekNight 22.0 Multi-paradigm programming in Scala and Akka
Introduction to multicore .ppt
Concurrency Constructs Overview
If You Think You Can Stay Away from Functional Programming, You Are Wrong
Voxxed Days Vienna - The Why and How of Reactive Web-Applications on the JVM
Mario Fusco - Comparing different concurrency models on the JVM | Codemotion ...
Functional Programming and Concurrency Patterns in Scala
Functional programming
Why functional programming in C# & F#
BayFP: Concurrent and Multicore Haskell
A Survey of Concurrency Constructs
Functional Programming with Immutable Data Structures
Simon Peyton Jones: Managing parallelism
Peyton jones-2011-parallel haskell-the_future
Seminar on Parallel and Concurrent Programming
Introducing Parallel Pixie Dust
Oscon keynote: Working hard to keep it simple
Bay NET Aug 19 2009 presentation ppt
Functional Programming #FTW
The Need for Async @ ScalaWorld
GeekNight 22.0 Multi-paradigm programming in Scala and Akka

Recently uploaded (20)

PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
System and Network Administration Chapter 2
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Transform Your Business with a Software ERP System
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
top salesforce developer skills in 2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
System and Network Administraation Chapter 3
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
System and Network Administration Chapter 2
How Creative Agencies Leverage Project Management Software.pdf
L1 - Introduction to python Backend.pptx
Transform Your Business with a Software ERP System
How to Migrate SBCGlobal Email to Yahoo Easily
top salesforce developer skills in 2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
System and Network Administraation Chapter 3
Understanding Forklifts - TECH EHS Solution
Upgrade and Innovation Strategies for SAP ERP Customers
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
How to Choose the Right IT Partner for Your Business in Malaysia
PTS Company Brochure 2025 (1).pdf.......
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free

Concurrency & Parallel Programming

  • 1. Concurrency & Parallel Programming by Ramazan AYYILDIZ rayyildiz.me@rayyildiz
  • 3. Moore’s Law ansistors incorporated in a chip will approximately double e
  • 6. Parallel Programming • Uses a multiplicity of computational hardware (e.g., several processor cores) to perform a computation more quickly
  • 7. Concurrency • A programming structuring technique in which there are multiple threads of control.
  • 11. Parallel Architecture • Instruction Level Parallelism • 8 bit —> 16 bit —> 32 bit —> 64 bit —> … • Data parallelism • GPU • Intel accured Altera ~17 Billion USD
  • 14. Threads • Simple thread for java • java.util.Thread • Mutex, Deadlock, Race Condition, Lock
  • 16. • Why Thread.yield() • a hint to schedule that the current thread is willing to yield its current use of processor • Why Thread.join()
  • 19. Solution of Race Condition • synronized keyword • java.util.Lock • Immutable • Atomic Integer
  • 21. Dining Philosophers • A philosopher is either hungry or thinking • If he is hungry, he picks up a chopsticks on either side of him and eats for a while. • When he is done, he puts them down
  • 23. • java 6 has java.util.concurrent package. • This package has great features • Use case : • XBRL instance creation ( 5-6 financial table in parallel by Executer Tasks) • Load tests 75 —> 150 concurrent user
  • 24. If it Hurts,Stop doing it
  • 26. Functional Programming • Imperative program has series of statements that changes global state when executed • A functional programming ( aka FP) computation as evaluation of expression. • Those expressions are built from pure mathematical functions • Side effect free
  • 27. • FP is useful for concurrency because lack of side effect makes reasoning about thread safety much easier. • FP allows parallelism to be represented directly. • If data is immutable ( not shared mutable state) can be accessed by multiple threads without any kind of locking.
  • 28. History of FP • FP invented in 1930s, Lambda Calculus • in 1950s, LISP was created by John McCarthy • in 1970s, ML was created Robin Milner and David Turner. • in 1987, Haskell began with a consensus (open standards)
  • 29. Haskell Basic Features • Pure Function • First Class and higher order function • Recursion • Immutable • Lazy evaluation
  • 32. Use Case : Facebook Spam detection ( HAXL)
  • 35. Elixir • Created by Jose Valim in 2012 • Syntax is similar to Ruby • Runs on Erlang Virtual Machine (BEAM) • Functional • Erlang process (actor)
  • 37. Use Case : Pinterest • 14000 notification per seconds • Runs on 15 server( old one runs on 30 server) • Pinterest API : response time is about 500 µs https://engineering.pinterest.com/blog/introducing-new-open-source-tools-elixir-community
  • 38. Use Case : Whatsapp • Run on Erlang BEAM/OTP • 1+ Million user signup per day • 50 Million messages per day • 14 Million active users per day • Total 450 Million users • >8000 cores • > 70Million Erlang messages per day • 2 Million connection per server http://highscalability.com/blog/2014/2/26/the-whatsapp-architecture-facebook-bought-for-19-billion.html
  • 41. Bonus - 1 • Clojure • Created by Rich Hickey in 2007 • Inspired by LISP • Runs on JVM • Clojure Agent: shared access to mutable state. • No blocking receive
  • 42. Bonus - 2 • Is FP (Haskell) ready for industry ? • Linq invented by Eric Meijer • Scala, F# , Swift, even Java 8 has FP features
  • 43. Bonus - 3 • I love imperative style, which programming language may I use ? • GOLANG : • is invented after multi core • Has Garbage Collector • Has go-routine & chain