SlideShare una empresa de Scribd logo
1 de 47
Descargar para leer sin conexión
Threading Theory Multiprocessing Others Conclusion Finalise

   Beating the (sh** out of the) GIL
    Multithreading vs. Multiprocessing




                                                                 Hair dryer 1920s,
                                                                 Dark Roasted Blend:
                                                                 http://www.darkroastedblend.
                                                                 com/2007/01/
                                                                 retro-technology-update.html

Guy K. Kloss | Multithreading vs. Multiprocessing                                               1/36
Threading Theory Multiprocessing Others Conclusion Finalise




                  Beating the (sh** out of the) GIL
                             Multithreading vs. Multiprocessing


                                                    Guy K. Kloss

                                              Computer Science
                                           Massey University, Albany


                       New Zealand Python User Group Meeting
                              Auckland, 12 June 2008


Guy K. Kloss | Multithreading vs. Multiprocessing                      2/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Outline


      1 Threading

      2 Theory

      3 Multiprocessing

      4 Others

      5 Conclusion



Guy K. Kloss | Multithreading vs. Multiprocessing                3/36
Threading Theory Multiprocessing Others Conclusion Finalise




Guy K. Kloss | Multithreading vs. Multiprocessing                4/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Outline


      1 Threading

      2 Theory

      3 Multiprocessing

      4 Others

      5 Conclusion



Guy K. Kloss | Multithreading vs. Multiprocessing                5/36
Threading Theory Multiprocessing Others Conclusion Finalise




     Source: http://blog.snaplogic.org/?cat=29
Guy K. Kloss | Multithreading vs. Multiprocessing                6/36
Threading Theory Multiprocessing Others Conclusion Finalise

   What People Think Now


              Threading and shared memory are common
              (thanks to Windows and Java)
              Python supports threads (Yay!)
              Python also supports easy forking (Yay!)
              The GIL . . . is a problem for pure Python,
              non I/O bound applications
              Lots of people “understand” threads . . .
              . . . and fail at them (to do them properly)




Guy K. Kloss | Multithreading vs. Multiprocessing                7/36
Threading Theory Multiprocessing Others Conclusion Finalise

   What People Think Now


              Threading and shared memory are common
              (thanks to Windows and Java)
              Python supports threads (Yay!)
              Python also supports easy forking (Yay!)
              The GIL . . . is a problem for pure Python,
              non I/O bound applications
              Lots of people “understand” threads . . .
              . . . and fail at them (to do them properly)




Guy K. Kloss | Multithreading vs. Multiprocessing                7/36
Threading Theory Multiprocessing Others Conclusion Finalise

   What People Think Now


              Threading and shared memory are common
              (thanks to Windows and Java)
              Python supports threads (Yay!)
              Python also supports easy forking (Yay!)
              The GIL . . . is a problem for pure Python,
              non I/O bound applications
              Lots of people “understand” threads . . .
              . . . and fail at them (to do them properly)




Guy K. Kloss | Multithreading vs. Multiprocessing                7/36
Threading Theory Multiprocessing Others Conclusion Finalise

   What People Think Now


              Threading and shared memory are common
              (thanks to Windows and Java)
              Python supports threads (Yay!)
              Python also supports easy forking (Yay!)
              The GIL . . . is a problem for pure Python,
              non I/O bound applications
              Lots of people “understand” threads . . .
              . . . and fail at them (to do them properly)




Guy K. Kloss | Multithreading vs. Multiprocessing                7/36
Threading Theory Multiprocessing Others Conclusion Finalise

   What People Think Now


              Threading and shared memory are common
              (thanks to Windows and Java)
              Python supports threads (Yay!)
              Python also supports easy forking (Yay!)
              The GIL . . . is a problem for pure Python,
              non I/O bound applications
              Lots of people “understand” threads . . .
              . . . and fail at them (to do them properly)




Guy K. Kloss | Multithreading vs. Multiprocessing                7/36
Threading Theory Multiprocessing Others Conclusion Finalise

   What People Think Now

     Blog post by Mark Ramm, 14 May 2008
     A multi threaded system is particularly important for people
     who use Windows, which makes multi–process computing
     much more memory intensive than it needs to be. As my
     grandma always said Windows can’t fork worth a damn. ;)
     [. . . ]
     So, really it’s kinda like shared–memory optimized
     micro–processes running inside larger OS level processes, and
     that makes multi–threaded applications a lot more
     reasonable to wrap your brain around. Once you start down
     the path of lock managment the non-deterministic character
     of the system can quickly overwhelm your brain.

Guy K. Kloss | Multithreading vs. Multiprocessing                    8/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Simple Threading Example
     from threading import Thread
     from stuff import expensiveFunction

     class MyClass(Thread):
         def __init__(self, argument):
             self.argument = argument
             Thread.__init__(self) # I n i t i a l i s e the thread

            def run(self):
                self.value = expensiveFunction(self.argument)


     callObjects = []
     for i in range(config.segments):
         callObjects.append(MyClass(i))

     for item in callObjects:
         item.start()

     # Do something e l s e .
     time.sleep(15.0)

     for item in callObjects:
         item.join()
         print item.value

Guy K. Kloss | Multithreading vs. Multiprocessing                     9/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Our Example with Threading




                                                                 Our fractal example
                                                                 now with threading.


                                                                 Just a humble hair–dryer from the
                                                                 30s: “One of the first machines used
                                                                 for permanent wave hairstyling back
                                                                 in the 1920’s and 1930’s.”
                                                                 Dark Roasted Blend:
                                                                 http://www.darkroastedblend.com/2007/05/
                                                                 mystery-devices-issue-2.html

Guy K. Kloss | Multithreading vs. Multiprocessing                                                           10/36
Threading Theory Multiprocessing Others Conclusion Finalise

   The GIL

     Global Interpreter Lock
         What is it for?
                      Cooperative multitasking
                      Interpreter knows when it’s “good to switch”
                      Often more efficient than preemptive multi–tasking
                      Can be released from native (C) code extensions
                      (done for I/O intensive operations)
              Is it good?
                      Easy coding
                      Easy modules/extensions
                      Large base of available modules alredy
                      Speed improvement by factor 2
                      (for single–threaded applications)
                      Keeps code safe
Guy K. Kloss | Multithreading vs. Multiprocessing                        11/36
Threading Theory Multiprocessing Others Conclusion Finalise

   The GIL

     Global Interpreter Lock
         What is it for?
                      Cooperative multitasking
                      Interpreter knows when it’s “good to switch”
                      Often more efficient than preemptive multi–tasking
                      Can be released from native (C) code extensions
                      (done for I/O intensive operations)
              Is it good?
                      Easy coding
                      Easy modules/extensions
                      Large base of available modules alredy
                      Speed improvement by factor 2
                      (for single–threaded applications)
                      Keeps code safe
Guy K. Kloss | Multithreading vs. Multiprocessing                        11/36
Threading Theory Multiprocessing Others Conclusion Finalise

   The GIL
   Alternatives



              Other implementations
                      (C) Python uses it
                      Jython doesn’t
                      IronPython doesn’t
                      They use their own/internal threading mechanisms
              Is it a design flaw?
                      Maybe . . . but . . .
                      Fierce/intense discussions to change the code base
                      Solutions that pose other benefits:
                               Processes create fewer inherent dead lock situations
                               Processes scale also to multi–host scenarios



Guy K. Kloss | Multithreading vs. Multiprocessing                                     12/36
Threading Theory Multiprocessing Others Conclusion Finalise

   The GIL
   Alternatives



              Other implementations
                      (C) Python uses it
                      Jython doesn’t
                      IronPython doesn’t
                      They use their own/internal threading mechanisms
              Is it a design flaw?
                      Maybe . . . but . . .
                      Fierce/intense discussions to change the code base
                      Solutions that pose other benefits:
                               Processes create fewer inherent dead lock situations
                               Processes scale also to multi–host scenarios



