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.
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
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()
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
Fibonacci Number in Haskell
Use Case : Facebook Spam
detection ( HAXL)
Actor Model
Elixir
• Created by Jose Valim in 2012
• Syntax is similar to Ruby
• Runs on Erlang Virtual
Machine (BEAM)
• Functional
• Erlang process (actor)
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

What's hot

Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
Prankit Mishra
 
Context switching
Context switchingContext switching
Context switching
DarakhshanNayyab
 
Object Oriented Methodology in Java (Lecture-1)
Object Oriented Methodology in Java (Lecture-1)Object Oriented Methodology in Java (Lecture-1)
Object Oriented Methodology in Java (Lecture-1)
Md. Mujahid Islam
 
Operating system interview question
Operating system interview questionOperating system interview question
Operating system interview questionsriram saravanan
 
Demand paging
Demand pagingDemand paging
Demand paging
Trinity Dwarka
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threads
cscarcas
 
Domain Modeling
Domain ModelingDomain Modeling
Domain Modeling
Harsh Jegadeesan
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NETShingalaKrupa
 
Software Engineering (Project Scheduling)
Software Engineering (Project Scheduling)Software Engineering (Project Scheduling)
Software Engineering (Project Scheduling)
ShudipPal
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management
Shashank Asthana
 
Function oriented design
Function oriented designFunction oriented design
Function oriented design
Vidhun T
 
Rational Unified Process
Rational Unified ProcessRational Unified Process
Rational Unified Process
Kumar
 
4 p’s of management spectrum and the w5hh principle
4 p’s of management spectrum and the w5hh principle4 p’s of management spectrum and the w5hh principle
4 p’s of management spectrum and the w5hh principle
Mohammad Hafiz-Al-Masud
 
Concurrent programming
Concurrent programmingConcurrent programming
Concurrent programming
Rahul Singh
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
Shubhashish Punj
 
07 software design
07   software design07   software design
07 software designkebsterz
 
Introduction to UML
Introduction to UMLIntroduction to UML

What's hot (20)

Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Context switching
Context switchingContext switching
Context switching
 
Object Oriented Methodology in Java (Lecture-1)
Object Oriented Methodology in Java (Lecture-1)Object Oriented Methodology in Java (Lecture-1)
Object Oriented Methodology in Java (Lecture-1)
 
Operating system interview question
Operating system interview questionOperating system interview question
Operating system interview question
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Unit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - ThreadsUnit II - 2 - Operating System - Threads
Unit II - 2 - Operating System - Threads
 
Memory management
Memory managementMemory management
Memory management
 
Domain Modeling
Domain ModelingDomain Modeling
Domain Modeling
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
SHELL PROGRAMMING
SHELL PROGRAMMINGSHELL PROGRAMMING
SHELL PROGRAMMING
 
Cookie & Session In ASP.NET
Cookie & Session In ASP.NETCookie & Session In ASP.NET
Cookie & Session In ASP.NET
 
Software Engineering (Project Scheduling)
Software Engineering (Project Scheduling)Software Engineering (Project Scheduling)
Software Engineering (Project Scheduling)
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management
 
Function oriented design
Function oriented designFunction oriented design
Function oriented design
 
Rational Unified Process
Rational Unified ProcessRational Unified Process
Rational Unified Process
 
4 p’s of management spectrum and the w5hh principle
4 p’s of management spectrum and the w5hh principle4 p’s of management spectrum and the w5hh principle
4 p’s of management spectrum and the w5hh principle
 
Concurrent programming
Concurrent programmingConcurrent programming
Concurrent programming
 
CPU Scheduling Algorithms
CPU Scheduling AlgorithmsCPU Scheduling Algorithms
CPU Scheduling Algorithms
 
07 software design
07   software design07   software design
07 software design
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 

Viewers also liked

Delphi Parallel Programming Library
Delphi Parallel Programming LibraryDelphi Parallel Programming Library
Delphi Parallel Programming Library
Mario Guedes
 
Hardware and software parallelism
Hardware and software parallelismHardware and software parallelism
Hardware and software parallelism
Sumita Das
 
Uses of java
Uses of javaUses of java
Uses of java
joeyparkker
 
The Joy Of Functional Programming
The Joy Of Functional ProgrammingThe Joy Of Functional Programming
The Joy Of Functional Programming
jasondew
 
Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel ComputingPerl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel Computing
Andrew Shitov
 
Ateji PX for Java
Ateji PX for JavaAteji PX for Java
Ateji PX for Java
Patrick Viry
 
Parallel programming
Parallel programmingParallel programming
Parallel programming
Swain Loda
 
Transactional Memory
Transactional MemoryTransactional Memory
Transactional Memory
Smruti Sarangi
 
Concurrent/ parallel programming
Concurrent/ parallel programmingConcurrent/ parallel programming
Concurrent/ parallel programming
Tausun Akhtary
 
Hardware and Software parallelism
Hardware and Software parallelismHardware and Software parallelism
Hardware and Software parallelismprashantdahake
 
Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrency
feng lee
 
Concurrency: Best Practices
Concurrency: Best PracticesConcurrency: Best Practices
Concurrency: Best Practices
IndicThreads
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2
Marut Singh
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
Marut Singh
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1
Marut Singh
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
Hoang Nguyen
 
Comparing different concurrency models on the JVM
Comparing different concurrency models on the JVMComparing different concurrency models on the JVM
Comparing different concurrency models on the JVM
Mario Fusco
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph Database
Tobias Lindaaker
 
What is concurrency
What is concurrencyWhat is concurrency
What is concurrency
lodhran-hayat
 
