Index
A
- Abstract Base Classes (ABC) / Implementation
- abstract factory pattern
- about / The abstract factory
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementing the abstract factory pattern
- adapter pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- aggregations / Grouping, aggregations, and transforms
- aiohttp, client-side communication
- using / Client-side communication with aiohttp
- installing / Installing aiohttp and aiofiles
- website's HTML code, fetching / Fetching a website's HTML code
- files, writing asynchronously / Writing files asynchronously
- algorithms / Useful algorithms and data structures
- Amdahl's Law
- about / Amdahl's Law
- parallel / Terminology
- program speed / Terminology
- speedup / Terminology
- formula / Formula and interpretation, The formula for Amdahl's Law
- example / A quick example
- implications / Implications
- diminishing returns / Amdahl's Law's relationship to the law of diminishing returns
- simulating, in Python / How to simulate in Python
- practical applications / Practical applications of Amdahl's Law
- Anaconda
- reference / Installing OpenCV and NumPy
- Anaconda Python distribution
- reference / Designing your application
- annotated view / Profiling Cython
- arrays
- about / Lists and deques
- working with / Working with arrays
- arrays, NumPy
- creating / Creating arrays
- accessing / Accessing arrays
- Asynchronous JavaScript and XML (AJAX) / Asynchronous versus synchronous programming
- asynchronous programming / Asynchronous programming
- analogy / A quick analogy
- about / A quick analogy
- versus programming models / Asynchronous versus other programming models
- versus synchronous programming / Asynchronous versus synchronous programming
- versus multiprocessing / Asynchronous versus threading and multiprocessing
- versus threading / Asynchronous versus threading and multiprocessing
- example, in Python / An example in Python
- asyncio API / Asyncio API
- asyncio framework
- about / The asyncio framework
- coroutines, defining / Coroutines
- blocking code, converting into non-blocking code / Converting blocking code into non-blocking code
- using / The asyncio framework in action
- asynchronously counting down / Asynchronously counting down
- blocking functions / A note about blocking functions
- asynchronous prime-checking / Asynchronous prime-checking
- improvements, from Python 3.7 / Improvements from Python 3.7
- asyncio module
- about / The asyncio module
- transports / Transports and protocols in asyncio
- protocols / Transports and protocols in asyncio
- server client / The big picture of asyncio's server client
- Atom
- reference / General setup
- automatic parallelism / Automatic parallelism
B
- Basic Linear Algebra Subprograms (BLAS) / Getting started with Theano
- benchmarks
- writing / Writing tests and benchmarks
- timing / Timing your benchmark
- with pytest-benchmark / Better tests and benchmarks with pytest-benchmark
- best practices, concurrent image processing
- about / Good concurrent image processing practices
- correct way, selecting / Choosing the correct way (out of many)
- appropriate amount of processes, spawning / Spawning an appropriate number of processes
- input/output, processing / Processing input/output concurrently
- best practices, web requests
- about / Good practices in making web requests
- terms of service / Consider the terms of service and data-collecting policies
- data-collecting policies / Consider the terms of service and data-collecting policies
- error handling / Error handling
- program, updating / Update your program regularly
- large number of requests, avoiding / Avoid making a large number of requests
- bisect module
- about / Lists and deques
- reference / Lists and deques
- blocking code
- converting, into non-blocking code / Converting blocking code into non-blocking code
- blocking functions
- blocking tasks / Inherently blocking tasks
- bottlenecks
- finding, with cProfile / Finding bottlenecks with cProfile
- bridge pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- broadcasting / Broadcasting
- builder / Real-world examples
- builder design pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- bytecode / The dis module
C
- caching / Caching and memoization
- callbacks / Callbacks
- Cantor pairing function / Universal functions with Numba
- C arrays / C arrays and pointers
- cdef keyword / Adding static types
- cell magics / Timing your benchmark
- cells / Timing your benchmark
- central processing unit (CPU) / Multiprocessing
- Chain of Responsibility pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- Chip / Real-world examples
- circular motion / Designing your application
- classes / Classes
- client-side communication
- with aiohttp / Client-side communication with aiohttp
- code
- optimizing / Designing your application, Optimizing our code
- cold observables / Hot and cold observables
- Command pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- communication channels
- ecosystem / The ecosystem of communication channels
- asynchronous programming / Asynchronous programming for communication channels
- communication protocol layers / Communication protocol layers
- comprehension / Comprehensions and generators
- computation graph / Tensorflow
- computer image
- about / Computer image basics
- RGB values / RGB values
- pixels / Pixels and image files
- coordinates / Coordinates inside an image
- computer simulations / Designing your application
- Compute Unified Device Architecture (CUDA) / Graphic processing units
- concurrency / Concurrency
- about / What is concurrency?
- non-negative number example / Example 1 – checking whether a non-negative number is prime
- history / The history, present, and future of concurrency, The history of concurrency
- present / The present
- future / The future
- applying, to image processing / Applying concurrency to image processing
- concurrent.futures
- using, as solution for blocking tasks / concurrent.futures as a solution for blocking tasks
- framework, changes / Changes in the framework
- examples, Python / Examples in Python
- concurrent programming
- versus sequential programming / Concurrent versus sequential
- versus parallel programming / Concurrent versus parallel
- describing / A quick metaphor
- queuing / Queuing in concurrent programming
- concurrent web requests
- about / Concurrent web requests
- multiple threads, spawning / Spawning multiple threads
- request logic, refactoring / Refactoring request logic
- content management system (CMS) / Real-world examples
- context management
- about / Context management
- files, managing / Starting from managing files
- coroutines
- about / Coroutines
- defining / Coroutines
- C pointers / C arrays and pointers
- cProfile
- bottlenecks, finding with / Finding bottlenecks with cProfile
- cProfile module / Finding bottlenecks with cProfile
- CPython interpreter / Introduction to parallel programming
- critical section / The concept of thread synchronization, Critical sections
- Cygwin
- reference / Timing your benchmark
- Cython
- particle simulator / Particle simulator in Cython
- profiling / Profiling Cython
- using, with Jupyter / Using Cython with Jupyter
- Cython compiler directives
- reference / Profiling Cython
- Cython extensions
- compiling / Compiling Cython extensions
D
- database-style operations, Pandas
- about / Database-style operations with Pandas
- mapping / Mapping
- grouping / Grouping, aggregations, and transforms
- transforms / Grouping, aggregations, and transforms
- aggregations / Grouping, aggregations, and transforms
- joining / Joining
- DataFrame objects / Indexing Series and DataFrame objects
- data structures / Useful algorithms and data structures
- deadlock
- handling / Example of deadlock handling
- about / The concept of deadlock
- Dining Philosophers' problem / The Dining Philosophers problem
- using, in concurrent system / Deadlock in a concurrent system
- Python simulation / Python simulation
- situation, approaches / Approaches to deadlock situations
- ranking, implementation among resources / Implementing ranking among resources
- resources, sharing / Ignoring locks and sharing resources
- locks, ignoring / Ignoring locks and sharing resources
- deadlock solutions / Concluding note on deadlock solutions
- declarations
- sharing / Sharing declarations
- decorator pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- denial of service (DoS) attack / Avoid making a large number of requests
- deques / Lists and deques
- dictionaries / Dictionaries
- Dining Philosophers' problem / The Dining Philosophers problem
- director / Real-world examples
- Direct Selling / The prototype pattern
- dis module / The dis module
- distributed denial of service (DDoS) / Avoid making a large number of requests
- distributed memory / Introduction to parallel programming
- django-query-builder library
- reference / Real-world examples
- django-widgy
- reference / Real-world examples
- dynamic programming / Caching and memoization
E
- embarrassingly parallel / Introduction to parallel programming
- embarrassingly parallel programs / Not everything should be made concurrent, Embarrassingly parallel
- enqueue / A connection between real-life and programmatic queues
- event-driven systems / Use cases
- event loop / Event loops
- event loops / Coroutines, event loops, and futures
- Executor interface / The Executor interface
F
- factory method
- about / The factory method
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementing the factory method
- factory_boy package
- reference / Real-world examples
- façade pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- file descriptor leakage / Starting from managing files
- first-person shooter (FPS) game / The flyweight pattern
- First In First Out (FIFO) queue / A connection between real-life and programmatic queues
- fluent builder / Implementation
- flyweight pattern
- about / The flyweight pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- FrogWorld game / Implementing the abstract factory pattern
- functions / Functions
- future / Futures
- futures / Coroutines, event loops, and futures
G
- generalized universal function, Numba / Generalized universal functions
- generators / Comprehensions and generators
- Git Cola / Real-world examples
- Global Interpreter Lock (GIL) / Introduction to parallel programming
- about / A brief overview of mastering concurrency in Python, An introduction to the Global Interpreter Lock
- memory management analysis / An analysis of memory management in Python
- addresses issues / The problem that the GIL addresses
- problems / Problems raised by the GIL
- potential removal, from / The potential removal of the GIL from Python
- working with / How to work with the GIL
- multiprocessing implementation / Implementing multiprocessing, rather than multithreading
- native extensions / Getting around the GIL with native extensions
- Python interpreter, utilizing / Utilizing a different Python interpreter
- GNU Hurd
- reference / Implementation
- Google Chrome Helper / The concept of a process
- Gprof2Dot
- about / Finding bottlenecks with cProfile
- reference / Finding bottlenecks with cProfile
- Graphical User Interface (GUI) / Finding bottlenecks with cProfile
- graphical user interface (GUI) / Use cases
- graphic processing units (GPUs)
- about / Graphic processing units
- code, running on / Running code on a GPU
- grayscaling / Grayscaling
- grouping / Grouping, aggregations, and transforms
H
- hard disk drive (HDD) / The flyweight pattern
- hash map
- about / Dictionaries
- used, for building in-memory search index / Building an in-memory search index using a hash map
- heaps / Heaps
- hits / Monte Carlo approximation of pi
- hot observables / Hot and cold observables
- HTTP response status code
- 2xx (successful status code) / HTTP status code
- 1xx (informational status code) / HTTP status code
- 3xx (redirectional status code) / HTTP status code
- 4xx (error status code for the client) / HTTP status code
- 5xx (error status code for the server) / HTTP status code
- Hypertext Markup Language (HTML) / HTML
- Hypertext Transfer Protocol (HTTP) / HTTP requests
I
- I/O
- waiting for / Waiting for I/O
- image processing
- about / Image processing fundamentals
- Python, using as / Python as an image processing tool
- computer image basics / Computer image basics
- OpenCV API / OpenCV API
- techniques / Image processing techniques
- concurrency, applying / Applying concurrency to image processing
- best practices / Good concurrent image processing practices
- in-memory search index
- building, hash map used / Building an in-memory search index using a hash map
- Indexing Series / Indexing Series and DataFrame objects
- inherently sequential programs
- about / Not everything should be made concurrent, Inherently sequential
- examples, tasks / Example 2 – inherently sequential tasks
- input/output (I/O) operations / I/O bound
- integrated development environment (IDE)
- reference / General setup
- International Data Corporation (IDC) / What is concurrency?
- Internet Assigned Numbers Authority (IANA) / HTTP status code
- inverted index / Building an in-memory search index using a hash map
- IPython / Timing your benchmark
J
- JIT classes / JIT classes
- joblib / Joblib
- joins / Joining
- Jupyter
- Cython, using with / Using Cython with Jupyter
K
- Kaggle
- reference / The present
- KCachegrind
- about / Finding bottlenecks with cProfile
- example / Finding bottlenecks with cProfile
- Kivy / Real-world examples
L
- Last In First Out (LIFO) / A connection between real-life and programmatic queues
- latency / Graphic processing units
- line_profiler module
- reference / Profile line by line with line_profiler
- used, for profiling line by line / Profile line by line with line_profiler
- lists / Lists and deques
- livelock / The concept of livelock
- LLVM / Numba
- locks / Synchronization and locks
- ignoring / Ignoring locks and sharing resources
- about / An additional note about locks, Locks as a solution to race conditions
- effectiveness / The effectiveness of locks
- implementation, in Python / Implementation in Python
- disadvantages / The downside of locks
- concurrent program sequential, turning / Turning a concurrent program sequential
- using / Locks do not lock anything
- loose coupling / Use cases
- lru_cache decorator / Caching and memoization
M
- Mac Ports
- reference / Finding bottlenecks with cProfile
- magic commands / Timing your benchmark
- mapping operation / Mapping
- mathematical operations, NumPy / Mathematical operations
- Measure-Command
- reference / Timing your benchmark
- memoization / Caching and memoization, Implementation
- memory usage
- profiling, with memory_profiler / Profiling memory usage with memory_profiler
- memoryview / Typed memoryviews
- memory_profiler
- reference / Profiling memory usage with memory_profiler
- metrics, time command
- real / Timing your benchmark
- user / Timing your benchmark
- sys / Timing your benchmark
- MINIX 3
- reference / Implementation
- misses / Monte Carlo approximation of pi
- Model-Template-View (MTV) / Real-world examples
- model-view-adapter (MVA) / Use cases
- Model-View-Controller pattern
- about / The model-view-controller pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- model-view-presenter (MVP) / Use cases
- Monte Carlo approximation of pi / Monte Carlo approximation of pi
- multiple processes
- using / Using multiple processes
- multiple threads
- execution example, in Python / An example in Python
- multiprocessing / Multiprocessing
- multithreaded priority queue
- about / Multithreaded priority queue
- real-life and programmatic queues, connection / A connection between real-life and programmatic queues
- queue module / The queue module
- in concurrent programming / Queuing in concurrent programming
- multithreaded programs
- advantages / Multithreading
- disadvantages / Multithreading
- multithreading / Multithreading
- mutual exclusion / Critical sections
N
- native mode / Object mode versus native mode
- Network Marketing / The prototype pattern
- news feeds / Use cases
- non-blocking code
- blocking code, converting into / Converting blocking code into non-blocking code
- norm
- calculating / Calculating the norm
- Nuitka / Other interesting projects
- Numba
- about / Numba
- working with / First steps with Numba
- type specializations / Type specializations
- object mode, versus native mode / Object mode versus native mode
- universal functions / Universal functions with Numba
- generalized universal functions / Generalized universal functions
- limitations / Limitations in Numba
- numexpr
- optimal performance, reaching with / Reaching optimal performance with numexpr
- NumPy
- about / Getting started with NumPy
- arrays, creating / Creating arrays
- arrays, accessing / Accessing arrays
- mathematical operations / Mathematical operations
- particle simulator, rewriting in / Rewriting the particle simulator in NumPy
- NumPy arrays / NumPy arrays
O
- object-oriented programming (OOP) / Implementation
- Object-relational mapping (ORM) / Use cases
- object mode / Object mode versus native mode
- observable / Observables
- Observer pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- OpenCL / Graphic processing units
- Open Source Computer Vision (OpenCV)
- about / Python as an image processing tool
- installing / Installing OpenCV and NumPy
- reference / Installing OpenCV and NumPy
- Open Systems Interconnection (OSI) model / Communication protocol layers
- optimal performance
- reaching, with numexpr / Reaching optimal performance with numexpr
P
- pairing function / Universal functions with Numba
- Pandas
- about / Pandas
- fundamentals / Pandas fundamentals
- database-style operations / Database-style operations with Pandas
- Parallel Cython
- with OpenMP / Parallel Cython with OpenMP
- particle simulator
- rewriting, in NumPy / Rewriting the particle simulator in NumPy
- running, in PyPy / Running a particle simulator in PyPy
- particle simulator, Cython / Particle simulator in Cython
- particle simulator test application
- designing / Designing your application
- pd.Panel
- reference / Pandas fundamentals
- Pool classes / The Process and Pool classes
- priority queue / Multithreaded priority queue
- privilege escalation / Security
- process
- creating / The Process and Pool classes
- spawning / The Process and Pool classes
- launching / The Process and Pool classes
- about / The concept of a process
- versus threads / Processes versus threads
- example / Introductory example in Python
- process ID / The concept of a process
- process of execution / The concept of a process
- profile module / Finding bottlenecks with cProfile
- Properties module / Real-world examples
- protective proxy / The proxy pattern
- prototype pattern
- about / The prototype pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- proxy pattern
- about / The proxy pattern
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- psutil module
- reference / Profiling memory usage with memory_profiler
- PyCharm
- reference / General setup
- PyPy
- setting up / Setting up PyPy
- particle simulator, running in / Running a particle simulator in PyPy
- PyPy project / The PyPy project
- PyQt / Real-world examples
- Pyston / Other interesting projects
- pytest-benchmark
- using, for better tests and benchmarks / Better tests and benchmarks with pytest-benchmark
- reference / Better tests and benchmarks with pytest-benchmark
- pytest documentation
- reference / Better tests and benchmarks with pytest-benchmark
- Python
- mastering concurrency, overview / A brief overview of mastering concurrency in Python
- need for / Why Python?
- reference / Why Python?
- thread, creating / Creating a new thread in Python
- race conditions, simulating / Simulating race conditions in Python
- Python 2
- thread module / The thread module in Python 2
- Python 3
- threading module / The threading module in Python 3
- Python environment
- setting up / Setting up your Python environment
- general setup / General setup
- Python example
- about / Python example
- server, starting / Starting a server
- Telnet, installing / Installing Telnet
- connection channel, simulating / Simulating a connection channel
- messages, sending back to clients / Sending messages back to clients
- transports, closing / Closing the transports
Q
- QCacheGrind
- reference / Finding bottlenecks with cProfile
- queue module / The queue module
R
- race conditions
- about / The concept of race conditions
- critical section / Critical sections
- occurrence / How race conditions occur
- simulating, in Python / Simulating race conditions in Python
- locks, using as solution / Locks as a solution to race conditions
- real life examples / Race conditions in real life
- reactive programming
- about / Reactive programming
- observables / Observables
- operators / Useful operators
- hot observable / Hot and cold observables
- cold observable / Hot and cold observables
- CPU monitor, building / Building a CPU monitor
- ReactiveX
- reference / Reactive programming
- Read-Eval-Print Loop (REPL) / Use cases
- readers-writers problem
- about / The readers-writers problem, The first readers-writers problem, The second readers-writers problem, The third readers-writers problem
- statement / Problem statement
- real life examples, race conditions
- security / Security
- operating systems / Operating systems
- networking / Networking
- reduction operators / The concept of reduction operators
- remote proxy / The proxy pattern
- requests module
- about / The requests module
- used, for making request / Making a request in Python
- ping test, executing / Running a ping test
S
- semaphores / The history of concurrency, The present
- Separation of Concerns (SoC) principle / The model-view-controller pattern
- sets / Sets
- shared memory / Introduction to parallel programming
- simulator / Designing your application
- singleton pattern
- about / Singleton
- real-world examples / Real-world examples
- use cases / Use cases
- implementing / Implementation
- slicing / Accessing arrays
- smart (reference) proxy / The proxy pattern
- Solid-state drives (SSD) / The flyweight pattern
- Solid State Drives (SSD) / Waiting for I/O
- starvation
- about / The concept of starvation, What is starvation?
- scheduling / Scheduling
- causes / Causes of starvation
- relationship, to deadlock / Starvation's relationship to deadlock
- solutions / Solutions to starvation
- static types
- adding / Adding static types
- Sublime Text
- reference / General setup
- synchronization / Synchronization and locks
T
- techniques, image processing
- about / Image processing techniques
- grayscaling / Grayscaling
- thresholding / Thresholding
- template / Real-world examples
- Tensorflow
- about / Automatic parallelism
- working / Tensorflow
- test-specific attributes / Real-world examples
- tests
- writing / Writing tests and benchmarks
- with pytest-benchmark / Better tests and benchmarks with pytest-benchmark
- test_visualize function / Designing your application
- Theano
- about / Automatic parallelism, Getting started with Theano
- reference / Getting started with Theano
- functionality, demonstrating / Getting started with Theano
- profiling / Profiling Theano
- thread
- about / The concept of a thread
- versus processes / Threads versus processes
- synchronizing / Synchronizing threads
- threading module
- overview / An overview of the threading module
- in Python 2 / The thread module in Python 2
- in Python 3 / The threading module in Python 3
- used, for starting thread / Starting a thread with the thread module, Starting a thread with the threading module
- threads
- handling / Introduction to parallel programming
- thread synchronization
- about / Synchronizing threads, The concept of thread synchronization
- threading.Lock class / The threading.Lock class
- example / An example in Python
- thresholding / Thresholding
- throughput / Graphic processing units
- Time-Of-Check-To-Time-Of-Use (TOCTTOU) / Security
- time command
- metrics / Timing your benchmark
- about / Better tests and benchmarks with pytest-benchmark
- timeit module / Timing your benchmark
- timeout
- issue / The problem of timeout
- simulation support / Support from httpstat.us and simulation in Python
- specifications / Timeout specifications
- time slicing / Multithreading, Multiprocessing
- transforms / Grouping, aggregations, and transforms
- tries
- about / Tries
- using / Tries
- typed memoryviews / Typed memoryviews
- type specializations, Numba / Type specializations
U
- universal functions, Numba / Universal functions with Numba
V
- variables / Variables
- virtual proxy / The proxy pattern
W
- Web2py Framework
- reference / Real-world examples
- web requests
- about / The basics of web requests
- Hypertext Markup Language (HTML) / HTML
- Hypertext Transfer Protocol (HTTP) / HTTP requests
- HTTP status code / HTTP status code
- best practices / Good practices in making web requests
- with statement
- using, as context manager / The with statement as a context manager
- syntax / The syntax of the with statement
- in concurrent programming / The with statement in concurrent programming
- writers-preference / The second readers-writers problem
Z
- Zope application server
- reference / Real-world examples
- Zope Component Architecture (ZCA) / Real-world examples