Guy K. Kloss | Multithreading vs. Multiprocessing                                     12/36
Threading Theory Multiprocessing Others Conclusion Finalise




     Doug Hellmann in Python Magazine 10/2007:
     Techniques using low–level, operating system–specific,
     libraries for process management are as passe as using
     compiled languages for CGI programming. I don’t have time
     for this low–level stuff any more, and neither do you. Let’s
     look at some modern alternatives.




Guy K. Kloss | Multithreading vs. Multiprocessing                  13/36
Threading Theory Multiprocessing Others Conclusion Finalise

   GIL–less Python

              There was an attempt/patch “way back then ...”
              There’s a new project now by Adam Olsen
              Python 3000 with “free theading” [1]
              Using Monitors to isolate state
              Design focus: usability
              (for common cases, maintainable code)
              Optional at compile time using --with-freethread
              Sacrificed single–threaded performance
              (60–65 % but equivalent to threaded CPython)
              Automatic deadlock detection
              (detection/breaking, giving exceptions/stack trace)
              Runs on Linux and OS/X
Guy K. Kloss | Multithreading vs. Multiprocessing                   14/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Outline


      1 Threading

      2 Theory

      3 Multiprocessing

      4 Others

      5 Conclusion



Guy K. Kloss | Multithreading vs. Multiprocessing                15/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Parallelisation in General

              CPU vs. I/O bottle necks
                      Threading: Good for I/O constrains
                      This talk aims at CPU constrains
              Threads vs. Processes
                      Threads: Within a process on one host
                      Processes: Independent on the OS
                      Processes are:
                               Heavier in memory/overhead
                               Have their own name space and memory
                               Involve less problems with competing access
                               to resources and their management
                      But:
                               On UN*X/Linux: Process overhead is very low
                               (C)Python is inefficient in handling threads
                               Stackless Python is much more efficient on threading
Guy K. Kloss | Multithreading vs. Multiprocessing                                   16/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Parallelisation in General

              CPU vs. I/O bottle necks
                      Threading: Good for I/O constrains
                      This talk aims at CPU constrains
              Threads vs. Processes
                      Threads: Within a process on one host
                      Processes: Independent on the OS
                      Processes are:
                               Heavier in memory/overhead
                               Have their own name space and memory
                               Involve less problems with competing access
                               to resources and their management
                      But:
                               On UN*X/Linux: Process overhead is very low
                               (C)Python is inefficient in handling threads
                               Stackless Python is much more efficient on threading
Guy K. Kloss | Multithreading vs. Multiprocessing                                   16/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Parallelisation in General

              CPU vs. I/O bottle necks
                      Threading: Good for I/O constrains
                      This talk aims at CPU constrains
              Threads vs. Processes
                      Threads: Within a process on one host
                      Processes: Independent on the OS
                      Processes are:
                               Heavier in memory/overhead
                               Have their own name space and memory
                               Involve less problems with competing access
                               to resources and their management
                      But:
                               On UN*X/Linux: Process overhead is very low
                               (C)Python is inefficient in handling threads
                               Stackless Python is much more efficient on threading
Guy K. Kloss | Multithreading vs. Multiprocessing                                   16/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Parallelisation in General

              CPU vs. I/O bottle necks
                      Threading: Good for I/O constrains
                      This talk aims at CPU constrains
              Threads vs. Processes
                      Threads: Within a process on one host
                      Processes: Independent on the OS
                      Processes are:
                               Heavier in memory/overhead
                               Have their own name space and memory
                               Involve less problems with competing access
                               to resources and their management
                      But:
                               On UN*X/Linux: Process overhead is very low
                               (C)Python is inefficient in handling threads
                               Stackless Python is much more efficient on threading
Guy K. Kloss | Multithreading vs. Multiprocessing                                   16/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Abstraction Level vs. Control


     Abstraction levels for parallel computing models [7]

              Parallelism    Communication Synchronisation
       4                            implicit
       3          explicit                 implicit
       2                   explicit                 implicit
       1                            explicit

     Explicit: The programmer specifies it in the parallel program
     Implicit: A compiler/runtime system derives it from other information




Guy K. Kloss | Multithreading vs. Multiprocessing                            17/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Abstraction Level vs. Control

              Low level: Close to hardware
                      Must specify parallelism
                      . . . communication
                      . . . and synchronisation
              → Best means for performance tuning
              → Premature optimisation?
              High level: Highest machine independence
                      More/all handled by computing model
                      Up to automatic parallelisation approaches
              Both extremes have not been very successful to date
              Most developments now:
                      Level 3 for specific purposes
                      Level 1 for general programming
                      (esp. in the scientific community)
                      With Python consistent level 2 possible
Guy K. Kloss | Multithreading vs. Multiprocessing                   18/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Abstraction Level vs. Control

              Low level: Close to hardware
                      Must specify parallelism
                      . . . communication
                      . . . and synchronisation
              → Best means for performance tuning
              → Premature optimisation?
              High level: Highest machine independence
                      More/all handled by computing model
                      Up to automatic parallelisation approaches
              Both extremes have not been very successful to date
              Most developments now:
                      Level 3 for specific purposes
                      Level 1 for general programming
                      (esp. in the scientific community)
                      With Python consistent level 2 possible
Guy K. Kloss | Multithreading vs. Multiprocessing                   18/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Abstraction Level vs. Control

              Low level: Close to hardware
                      Must specify parallelism
                      . . . communication
                      . . . and synchronisation
              → Best means for performance tuning
              → Premature optimisation?
              High level: Highest machine independence
                      More/all handled by computing model
                      Up to automatic parallelisation approaches
              Both extremes have not been very successful to date
              Most developments now:
                      Level 3 for specific purposes
                      Level 1 for general programming
                      (esp. in the scientific community)
                      With Python consistent level 2 possible
Guy K. Kloss | Multithreading vs. Multiprocessing                   18/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Common for Parallel Computing




              Message Passing Interface (MPI)
              for distributed memory
              OpenMP
              shared memory multi–threading
              The two do not have to be categorised like this




Guy K. Kloss | Multithreading vs. Multiprocessing                19/36
Threading Theory Multiprocessing Others Conclusion Finalise




     Art by “Teknika Molodezhi,” Russia 1966

     Dark Roasted Blend: http://www.darkroastedblend.com/2008/01/retro-future-mind-boggling.html
Guy K. Kloss | Multithreading vs. Multiprocessing                                                  20/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Outline


      1 Threading

      2 Theory

      3 Multiprocessing

      4 Others

      5 Conclusion



Guy K. Kloss | Multithreading vs. Multiprocessing                21/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Processing around the GIL




              Smart multi–processing
              Smart task farming




Guy K. Kloss | Multithreading vs. Multiprocessing                22/36
Threading Theory Multiprocessing Others Conclusion Finalise

   (py)Processing module

              By R. Oudkerk [2]
              Written in C (really fast!)
              Allowes multiple cores and multiple hosts/clusters
              Data synchronisation through managers
              Easy “upgrade path”
                      Drop in replacement (mostly) for the threading module
                      Transparent to user
                      Forks processes, but uses Thread API
              Supports queues, pipes, locks,
              managers (for sharing state), worker pools
              VERY fast, see PEP-371 [3]
                      Jesse Noller for pyprocessing into core Python
                      benchmarks available, awesome results!
                      PEP is officially accepted: Thanks Guido!
Guy K. Kloss | Multithreading vs. Multiprocessing                             23/36
Threading Theory Multiprocessing Others Conclusion Finalise

   (py)Processing module
   (continued)




              Some details
                      Producer/consumer style system
                      – workers pull jobs
                      Hides most details of communication
                      – usable default settings
                      Communication is tweakable
                      (to improve performance or meet certain requirements)




