更新时间:2021-07-02 20:22:20
cover
Title Page
Copyright
Learning Concurrency in Python
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Downloading the example code
Errata
Piracy
Questions
Speed It Up!
History of concurrency
Threads and multithreading
What is a thread?
Types of threads
What is multithreading?
Processes
Properties of processes
Multiprocessing
Event-driven programming
Turtle
Breaking it down
Reactive programming
ReactiveX - RxPy
GPU programming
PyCUDA
OpenCL
Theano
The limitations of Python
Jython
IronPython
Why should we use Python?
Concurrent image download
Sequential download
Concurrent download
Improving number crunching with multiprocessing
Sequential prime factorization
Concurrent prime factorization
Summary
Parallelize It
Understanding concurrency
Properties of concurrent systems
I/O bottlenecks
Understanding parallelism
CPU-bound bottlenecks
How do they work on a CPU?
Single-core CPUs
Clock rate
Martelli model of scalability
Time-sharing - the task scheduler
Multi-core processors
System architecture styles
SISD
SIMD
MISD
MIMD
Computer memory architecture styles
UMA
NUMA
Life of a Thread
Threads in Python
Thread state
State flow chart
Python example of thread state
Different types of threads
POSIX threads
Windows threads
The ways to start a thread
Starting a thread
Inheriting from the thread class
Forking
Example
Daemonizing a thread
Handling threads in Python
Starting loads of threads
Slowing down programs using threads