Loading topic
with statements, and know that a program can run several tasks at once. You don't need to know threads yet. Everything later in this tutorial depends on one question: what is your task waiting for?3 min readwith statements. It also assumes you know what concurrency and I/O-bound work mean from the earlier chapters. Here you will start threads, wait for them, and handle the errors that trip people up most often.2 min readthreading.Thread and call start() and join(). It covers what goes wrong when several threads change the same data, and how to prevent it.3 min readwith statements. It also assumes you have started a thread with threading.Thread. Everything here describes CPython, the standard Python implementation.3 min readthreading or ThreadPoolExecutor. It also assumes you know the Global Interpreter Lock (GIL) lets only one thread run Python bytecode at a time in standard CPython. Here you will see how that rule changes the results for two kinds of work.2 min readwith statements, and know that the GIL stops two threads from running Python bytecode at the same time. The earlier chapters on threads and the GIL cover that background.3 min readthreading.Thread, what the GIL limits, and the difference between I/O-bound and CPU-bound work. It also assumes you are comfortable with with statements.2 min readconcurrent.futures. Here you turn that knowledge into a decision, then check the decision by measuring.3 min readmultiprocessing.Process or a process pool and know what pickling is. It explains how a child process gets created, why that affects your code, and why scripts that start processes need an if __name__ == "__main__": guard.2 min readmultiprocessing.Process, know why the __main__ guard is needed, and understand that each process has its own memory. Because memory is not shared, anything a child produces has to be sent to the parent explicitly.2 min readasync def and await syntax at a basic level. It also assumes you have read the earlier chapters on threads, the GIL, and I/O-bound versus CPU-bound work.2 min readThreadPoolExecutor. Here you will see why CPU-heavy threads can still run in parallel when the work happens inside native code.3 min readProcessPoolExecutor works around that. It describes the direction CPython is taking. Details here have changed between releases, so check the documentation for your version.2 min read