Guy K. Kloss | Multithreading vs. Multiprocessing                             24/36
Threading Theory Multiprocessing Others Conclusion Finalise

   (py)Processing module




     Let’s see it!




Guy K. Kloss | Multithreading vs. Multiprocessing                25/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Parallel Python module

              By Vitalii Vanovschi [4]
              Pure Python
              Full “Batteries included” paradigm model:
                      Spawns automatically across detected cores,
                      and can spawn to clusters
                      Uses some thread module methods under the hood
                      More of a “task farming” approach
                      (requires potentially rethinking/restructuring)
                      Automatically deploys code and data,
                      no difficult/multiple installs
                      Fault tolerance, secure inter–node communication,
                      runs everywhere
              Very active communigy,
              good documentation, good support
Guy K. Kloss | Multithreading vs. Multiprocessing                         26/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Parallel Python module




     Let’s see it!




Guy K. Kloss | Multithreading vs. Multiprocessing                27/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Outline


      1 Threading

      2 Theory

      3 Multiprocessing

      4 Others

      5 Conclusion



Guy K. Kloss | Multithreading vs. Multiprocessing                28/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Honourable Mentions

              pprocess [5]
              IPython for parallel computing [6]
              Bulk Synchronous Parallel (BSP) Model [7]
              sequence of super steps
              (computation, communication, barrier synch)
              Reactor based architectures, through Twisted [8]
              “Don’t call us, we call you”
              MPI (pyMPI, Pypar, MPI for Python, pypvm)
              requires constant number of processors during
              compation’s duration
              Pyro (distributed object system)
              Linda (PyLinda)
              Scientific Python (master/slave computing model)
              data distribution through call parameters/replication
Guy K. Kloss | Multithreading vs. Multiprocessing                     29/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Outline


      1 Threading

      2 Theory

      3 Multiprocessing

      4 Others

      5 Conclusion



Guy K. Kloss | Multithreading vs. Multiprocessing                30/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Things to Note



              Which approach is best?
                      Can’t say!
                      Many of the approaches are complimentary
                      Needs to be evaluated what to use when
              All, however, save you a lot of time over the alternative
              of writing everything yourself with low–level libraries.
              What an age to be alive!
              Problems can arise when objects cannot be pickled




Guy K. Kloss | Multithreading vs. Multiprocessing                         31/36
Threading Theory Multiprocessing Others Conclusion Finalise

   Conclusion



              Resolving the GIL is not necessarily the best solution
                      More inefficient (single threaded) runtime
                      Problems with shared memory access
              Various approaches to beat the GIL
              Solutions are complimentary in many ways
              many scale beyond a local machine/memory system




Guy K. Kloss | Multithreading vs. Multiprocessing                      32/36
Threading Theory Multiprocessing Others Conclusion Finalise




     Questions?

     G.Kloss@massey.ac.nz
     Slides and code available here:
     http://www.kloss-familie.de/moin/TalksPresentations


Guy K. Kloss | Multithreading vs. Multiprocessing                33/36
Threading Theory Multiprocessing Others Conclusion Finalise

   References I


     [1] A. Olsen,
         Python 3000 with Free Threading project,
             [Online]
             http://code.google.com/p/python-safethread/
     [2] R. Oudkerk,
         Processing Package,
         [Online] http://pypi.python.org/pypi/processing/
     [3] J. Noller,
         PEP-371,
         [Online] http://www.python.org/dev/peps/pep-0371/



Guy K. Kloss | Multithreading vs. Multiprocessing                34/36
Threading Theory Multiprocessing Others Conclusion Finalise

   References II

     [4] V. Vanovschi,
         Parallel Python,
         [Online] http://parallelpython.com/
     [5] P. Boddie,
         pprocess,
         [Online] http://pypi.python.org/pypi/processing/
     [6] Project Website,
         IPython,
         [Online] http://ipython.scipy.org/doc/ipython1/
             html/parallel_intro.html
     [7] K. Hinsen,
         Parallel Scripting with Python
         Computing in Science & Engineering, Nov/Dec 2007
Guy K. Kloss | Multithreading vs. Multiprocessing                35/36
Threading Theory Multiprocessing Others Conclusion Finalise

   References III




     [8] B. Eckel,
         Concurrency with Python, Twisted, and Flex,
         [Online] http://www.artima.com/weblogs/viewpost.
             jsp?thread=230001




Guy K. Kloss | Multithreading vs. Multiprocessing                36/36

Más contenido relacionado

La actualidad más candente

Dark Silicon, Mobile Devices, and Possible Open-Source Solutions
Dark Silicon, Mobile Devices, and Possible Open-Source SolutionsDark Silicon, Mobile Devices, and Possible Open-Source Solutions
Dark Silicon, Mobile Devices, and Possible Open-Source SolutionsKoan-Sin Tan
 
Real-time streams and logs with Storm and Kafka
Real-time streams and logs with Storm and KafkaReal-time streams and logs with Storm and Kafka
Real-time streams and logs with Storm and KafkaAndrew Montalenti
 
Attention mechanisms with tensorflow
Attention mechanisms with tensorflowAttention mechanisms with tensorflow
Attention mechanisms with tensorflowKeon Kim
 
Tensorflow on Android
Tensorflow on AndroidTensorflow on Android
Tensorflow on AndroidKoan-Sin Tan
 
Java and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk PepperdineJava and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk PepperdineJAX London
 
Python Training in Bangalore | Multi threading | Learnbay.in
Python Training in Bangalore | Multi threading | Learnbay.inPython Training in Bangalore | Multi threading | Learnbay.in
Python Training in Bangalore | Multi threading | Learnbay.inLearnbayin
 
Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Shuo Chen
 
Muduo network library
Muduo network libraryMuduo network library
Muduo network libraryShuo Chen
 
Threaded Programming
Threaded ProgrammingThreaded Programming
Threaded ProgrammingSri Prasanna
 
