Project for demonstration of usage of threads and processes using the fantastic concurrent.futures module (which provides a high-level interface for asynchronous task execution) as compared to the standard multiprocessing and threading modules.
You should:
-
Use Multiprocessing for: CPU bound tasks - compute intensive
-
Use Multithreading for: I/O bound tasks - network, file operations
-
loops/lists should be iterated within the executor context manager (
with _ as _:) iteratively runningexecutor.submitor withinexecutor.map. No point in iterating over loops/lists outside the context manager.
- Python Docs for concurrent.futures
- Python Threading Tutorial by Corey Schafer
- Python Multiprocessing Tutorial by Corey Schafer
- python 3.6
- virtualenv