Java8
Java8Java8

Viewers also liked (20)

Delphi Parallel Programming Library
Delphi Parallel Programming LibraryDelphi Parallel Programming Library
Delphi Parallel Programming Library
 
Hardware and software parallelism
Hardware and software parallelismHardware and software parallelism
Hardware and software parallelism
 
Uses of java
Uses of javaUses of java
Uses of java
 
The Joy Of Functional Programming
The Joy Of Functional ProgrammingThe Joy Of Functional Programming
The Joy Of Functional Programming
 
Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel ComputingPerl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel Computing
 
Ateji PX for Java
Ateji PX for JavaAteji PX for Java
Ateji PX for Java
 
Parallel programming
Parallel programmingParallel programming
Parallel programming
 
Transactional Memory
Transactional MemoryTransactional Memory
Transactional Memory
 
Concurrent/ parallel programming
Concurrent/ parallel programmingConcurrent/ parallel programming
Concurrent/ parallel programming
 
Hardware and Software parallelism
Hardware and Software parallelismHardware and Software parallelism
Hardware and Software parallelism
 
Effective java - concurrency
Effective java - concurrencyEffective java - concurrency
Effective java - concurrency
 
Concurrency: Best Practices
Concurrency: Best PracticesConcurrency: Best Practices
Concurrency: Best Practices
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with java
 
Comparing different concurrency models on the JVM
Comparing different concurrency models on the JVMComparing different concurrency models on the JVM
Comparing different concurrency models on the JVM
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph Database
 
What is concurrency
What is concurrencyWhat is concurrency
What is concurrency
 
Java8
Java8Java8
Java8
 

Similar to Concurrency & Parallel Programming

Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
mperham
 
Intro to elixir and phoenix
Intro to elixir and phoenixIntro to elixir and phoenix
Intro to elixir and phoenix
Jared Smith
 
Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014
Charles Nutter
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# Way
Bishnu Rawal
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
Barry Jones
 
DeepLearning and Advanced Machine Learning on IoT
DeepLearning and Advanced Machine Learning on IoTDeepLearning and Advanced Machine Learning on IoT
DeepLearning and Advanced Machine Learning on IoT
Romeo Kienzler
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
Legacy Typesafe (now Lightbend)
 
hpcpp.pptx
hpcpp.pptxhpcpp.pptx
hpcpp.pptx
pradhyumnpurohit1
 
Async programming in c#
Async programming in c#Async programming in c#
Async programming in c#
Ahasanul Kalam Akib
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdf
Harika Pudugosula
 
Ch4 threads
Ch4   threadsCh4   threads
Ch4 threads
Welly Dian Astika
 
Back to Basics - When to break the rules
Back to Basics - When to break the rulesBack to Basics - When to break the rules
Back to Basics - When to break the rules
Rory Graves
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
Jeff Fox
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tiger
Elizabeth Smith
 
Loom promises: be there!
Loom promises: be there!Loom promises: be there!
Loom promises: be there!
Jean-Francois James
 
Scalable game-servers-tgc
Scalable game-servers-tgcScalable game-servers-tgc
Scalable game-servers-tgc
Ashkan Saeedi Mazdeh
 
Ch04 threads
Ch04 threadsCh04 threads
Ch04 threads
Nazir Ahmed
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
Tomas Doran
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
Fwdays
 

Similar to Concurrency & Parallel Programming (20)

Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threads
 
Intro to elixir and phoenix
Intro to elixir and phoenixIntro to elixir and phoenix
Intro to elixir and phoenix
 
Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014Bringing Concurrency to Ruby - RubyConf India 2014
Bringing Concurrency to Ruby - RubyConf India 2014
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# Way
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
DeepLearning and Advanced Machine Learning on IoT
DeepLearning and Advanced Machine Learning on IoTDeepLearning and Advanced Machine Learning on IoT
DeepLearning and Advanced Machine Learning on IoT
 
Introduction to multicore .ppt
Introduction to multicore .pptIntroduction to multicore .ppt
Introduction to multicore .ppt
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
hpcpp.pptx
hpcpp.pptxhpcpp.pptx
hpcpp.pptx
 
Async programming in c#
Async programming in c#Async programming in c#
Async programming in c#
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdf
 
Ch4 threads
Ch4   threadsCh4   threads
Ch4 threads
 
Back to Basics - When to break the rules
Back to Basics - When to break the rulesBack to Basics - When to break the rules
Back to Basics - When to break the rules
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tiger
 
Loom promises: be there!
Loom promises: be there!Loom promises: be there!
Loom promises: be there!
 
Scalable game-servers-tgc
Scalable game-servers-tgcScalable game-servers-tgc
Scalable game-servers-tgc
 
Ch04 threads
Ch04 threadsCh04 threads
Ch04 threads
 
Messaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new frameworkMessaging, interoperability and log aggregation - a new framework
Messaging, interoperability and log aggregation - a new framework
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 

Recently uploaded

Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 

Recently uploaded (20)

Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 

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.
  • 8.
  • 9.
  • 11. Parallel Architecture • Instruction Level Parallelism • 8 bit —> 16 bit —> 32 bit —> 64 bit —> … • Data parallelism • GPU • Intel accured Altera ~17 Billion USD
  • 12.
  • 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()
  • 17.
  • 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
  • 30.
  • 32. Use Case : Facebook Spam detection ( HAXL)
  • 34.
  • 35. Elixir • Created by Jose Valim in 2012 • Syntax is similar to Ruby • Runs on Erlang Virtual Machine (BEAM) • Functional • Erlang process (actor)
  • 36.
  • 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