[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns
[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns
[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patternsnpinto
 
Efficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ serverEfficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ serverShuo Chen
 
The Flow of TensorFlow
The Flow of TensorFlowThe Flow of TensorFlow
The Flow of TensorFlowJeongkyu Shin
 
Introduction to Chainer 11 may,2018
Introduction to Chainer 11 may,2018Introduction to Chainer 11 may,2018
Introduction to Chainer 11 may,2018Preferred Networks
 
Deep Learning through Examples
Deep Learning through ExamplesDeep Learning through Examples
Deep Learning through ExamplesSri Ambati
 
Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016Chris Fregly
 
Know yourengines velocity2011
Know yourengines velocity2011Know yourengines velocity2011
Know yourengines velocity2011Demis Bellot
 
DIY Deep Learning with Caffe Workshop
DIY Deep Learning with Caffe WorkshopDIY Deep Learning with Caffe Workshop
DIY Deep Learning with Caffe Workshopodsc
 

La actualidad más candente (20)

Dark Silicon, Mobile Devices, and Possible Open-Source Solutions
Dark Silicon, Mobile Devices, and Possible Open-Source SolutionsDark Silicon, Mobile Devices, and Possible Open-Source Solutions
Dark Silicon, Mobile Devices, and Possible Open-Source Solutions
 
Real-time streams and logs with Storm and Kafka
Real-time streams and logs with Storm and KafkaReal-time streams and logs with Storm and Kafka
Real-time streams and logs with Storm and Kafka
 
Attention mechanisms with tensorflow
Attention mechanisms with tensorflowAttention mechanisms with tensorflow
Attention mechanisms with tensorflow
 
Tensorflow on Android
Tensorflow on AndroidTensorflow on Android
Tensorflow on Android
 
Java and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk PepperdineJava and the machine - Martijn Verburg and Kirk Pepperdine
Java and the machine - Martijn Verburg and Kirk Pepperdine
 
Python Training in Bangalore | Multi threading | Learnbay.in
Python Training in Bangalore | Multi threading | Learnbay.inPython Training in Bangalore | Multi threading | Learnbay.in
Python Training in Bangalore | Multi threading | Learnbay.in
 
Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++Essentials of Multithreaded System Programming in C++
Essentials of Multithreaded System Programming in C++
 
Muduo network library
Muduo network libraryMuduo network library
Muduo network library
 
Threaded Programming
Threaded ProgrammingThreaded Programming
Threaded Programming
 
[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns
[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns
[Harvard CS264] 02 - Parallel Thinking, Architecture, Theory & Patterns
 
Efficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ serverEfficient logging in multithreaded C++ server
Efficient logging in multithreaded C++ server
 
The Flow of TensorFlow
The Flow of TensorFlowThe Flow of TensorFlow
The Flow of TensorFlow
 
Introduction to Chainer 11 may,2018
Introduction to Chainer 11 may,2018Introduction to Chainer 11 may,2018
Introduction to Chainer 11 may,2018
 
Zurg part 1
Zurg part 1Zurg part 1
Zurg part 1
 
Deep Learning through Examples
Deep Learning through ExamplesDeep Learning through Examples
Deep Learning through Examples
 
Golang design4concurrency
Golang design4concurrencyGolang design4concurrency
Golang design4concurrency
 
Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016Advanced Spark and TensorFlow Meetup May 26, 2016
Advanced Spark and TensorFlow Meetup May 26, 2016
 
Know yourengines velocity2011
Know yourengines velocity2011Know yourengines velocity2011
Know yourengines velocity2011
 
DIY Deep Learning with Caffe Workshop
DIY Deep Learning with Caffe WorkshopDIY Deep Learning with Caffe Workshop
DIY Deep Learning with Caffe Workshop
 
Streams
StreamsStreams
Streams
 

Destacado

Parallel programming using python
Parallel programming using python Parallel programming using python
Parallel programming using python Samah Gad
 
What's New in C++ 11/14?
What's New in C++ 11/14?What's New in C++ 11/14?
What's New in C++ 11/14?Dina Goldshtein
 
Annelies rollez Presentation
Annelies rollez PresentationAnnelies rollez Presentation
Annelies rollez PresentationAnneliesRollez
 
Multithreading done right
Multithreading done rightMultithreading done right
Multithreading done rightPlatonov Sergey
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Javaparag
 

Destacado (7)

Parallel programming using python
Parallel programming using python Parallel programming using python
Parallel programming using python
 
An Introduction to Python Concurrency
An Introduction to Python ConcurrencyAn Introduction to Python Concurrency
An Introduction to Python Concurrency
 
What's New in C++ 11/14?
What's New in C++ 11/14?What's New in C++ 11/14?
What's New in C++ 11/14?
 
What's New in C++ 11?
What's New in C++ 11?What's New in C++ 11?
What's New in C++ 11?
 
Annelies rollez Presentation
Annelies rollez PresentationAnnelies rollez Presentation
Annelies rollez Presentation
 
Multithreading done right
Multithreading done rightMultithreading done right
Multithreading done right
 
Multithreading In Java
Multithreading In JavaMultithreading In Java
Multithreading In Java
 

Similar a Beating the (sh** out of the) GIL - Multithreading vs. Multiprocessing

Where Did All These Cycles Go?
Where Did All These Cycles Go?Where Did All These Cycles Go?
Where Did All These Cycles Go?ScyllaDB
 
Talk at Bioinformatics Open Source Conference, 2012
Talk at Bioinformatics Open Source Conference, 2012Talk at Bioinformatics Open Source Conference, 2012
Talk at Bioinformatics Open Source Conference, 2012c.titus.brown
 
CT Brown - Doing next-gen sequencing analysis in the cloud
CT Brown - Doing next-gen sequencing analysis in the cloudCT Brown - Doing next-gen sequencing analysis in the cloud
CT Brown - Doing next-gen sequencing analysis in the cloudJan Aerts
 
What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)
What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)
What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)Igalia
 
Our Concurrent Past; Our Distributed Future
Our Concurrent Past; Our Distributed FutureOur Concurrent Past; Our Distributed Future
Our Concurrent Past; Our Distributed FutureC4Media
 
Cloud computing: evolution or redefinition
Cloud computing: evolution or redefinitionCloud computing: evolution or redefinition
Cloud computing: evolution or redefinitionPET Computação
 
How I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "S
How I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "SHow I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "S
How I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "SBrandon Liu
 
Course: "Introductory course to HLS FPGA programming"
Course: "Introductory course to HLS FPGA programming"Course: "Introductory course to HLS FPGA programming"
Course: "Introductory course to HLS FPGA programming"Mirko Mariotti
 
Lets isolate a process with no container like docker
Lets isolate a process with no container like dockerLets isolate a process with no container like docker
Lets isolate a process with no container like dockerGiulio De Donato
 
The genesis of clusterlib - An open source library to tame your favourite sup...
The genesis of clusterlib - An open source library to tame your favourite sup...The genesis of clusterlib - An open source library to tame your favourite sup...
The genesis of clusterlib - An open source library to tame your favourite sup...Arnaud Joly
 
Towards a Systematic Study of Big Data Performance and Benchmarking
Towards a Systematic Study of Big Data Performance and BenchmarkingTowards a Systematic Study of Big Data Performance and Benchmarking
Towards a Systematic Study of Big Data Performance and BenchmarkingSaliya Ekanayake
 
Why Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS wayWhy Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS wayAhmed Mekkawy
 
Software and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : NotesSoftware and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : NotesSubhajit Sahu
 
A Survey on in-a-box parallel computing and its implications on system softwa...
A Survey on in-a-box parallel computing and its implications on system softwa...A Survey on in-a-box parallel computing and its implications on system softwa...
A Survey on in-a-box parallel computing and its implications on system softwa...ChangWoo Min
 

Similar a Beating the (sh** out of the) GIL - Multithreading vs. Multiprocessing (20)

Where Did All These Cycles Go?
Where Did All These Cycles Go?Where Did All These Cycles Go?
Where Did All These Cycles Go?
 
Talk at Bioinformatics Open Source Conference, 2012
Talk at Bioinformatics Open Source Conference, 2012Talk at Bioinformatics Open Source Conference, 2012
Talk at Bioinformatics Open Source Conference, 2012
 
CT Brown - Doing next-gen sequencing analysis in the cloud
CT Brown - Doing next-gen sequencing analysis in the cloudCT Brown - Doing next-gen sequencing analysis in the cloud
CT Brown - Doing next-gen sequencing analysis in the cloud
 
Introducing Parallel Pixie Dust
Introducing Parallel Pixie DustIntroducing Parallel Pixie Dust
Introducing Parallel Pixie Dust
 
What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)
What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)
What's new with JavaScript in GNOME: The 2020 edition (GUADEC 2020)
 
Os Lamothe
Os LamotheOs Lamothe
Os Lamothe
 
Our Concurrent Past; Our Distributed Future
Our Concurrent Past; Our Distributed FutureOur Concurrent Past; Our Distributed Future
Our Concurrent Past; Our Distributed Future
 
Three things that rowhammer taught me by Halvar Flake
Three things that rowhammer taught me by Halvar FlakeThree things that rowhammer taught me by Halvar Flake
Three things that rowhammer taught me by Halvar Flake
 
Cloud computing: evolution or redefinition
Cloud computing: evolution or redefinitionCloud computing: evolution or redefinition
Cloud computing: evolution or redefinition
 
How I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "S
How I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "SHow I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "S
How I Sped up Complex Matrix-Vector Multiplication: Finding Intel MKL's "S
 
