I am trying to understand multi-threading in python3. Does python3 support multithreading? Yes/No. Core Python packages/library used for multi-threading not the 3rd party, and difference between multithreading and multiprocessing.
- Multiprocessing? docs.python.org/3/library/multiprocessing.htmlFederico Baù– Federico Baù2020-12-20 18:04:14 +00:00Commented Dec 20, 2020 at 18:04
- @FedericoBaù: That's not multi-threading, though it's often useful as a replacement for it.ShadowRanger– ShadowRanger2020-12-20 18:05:34 +00:00Commented Dec 20, 2020 at 18:05
- " though it's often useful as a replacement for it." That's excatly why I added it.Federico Baù– Federico Baù2020-12-20 18:11:55 +00:00Commented Dec 20, 2020 at 18:11
- @Samwise thanks for your time, i google but ... quora.com/Why-does-Python-not-support-multithreadingZahoor Saleem– Zahoor Saleem2020-12-20 18:43:18 +00:00Commented Dec 20, 2020 at 18:43
Add a comment |
1 Answer
Obviously yes. That's what the threading and concurrent.futures built-in modules are for (the latter also supports multi-process processing, as does multiprocessing). That said, CPython still has a GIL, so without third-party packages involved (or use of multi-process techniques), you'll only see benefits from threading on I/O bound tasks; CPU bound threads will only run one at a time.