parent
4e569a9417
commit
058a54f947
5 changed files with 39 additions and 5 deletions
@ -1 +1,8 @@ |
||||
# Asynchrony |
||||
# Asynchrony |
||||
|
||||
Asynchronous programming, supported by asyncio, allows code to be executed without blocking, using async and await. This is especially useful for I/O tasks such as networking or file manipulation, allowing thousands of connections to be handled without blocking the main thread. |
||||
|
||||
Learn more about asynchronous programming in Python with the following resources: |
||||
|
||||
- [@official@Python AsyncIO library](https://docs.python.org/3/library/asyncio.html) |
||||
- [@article@Async IO in Python: A Complete Walkthrough](https://realpython.com/async-io-python/) |
||||
|
@ -1 +1,7 @@ |
||||
# Concurrency |
||||
# Concurrency |
||||
|
||||
Concurrency in Python allows multiple tasks to be executed simultaneously using different approaches. GIL (Global Interpreter Lock) limits thread execution, making multithreading less efficient for computational tasks, but suitable for I/O. Multiprocessing, using the multiprocessing module, allows multiple cores to be utilized, providing true parallelism. Asynchrony via asyncio is optimal for I/O operations, allowing thousands of connections to be processed simultaneously without blocking. The choice of approach depends on the nature of the task. |
||||
|
||||
Learn more about concurrency using the following resources: |
||||
|
||||
- [@official@Python Concurrency](https://realpython.com/python-concurrency/) |
@ -1 +1,7 @@ |
||||
# GIL |
||||
# GIL |
||||
|
||||
GIL is a mechanism that allows only one thread to execute Python code at a time. This limitation is related to memory management in CPython and can reduce the efficiency of multithreaded applications on multi-core systems. |
||||
|
||||
Learn more about it using the following resources: |
||||
|
||||
- [@article@What is GIL?](https://realpython.com/python-gil/) |
@ -1 +1,9 @@ |
||||
# Multiprocessing |
||||
# Multiprocessing |
||||
|
||||
Multiprocessing utilizes multiple processes, each with its own GIL. This allows full utilization of multiple processor cores, which is effective for computationally intensive tasks. Python's multiprocessing module supports creating processes and exchanging data between them. |
||||
|
||||
Learn more about multiprocessing with the following resources: |
||||
|
||||
- [@official@Official Documentation](https://docs.python.org/3/library/multiprocessing.html) |
||||
- [@article@Multiprocessing in Python with Example](https://www.digitalocean.com/community/tutorials/python-multiprocessing-example) |
||||
- [@article@Multiprocessing in Python](https://realpython.com/python-multiprocessing/) |
@ -1 +1,8 @@ |
||||
# Threading |
||||
# Threading |
||||
|
||||
Multithreading allows multiple threads within a single process. However, because of GIL, threads cannot run in parallel on different cores, which makes multithreading suitable for I/O tasks (e.g., network requests) but not for computational tasks. |
||||
|
||||
Learn more about it from the following resources: |
||||
|
||||
- [@official@Python Threading Library](https://docs.python.org/3/library/threading.html) |
||||
- [@article@Introduction to Threading in Python](https://realpython.com/intro-to-python-threading/) |
Loading…
Reference in new issue