Parallelformers
ParallelformersParallelformers
Parallelformers
 
Course: "Introductory course to HLS FPGA programming"
Course: "Introductory course to HLS FPGA programming"Course: "Introductory course to HLS FPGA programming"
Course: "Introductory course to HLS FPGA programming"
 
Lets isolate a process with no container like docker
Lets isolate a process with no container like dockerLets isolate a process with no container like docker
Lets isolate a process with no container like docker
 
Multicore computing
Multicore computingMulticore computing
Multicore computing
 
The genesis of clusterlib - An open source library to tame your favourite sup...
The genesis of clusterlib - An open source library to tame your favourite sup...The genesis of clusterlib - An open source library to tame your favourite sup...
The genesis of clusterlib - An open source library to tame your favourite sup...
 
Towards a Systematic Study of Big Data Performance and Benchmarking
Towards a Systematic Study of Big Data Performance and BenchmarkingTowards a Systematic Study of Big Data Performance and Benchmarking
Towards a Systematic Study of Big Data Performance and Benchmarking
 
Why Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS wayWhy Cloud Computing has to go the FOSS way
Why Cloud Computing has to go the FOSS way
 
2014 pycon-talk
2014 pycon-talk2014 pycon-talk
2014 pycon-talk
 
Software and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : NotesSoftware and the Concurrency Revolution : Notes
Software and the Concurrency Revolution : Notes
 
A Survey on in-a-box parallel computing and its implications on system softwa...
A Survey on in-a-box parallel computing and its implications on system softwa...A Survey on in-a-box parallel computing and its implications on system softwa...
A Survey on in-a-box parallel computing and its implications on system softwa...
 

Más de Guy K. Kloss

Kauri ID - A Self-Sovereign, Blockchain-based Identity System
Kauri ID - A Self-Sovereign, Blockchain-based Identity SystemKauri ID - A Self-Sovereign, Blockchain-based Identity System
Kauri ID - A Self-Sovereign, Blockchain-based Identity SystemGuy K. Kloss
 
Qrious about Insights -- Big Data in the Real World
Qrious about Insights -- Big Data in the Real WorldQrious about Insights -- Big Data in the Real World
Qrious about Insights -- Big Data in the Real WorldGuy K. Kloss
 
WTF is Blockchain???
WTF is Blockchain???WTF is Blockchain???
WTF is Blockchain???Guy K. Kloss
 
Building a (Really) Secure Cloud Product
Building a (Really) Secure Cloud ProductBuilding a (Really) Secure Cloud Product
Building a (Really) Secure Cloud ProductGuy K. Kloss
 
Representational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASRepresentational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASGuy K. Kloss
 
Introduction to LaTeX (For Word users)
 Introduction to LaTeX (For Word users) Introduction to LaTeX (For Word users)
Introduction to LaTeX (For Word users)Guy K. Kloss
 
MataNui - Building a Grid Data Infrastructure that "doesn't suck!"
MataNui - Building a Grid Data Infrastructure that "doesn't suck!"MataNui - Building a Grid Data Infrastructure that "doesn't suck!"
MataNui - Building a Grid Data Infrastructure that "doesn't suck!"Guy K. Kloss
 
Operations Research and Optimization in Python using PuLP
Operations Research and Optimization in Python using PuLPOperations Research and Optimization in Python using PuLP
Operations Research and Optimization in Python using PuLPGuy K. Kloss
 
Python Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation ExtravaganzaPython Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation ExtravaganzaGuy K. Kloss
 
Lecture "Open Source and Open Content"
Lecture "Open Source and Open Content"Lecture "Open Source and Open Content"
Lecture "Open Source and Open Content"Guy K. Kloss
 
Version Control with Subversion
Version Control with SubversionVersion Control with Subversion
Version Control with SubversionGuy K. Kloss
 
Thinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationThinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationGuy K. Kloss
 
Thinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationThinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationGuy K. Kloss
 
Gaining Colour Stability in Live Image Capturing
Gaining Colour Stability in Live Image CapturingGaining Colour Stability in Live Image Capturing
Gaining Colour Stability in Live Image CapturingGuy K. Kloss
 
LaTeX Introduction for Word Users
LaTeX Introduction for Word UsersLaTeX Introduction for Word Users
LaTeX Introduction for Word UsersGuy K. Kloss
 
Thinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationThinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationGuy K. Kloss
 

Más de Guy K. Kloss (16)

Kauri ID - A Self-Sovereign, Blockchain-based Identity System
Kauri ID - A Self-Sovereign, Blockchain-based Identity SystemKauri ID - A Self-Sovereign, Blockchain-based Identity System
Kauri ID - A Self-Sovereign, Blockchain-based Identity System
 
Qrious about Insights -- Big Data in the Real World
Qrious about Insights -- Big Data in the Real WorldQrious about Insights -- Big Data in the Real World
Qrious about Insights -- Big Data in the Real World
 
WTF is Blockchain???
WTF is Blockchain???WTF is Blockchain???
WTF is Blockchain???
 
Building a (Really) Secure Cloud Product
Building a (Really) Secure Cloud ProductBuilding a (Really) Secure Cloud Product
Building a (Really) Secure Cloud Product
 
Representational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOASRepresentational State Transfer (REST) and HATEOAS
Representational State Transfer (REST) and HATEOAS
 
Introduction to LaTeX (For Word users)
 Introduction to LaTeX (For Word users) Introduction to LaTeX (For Word users)
Introduction to LaTeX (For Word users)
 
MataNui - Building a Grid Data Infrastructure that "doesn't suck!"
MataNui - Building a Grid Data Infrastructure that "doesn't suck!"MataNui - Building a Grid Data Infrastructure that "doesn't suck!"
MataNui - Building a Grid Data Infrastructure that "doesn't suck!"
 
Operations Research and Optimization in Python using PuLP
Operations Research and Optimization in Python using PuLPOperations Research and Optimization in Python using PuLP
Operations Research and Optimization in Python using PuLP
 
Python Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation ExtravaganzaPython Data Plotting and Visualisation Extravaganza
Python Data Plotting and Visualisation Extravaganza
 
Lecture "Open Source and Open Content"
Lecture "Open Source and Open Content"Lecture "Open Source and Open Content"
Lecture "Open Source and Open Content"
 
Version Control with Subversion
Version Control with SubversionVersion Control with Subversion
Version Control with Subversion
 
Thinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationThinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ Integration
 
Thinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationThinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ Integration
 
Gaining Colour Stability in Live Image Capturing
Gaining Colour Stability in Live Image CapturingGaining Colour Stability in Live Image Capturing
Gaining Colour Stability in Live Image Capturing
 
LaTeX Introduction for Word Users
LaTeX Introduction for Word UsersLaTeX Introduction for Word Users
LaTeX Introduction for Word Users
 
Thinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ IntegrationThinking Hybrid - Python/C++ Integration
Thinking Hybrid - Python/C++ Integration
 

Último

Banking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptxBanking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptxANTHONYAKINYOSOYE1
 
Hello this ppt is about seminar final project
Hello this ppt is about seminar final projectHello this ppt is about seminar final project
Hello this ppt is about seminar final projectninnasirsi
 
Introduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptxIntroduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptxDrRkurinjiMalarkurin
 
Building pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the futureBuilding pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the futureResolutionFoundation
 
ekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdfekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdfSteliosTheodorou4
 
10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdfglobusfinanza
 
Liquidity Decisions in Financial management
Liquidity Decisions in Financial managementLiquidity Decisions in Financial management
Liquidity Decisions in Financial managementshrutisingh143670
 
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshareAon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshareHenry Tapper
 
Thoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension FundThoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension FundAshwinJey
 
