# Parallel Python

A lecture from ASPP 2024. The slides and exercises are in `slides/` and `exercises/`, respectively.

A really cool example of using `asyncio` with the dakos program is in `extras/`.

## Lecture outline

1. Processes, threads and THE GIL
2. Hands-on investigations of embarrassingly parallel problems  
   A. Multithreading with NumPy  
   B. The multiprocessing package  
   C. Blending processes and threads  
3. Going further


## Online resources

 * Online textbook on operating systems, processes, threads, etc.
    * [Operating Systems: Three Easy Pieces](https://pages.cs.wisc.edu/~remzi/OSTEP/#book-chapters)
    * Chapters 4, 13, and 26 are particularly relevant.
    * But the whole book is interesting.
 * Report of a talk on Python concurrency types, with focus on sub-interpreters.  
    * [Python subinterpreters and free-threading](https://lwn.net/Articles/985041/)
 * Comparison of multithreading, multiprocessing, and asyncio.  
    * [Async Python: The Different Forms of Concurrency](http://masnun.rocks/2016/10/06/async-python-the-different-forms-of-concurrency/)
    * Note the code snippets are a little outdated.
 * Example of webscraping with asyncio
    * [Asynchronous Web Scraping in Python - ZenRows](https://www.zenrows.com/blog/asynchronous-web-scraping-python#scrape-multiple-pages-asynchronously)
 * Sub-interpreters in 3.12
    * [Sub-interpreter web workers](https://tonybaloney.github.io/posts/sub-interpreter-web-workers.html )
