SlideShare une entreprise Scribd logo
1  sur  43
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

Contenu connexe

Tendances

Operating system file system
Operating system file systemOperating system file system
Operating system file systemAnil Pokhrel
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory ManagementAkmal Cikmat
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files pptAbhaysinh Surve
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory managementDr. Loganathan R
 
Memory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memoryMemory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memoryShivam Mitra
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSaba Ameer
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memoryvampugani
 
Cache coherence problem and its solutions
Cache coherence problem and its solutionsCache coherence problem and its solutions
Cache coherence problem and its solutionsMajid Saleem
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryWayne Jones Jnr
 
Sqlite
SqliteSqlite
SqliteKumar
 
Sistemas operativos distribuidos
Sistemas operativos distribuidosSistemas operativos distribuidos
Sistemas operativos distribuidoscarlosmax10
 
previous question solve of operating system.
previous question solve of operating system.previous question solve of operating system.
previous question solve of operating system.Ibrahim Khalil Shakik
 
Java vs JavaScript | Edureka
Java vs JavaScript | EdurekaJava vs JavaScript | Edureka
Java vs JavaScript | EdurekaEdureka!
 
Android share preferences
Android share preferencesAndroid share preferences
Android share preferencesAjay Panchal
 
Best Practices for Ensuring SAP ABAP Code Quality and Security
Best Practices for Ensuring SAP ABAP Code Quality and SecurityBest Practices for Ensuring SAP ABAP Code Quality and Security
Best Practices for Ensuring SAP ABAP Code Quality and SecurityVirtual Forge
 
Data file handling in python binary & csv files
Data file handling in python binary & csv filesData file handling in python binary & csv files
Data file handling in python binary & csv fileskeeeerty
 

Tendances (20)

Operating system file system
Operating system file systemOperating system file system
Operating system file system
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
 
Internal representation of files ppt
Internal representation of files pptInternal representation of files ppt
Internal representation of files ppt
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
Memory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memoryMemory management in operating system | Paging | Virtual memory
Memory management in operating system | Paging | Virtual memory
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Cache coherence problem and its solutions
Cache coherence problem and its solutionsCache coherence problem and its solutions
Cache coherence problem and its solutions
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
 
Sqlite
SqliteSqlite
Sqlite
 
Sistemas operativos distribuidos
Sistemas operativos distribuidosSistemas operativos distribuidos
Sistemas operativos distribuidos
 
previous question solve of operating system.
previous question solve of operating system.previous question solve of operating system.
previous question solve of operating system.
 
memoria virtual
memoria virtualmemoria virtual
memoria virtual
 
Java vs JavaScript | Edureka
Java vs JavaScript | EdurekaJava vs JavaScript | Edureka
Java vs JavaScript | Edureka
 
Android share preferences
Android share preferencesAndroid share preferences
Android share preferences
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Best Practices for Ensuring SAP ABAP Code Quality and Security
Best Practices for Ensuring SAP ABAP Code Quality and SecurityBest Practices for Ensuring SAP ABAP Code Quality and Security
Best Practices for Ensuring SAP ABAP Code Quality and Security
 
Data file handling in python binary & csv files
Data file handling in python binary & csv filesData file handling in python binary & csv files
Data file handling in python binary & csv files
 

En vedette

Delphi Parallel Programming Library
Delphi Parallel Programming LibraryDelphi Parallel Programming Library
Delphi Parallel Programming LibraryMario Guedes
 
Hardware and software parallelism
Hardware and software parallelismHardware and software parallelism
Hardware and software parallelismSumita Das
 
The Joy Of Functional Programming
The Joy Of Functional ProgrammingThe Joy Of Functional Programming
The Joy Of Functional Programmingjasondew
 
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 ComputingAndrew Shitov
 
Parallel programming
Parallel programmingParallel programming
Parallel programmingSwain Loda
 
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 - concurrencyfeng lee
 
Concurrency: Best Practices
Concurrency: Best PracticesConcurrency: Best Practices
Concurrency: Best PracticesIndicThreads
 
Java8 training - class 2
Java8 training - class 2Java8 training - class 2
Java8 training - class 2Marut Singh
 
Java8 training - class 3
Java8 training - class 3Java8 training - class 3
Java8 training - class 3Marut Singh
 
Java8 training - Class 1
Java8 training  - Class 1Java8 training  - Class 1
Java8 training - Class 1Marut Singh
 
Concurrency with java
Concurrency with javaConcurrency with java
Concurrency with javaHoang 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 JVMMario Fusco
 
Building Applications with a Graph Database
Building Applications with a Graph DatabaseBuilding Applications with a Graph Database
Building Applications with a Graph DatabaseTobias Lindaaker
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8Dhaval Dalal
 

En vedette (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
 
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
 
Jumping-with-java8
Jumping-with-java8Jumping-with-java8
Jumping-with-java8
 

Similaire à Concurrency & Parallel Programming

Actors and Threads
Actors and ThreadsActors and Threads
Actors and Threadsmperham
 
Intro to elixir and phoenix
Intro to elixir and phoenixIntro to elixir and phoenix
Intro to elixir and phoenixJared 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 2014Charles Nutter
 
Coding For Cores - C# Way
Coding For Cores - C# WayCoding For Cores - C# Way
Coding For Cores - C# WayBishnu Rawal
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirBarry 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 IoTRomeo Kienzler
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfHarika Pudugosula
 
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 rulesRory 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 MEANJeff Fox
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tigerElizabeth Smith
 
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 frameworkTomas 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
 

Similaire à 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"
 

Dernier

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Dernier (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

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