Kempen ' UK DB Endgame Paper Apr 24 final3.pdf
Kempen ' UK DB Endgame Paper Apr 24 final3.pdfKempen ' UK DB Endgame Paper Apr 24 final3.pdf
Kempen ' UK DB Endgame Paper Apr 24 final3.pdfHenry Tapper
 
Crypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance Verification
Crypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance VerificationCrypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance Verification
Crypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance VerificationAny kyc Account
 
What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024prajwalgopocket
 
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτοςΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτοςNewsroom8
 
The Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance LeaderThe Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance LeaderArianna Varetto
 
2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptxHenry Tapper
 
Global Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride ConsultingGlobal Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride Consultingswastiknandyofficial
 
2B Nation-State.pptx contemporary world nation
2B  Nation-State.pptx contemporary world nation2B  Nation-State.pptx contemporary world nation
2B Nation-State.pptx contemporary world nationko9240888
 
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptxOAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptxhiddenlevers
 
Gender and caste discrimination in india
Gender and caste discrimination in indiaGender and caste discrimination in india
Gender and caste discrimination in indiavandanasingh01072003
 
Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward
 

Último (20)

Banking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptxBanking: Commercial and Central Banking.pptx
Banking: Commercial and Central Banking.pptx
 
Hello this ppt is about seminar final project
Hello this ppt is about seminar final projectHello this ppt is about seminar final project
Hello this ppt is about seminar final project
 
Introduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptxIntroduction to Health Economics Dr. R. Kurinji Malar.pptx
Introduction to Health Economics Dr. R. Kurinji Malar.pptx
 
Building pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the futureBuilding pressure? Rising rents, and what to expect in the future
Building pressure? Rising rents, and what to expect in the future
 
ekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdfekthesi-trapeza-tis-ellados-gia-2023.pdf
ekthesi-trapeza-tis-ellados-gia-2023.pdf
 
10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf10 QuickBooks Tips 2024 - Globus Finanza.pdf
10 QuickBooks Tips 2024 - Globus Finanza.pdf
 
Liquidity Decisions in Financial management
Liquidity Decisions in Financial managementLiquidity Decisions in Financial management
Liquidity Decisions in Financial management
 
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshareAon-UK-DC-Pension-Tracker-Q1-2024. slideshare
Aon-UK-DC-Pension-Tracker-Q1-2024. slideshare
 
Thoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension FundThoma Bravo Equity - Presentation Pension Fund
Thoma Bravo Equity - Presentation Pension Fund
 
Kempen ' UK DB Endgame Paper Apr 24 final3.pdf
Kempen ' UK DB Endgame Paper Apr 24 final3.pdfKempen ' UK DB Endgame Paper Apr 24 final3.pdf
Kempen ' UK DB Endgame Paper Apr 24 final3.pdf
 
Crypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance Verification
Crypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance VerificationCrypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance Verification
Crypto Confidence Unlocked: AnyKYCaccount's Shortcut to Binance Verification
 
What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024What is sip and What are its Benefits in 2024
What is sip and What are its Benefits in 2024
 
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτοςΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
ΤτΕ: Ανάπτυξη 2,3% και πληθωρισμός 2,8% φέτος
 
The Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance LeaderThe Inspirational Story of Julio Herrera Velutini - Global Finance Leader
The Inspirational Story of Julio Herrera Velutini - Global Finance Leader
 
2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx2024-04-09 - Pension Playpen roundtable - slides.pptx
2024-04-09 - Pension Playpen roundtable - slides.pptx
 
Global Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride ConsultingGlobal Economic Outlook, 2024 - Scholaride Consulting
Global Economic Outlook, 2024 - Scholaride Consulting
 
2B Nation-State.pptx contemporary world nation
2B  Nation-State.pptx contemporary world nation2B  Nation-State.pptx contemporary world nation
2B Nation-State.pptx contemporary world nation
 
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptxOAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
OAT_RI_Ep18 WeighingTheRisks_Mar24_GlobalCredit.pptx
 
Gender and caste discrimination in india
Gender and caste discrimination in indiaGender and caste discrimination in india
Gender and caste discrimination in india
 
Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024Money Forward Integrated Report “Forward Map” 2024
Money Forward Integrated Report “Forward Map” 2024
 

Beating the (sh** out of the) GIL - Multithreading vs. Multiprocessing

  • 1. Threading Theory Multiprocessing Others Conclusion Finalise Beating the (sh** out of the) GIL Multithreading vs. Multiprocessing Hair dryer 1920s, Dark Roasted Blend: http://www.darkroastedblend. com/2007/01/ retro-technology-update.html Guy K. Kloss | Multithreading vs. Multiprocessing 1/36
  • 2. Threading Theory Multiprocessing Others Conclusion Finalise Beating the (sh** out of the) GIL Multithreading vs. Multiprocessing Guy K. Kloss Computer Science Massey University, Albany New Zealand Python User Group Meeting Auckland, 12 June 2008 Guy K. Kloss | Multithreading vs. Multiprocessing 2/36
  • 3. Threading Theory Multiprocessing Others Conclusion Finalise Outline 1 Threading 2 Theory 3 Multiprocessing 4 Others 5 Conclusion Guy K. Kloss | Multithreading vs. Multiprocessing 3/36
  • 4. Threading Theory Multiprocessing Others Conclusion Finalise Guy K. Kloss | Multithreading vs. Multiprocessing 4/36
  • 5. Threading Theory Multiprocessing Others Conclusion Finalise Outline 1 Threading 2 Theory 3 Multiprocessing 4 Others 5 Conclusion Guy K. Kloss | Multithreading vs. Multiprocessing 5/36
  • 6. Threading Theory Multiprocessing Others Conclusion Finalise Source: http://blog.snaplogic.org/?cat=29 Guy K. Kloss | Multithreading vs. Multiprocessing 6/36
  • 7. Threading Theory Multiprocessing Others Conclusion Finalise What People Think Now Threading and shared memory are common (thanks to Windows and Java) Python supports threads (Yay!) Python also supports easy forking (Yay!) The GIL . . . is a problem for pure Python, non I/O bound applications Lots of people “understand” threads . . . . . . and fail at them (to do them properly) Guy K. Kloss | Multithreading vs. Multiprocessing 7/36
  • 8. Threading Theory Multiprocessing Others Conclusion Finalise What People Think Now Threading and shared memory are common (thanks to Windows and Java) Python supports threads (Yay!) Python also supports easy forking (Yay!) The GIL . . . is a problem for pure Python, non I/O bound applications Lots of people “understand” threads . . . . . . and fail at them (to do them properly) Guy K. Kloss | Multithreading vs. Multiprocessing 7/36
  • 9. Threading Theory Multiprocessing Others Conclusion Finalise What People Think Now Threading and shared memory are common (thanks to Windows and Java) Python supports threads (Yay!) Python also supports easy forking (Yay!) The GIL . . . is a problem for pure Python, non I/O bound applications Lots of people “understand” threads . . . . . . and fail at them (to do them properly) Guy K. Kloss | Multithreading vs. Multiprocessing 7/36
  • 10. Threading Theory Multiprocessing Others Conclusion Finalise What People Think Now Threading and shared memory are common (thanks to Windows and Java) Python supports threads (Yay!) Python also supports easy forking (Yay!) The GIL . . . is a problem for pure Python, non I/O bound applications Lots of people “understand” threads . . . . . . and fail at them (to do them properly) Guy K. Kloss | Multithreading vs. Multiprocessing 7/36
  • 11. Threading Theory Multiprocessing Others Conclusion Finalise What People Think Now Threading and shared memory are common (thanks to Windows and Java) Python supports threads (Yay!) Python also supports easy forking (Yay!) The GIL . . . is a problem for pure Python, non I/O bound applications Lots of people “understand” threads . . . . . . and fail at them (to do them properly) Guy K. Kloss | Multithreading vs. Multiprocessing 7/36
  • 12. Threading Theory Multiprocessing Others Conclusion Finalise What People Think Now Blog post by Mark Ramm, 14 May 2008 A multi threaded system is particularly important for people who use Windows, which makes multi–process computing much more memory intensive than it needs to be. As my grandma always said Windows can’t fork worth a damn. ;) [. . . ] So, really it’s kinda like shared–memory optimized micro–processes running inside larger OS level processes, and that makes multi–threaded applications a lot more reasonable to wrap your brain around. Once you start down the path of lock managment the non-deterministic character of the system can quickly overwhelm your brain. Guy K. Kloss | Multithreading vs. Multiprocessing 8/36
  • 13. Threading Theory Multiprocessing Others Conclusion Finalise Simple Threading Example from threading import Thread from stuff import expensiveFunction class MyClass(Thread): def __init__(self, argument): self.argument = argument Thread.__init__(self) # I n i t i a l i s e the thread def run(self): self.value = expensiveFunction(self.argument) callObjects = [] for i in range(config.segments): callObjects.append(MyClass(i)) for item in callObjects: item.start() # Do something e l s e . time.sleep(15.0) for item in callObjects: item.join() print item.value Guy K. Kloss | Multithreading vs. Multiprocessing 9/36
  • 14. Threading Theory Multiprocessing Others Conclusion Finalise Our Example with Threading Our fractal example now with threading. Just a humble hair–dryer from the 30s: “One of the first machines used for permanent wave hairstyling back in the 1920’s and 1930’s.” Dark Roasted Blend: http://www.darkroastedblend.com/2007/05/ mystery-devices-issue-2.html Guy K. Kloss | Multithreading vs. Multiprocessing 10/36
  • 15. Threading Theory Multiprocessing Others Conclusion Finalise The GIL Global Interpreter Lock What is it for? Cooperative multitasking Interpreter knows when it’s “good to switch” Often more efficient than preemptive multi–tasking Can be released from native (C) code extensions (done for I/O intensive operations) Is it good? Easy coding Easy modules/extensions Large base of available modules alredy Speed improvement by factor 2 (for single–threaded applications) Keeps code safe Guy K. Kloss | Multithreading vs. Multiprocessing 11/36
  • 16. Threading Theory Multiprocessing Others Conclusion Finalise The GIL Global Interpreter Lock What is it for? Cooperative multitasking Interpreter knows when it’s “good to switch” Often more efficient than preemptive multi–tasking Can be released from native (C) code extensions (done for I/O intensive operations) Is it good? Easy coding Easy modules/extensions Large base of available modules alredy Speed improvement by factor 2 (for single–threaded applications) Keeps code safe Guy K. Kloss | Multithreading vs. Multiprocessing 11/36
  • 17. Threading Theory Multiprocessing Others Conclusion Finalise The GIL Alternatives Other implementations (C) Python uses it Jython doesn’t IronPython doesn’t They use their own/internal threading mechanisms Is it a design flaw? Maybe . . . but . . . Fierce/intense discussions to change the code base Solutions that pose other benefits: Processes create fewer inherent dead lock situations Processes scale also to multi–host scenarios Guy K. Kloss | Multithreading vs. Multiprocessing 12/36
  • 18. Threading Theory Multiprocessing Others Conclusion Finalise The GIL Alternatives Other implementations (C) Python uses it Jython doesn’t IronPython doesn’t They use their own/internal threading mechanisms Is it a design flaw? Maybe . . . but . . . Fierce/intense discussions to change the code base Solutions that pose other benefits: Processes create fewer inherent dead lock situations Processes scale also to multi–host scenarios Guy K. Kloss | Multithreading vs. Multiprocessing 12/36
  • 19. Threading Theory Multiprocessing Others Conclusion Finalise Doug Hellmann in Python Magazine 10/2007: Techniques using low–level, operating system–specific, libraries for process management are as passe as using compiled languages for CGI programming. I don’t have time for this low–level stuff any more, and neither do you. Let’s look at some modern alternatives. Guy K. Kloss | Multithreading vs. Multiprocessing 13/36
  • 20. Threading Theory Multiprocessing Others Conclusion Finalise GIL–less Python There was an attempt/patch “way back then ...” There’s a new project now by Adam Olsen Python 3000 with “free theading” [1] Using Monitors to isolate state Design focus: usability (for common cases, maintainable code) Optional at compile time using --with-freethread Sacrificed single–threaded performance (60–65 % but equivalent to threaded CPython) Automatic deadlock detection (detection/breaking, giving exceptions/stack trace) Runs on Linux and OS/X Guy K. Kloss | Multithreading vs. Multiprocessing 14/36
  • 21. Threading Theory Multiprocessing Others Conclusion Finalise Outline 1 Threading 2 Theory 3 Multiprocessing 4 Others 5 Conclusion Guy K. Kloss | Multithreading vs. Multiprocessing 15/36
  • 22. Threading Theory Multiprocessing Others Conclusion Finalise Parallelisation in General CPU vs. I/O bottle necks Threading: Good for I/O constrains This talk aims at CPU constrains Threads vs. Processes Threads: Within a process on one host Processes: Independent on the OS Processes are: Heavier in memory/overhead Have their own name space and memory Involve less problems with competing access to resources and their management But: On UN*X/Linux: Process overhead is very low (C)Python is inefficient in handling threads Stackless Python is much more efficient on threading Guy K. Kloss | Multithreading vs. Multiprocessing 16/36
  • 23. Threading Theory Multiprocessing Others Conclusion Finalise Parallelisation in General CPU vs. I/O bottle necks Threading: Good for I/O constrains This talk aims at CPU constrains Threads vs. Processes Threads: Within a process on one host Processes: Independent on the OS Processes are: Heavier in memory/overhead Have their own name space and memory Involve less problems with competing access to resources and their management But: On UN*X/Linux: Process overhead is very low (C)Python is inefficient in handling threads Stackless Python is much more efficient on threading Guy K. Kloss | Multithreading vs. Multiprocessing 16/36
  • 24. Threading Theory Multiprocessing Others Conclusion Finalise Parallelisation in General CPU vs. I/O bottle necks Threading: Good for I/O constrains This talk aims at CPU constrains Threads vs. Processes Threads: Within a process on one host Processes: Independent on the OS Processes are: Heavier in memory/overhead Have their own name space and memory Involve less problems with competing access to resources and their management But: On UN*X/Linux: Process overhead is very low (C)Python is inefficient in handling threads Stackless Python is much more efficient on threading Guy K. Kloss | Multithreading vs. Multiprocessing 16/36
  • 25. Threading Theory Multiprocessing Others Conclusion Finalise Parallelisation in General CPU vs. I/O bottle necks Threading: Good for I/O constrains This talk aims at CPU constrains Threads vs. Processes Threads: Within a process on one host Processes: Independent on the OS Processes are: Heavier in memory/overhead Have their own name space and memory Involve less problems with competing access to resources and their management But: On UN*X/Linux: Process overhead is very low (C)Python is inefficient in handling threads Stackless Python is much more efficient on threading Guy K. Kloss | Multithreading vs. Multiprocessing 16/36
  • 26. Threading Theory Multiprocessing Others Conclusion Finalise Abstraction Level vs. Control Abstraction levels for parallel computing models [7] Parallelism Communication Synchronisation 4 implicit 3 explicit implicit 2 explicit implicit 1 explicit Explicit: The programmer specifies it in the parallel program Implicit: A compiler/runtime system derives it from other information Guy K. Kloss | Multithreading vs. Multiprocessing 17/36
  • 27. Threading Theory Multiprocessing Others Conclusion Finalise Abstraction Level vs. Control Low level: Close to hardware Must specify parallelism . . . communication . . . and synchronisation → Best means for performance tuning → Premature optimisation? High level: Highest machine independence More/all handled by computing model Up to automatic parallelisation approaches Both extremes have not been very successful to date Most developments now: Level 3 for specific purposes Level 1 for general programming (esp. in the scientific community) With Python consistent level 2 possible Guy K. Kloss | Multithreading vs. Multiprocessing 18/36
  • 28. Threading Theory Multiprocessing Others Conclusion Finalise Abstraction Level vs. Control Low level: Close to hardware Must specify parallelism . . . communication . . . and synchronisation → Best means for performance tuning → Premature optimisation? High level: Highest machine independence More/all handled by computing model Up to automatic parallelisation approaches Both extremes have not been very successful to date Most developments now: Level 3 for specific purposes Level 1 for general programming (esp. in the scientific community) With Python consistent level 2 possible Guy K. Kloss | Multithreading vs. Multiprocessing 18/36
  • 29. Threading Theory Multiprocessing Others Conclusion Finalise Abstraction Level vs. Control Low level: Close to hardware Must specify parallelism . . . communication . . . and synchronisation → Best means for performance tuning → Premature optimisation? High level: Highest machine independence More/all handled by computing model Up to automatic parallelisation approaches Both extremes have not been very successful to date Most developments now: Level 3 for specific purposes Level 1 for general programming (esp. in the scientific community) With Python consistent level 2 possible Guy K. Kloss | Multithreading vs. Multiprocessing 18/36
  • 30. Threading Theory Multiprocessing Others Conclusion Finalise Common for Parallel Computing Message Passing Interface (MPI) for distributed memory OpenMP shared memory multi–threading The two do not have to be categorised like this Guy K. Kloss | Multithreading vs. Multiprocessing 19/36
  • 31. Threading Theory Multiprocessing Others Conclusion Finalise Art by “Teknika Molodezhi,” Russia 1966 Dark Roasted Blend: http://www.darkroastedblend.com/2008/01/retro-future-mind-boggling.html Guy K. Kloss | Multithreading vs. Multiprocessing 20/36
  • 32. Threading Theory Multiprocessing Others Conclusion Finalise Outline 1 Threading 2 Theory 3 Multiprocessing 4 Others 5 Conclusion Guy K. Kloss | Multithreading vs. Multiprocessing 21/36
  • 33. Threading Theory Multiprocessing Others Conclusion Finalise Processing around the GIL Smart multi–processing Smart task farming Guy K. Kloss | Multithreading vs. Multiprocessing 22/36
  • 34. Threading Theory Multiprocessing Others Conclusion Finalise (py)Processing module By R. Oudkerk [2] Written in C (really fast!) Allowes multiple cores and multiple hosts/clusters Data synchronisation through managers Easy “upgrade path” Drop in replacement (mostly) for the threading module Transparent to user Forks processes, but uses Thread API Supports queues, pipes, locks, managers (for sharing state), worker pools VERY fast, see PEP-371 [3] Jesse Noller for pyprocessing into core Python benchmarks available, awesome results! PEP is officially accepted: Thanks Guido! Guy K. Kloss | Multithreading vs. Multiprocessing 23/36
  • 35. Threading Theory Multiprocessing Others Conclusion Finalise (py)Processing module (continued) Some details Producer/consumer style system – workers pull jobs Hides most details of communication – usable default settings Communication is tweakable (to improve performance or meet certain requirements) Guy K. Kloss | Multithreading vs. Multiprocessing 24/36
  • 36. Threading Theory Multiprocessing Others Conclusion Finalise (py)Processing module Let’s see it! Guy K. Kloss | Multithreading vs. Multiprocessing 25/36
  • 37. Threading Theory Multiprocessing Others Conclusion Finalise Parallel Python module By Vitalii Vanovschi [4] Pure Python Full “Batteries included” paradigm model: Spawns automatically across detected cores, and can spawn to clusters Uses some thread module methods under the hood More of a “task farming” approach (requires potentially rethinking/restructuring) Automatically deploys code and data, no difficult/multiple installs Fault tolerance, secure inter–node communication, runs everywhere Very active communigy, good documentation, good support Guy K. Kloss | Multithreading vs. Multiprocessing 26/36
  • 38. Threading Theory Multiprocessing Others Conclusion Finalise Parallel Python module Let’s see it! Guy K. Kloss | Multithreading vs. Multiprocessing 27/36
  • 39. Threading Theory Multiprocessing Others Conclusion Finalise Outline 1 Threading 2 Theory 3 Multiprocessing 4 Others 5 Conclusion Guy K. Kloss | Multithreading vs. Multiprocessing 28/36
  • 40. Threading Theory Multiprocessing Others Conclusion Finalise Honourable Mentions pprocess [5] IPython for parallel computing [6] Bulk Synchronous Parallel (BSP) Model [7] sequence of super steps (computation, communication, barrier synch) Reactor based architectures, through Twisted [8] “Don’t call us, we call you” MPI (pyMPI, Pypar, MPI for Python, pypvm) requires constant number of processors during compation’s duration Pyro (distributed object system) Linda (PyLinda) Scientific Python (master/slave computing model) data distribution through call parameters/replication Guy K. Kloss | Multithreading vs. Multiprocessing 29/36
  • 41. Threading Theory Multiprocessing Others Conclusion Finalise Outline 1 Threading 2 Theory 3 Multiprocessing 4 Others 5 Conclusion Guy K. Kloss | Multithreading vs. Multiprocessing 30/36
  • 42. Threading Theory Multiprocessing Others Conclusion Finalise Things to Note Which approach is best? Can’t say! Many of the approaches are complimentary Needs to be evaluated what to use when All, however, save you a lot of time over the alternative of writing everything yourself with low–level libraries. What an age to be alive! Problems can arise when objects cannot be pickled Guy K. Kloss | Multithreading vs. Multiprocessing 31/36
  • 43. Threading Theory Multiprocessing Others Conclusion Finalise Conclusion Resolving the GIL is not necessarily the best solution More inefficient (single threaded) runtime Problems with shared memory access Various approaches to beat the GIL Solutions are complimentary in many ways many scale beyond a local machine/memory system Guy K. Kloss | Multithreading vs. Multiprocessing 32/36
  • 44. Threading Theory Multiprocessing Others Conclusion Finalise Questions? G.Kloss@massey.ac.nz Slides and code available here: http://www.kloss-familie.de/moin/TalksPresentations Guy K. Kloss | Multithreading vs. Multiprocessing 33/36
  • 45. Threading Theory Multiprocessing Others Conclusion Finalise References I [1] A. Olsen, Python 3000 with Free Threading project, [Online] http://code.google.com/p/python-safethread/ [2] R. Oudkerk, Processing Package, [Online] http://pypi.python.org/pypi/processing/ [3] J. Noller, PEP-371, [Online] http://www.python.org/dev/peps/pep-0371/ Guy K. Kloss | Multithreading vs. Multiprocessing 34/36
  • 46. Threading Theory Multiprocessing Others Conclusion Finalise References II [4] V. Vanovschi, Parallel Python, [Online] http://parallelpython.com/ [5] P. Boddie, pprocess, [Online] http://pypi.python.org/pypi/processing/ [6] Project Website, IPython, [Online] http://ipython.scipy.org/doc/ipython1/ html/parallel_intro.html [7] K. Hinsen, Parallel Scripting with Python Computing in Science & Engineering, Nov/Dec 2007 Guy K. Kloss | Multithreading vs. Multiprocessing 35/36
  • 47. Threading Theory Multiprocessing Others Conclusion Finalise References III [8] B. Eckel, Concurrency with Python, Twisted, and Flex, [Online] http://www.artima.com/weblogs/viewpost. jsp?thread=230001 Guy K. Kloss | Multithreading vs. Multiprocessing 36/36