Python ਤਿੰਨ concurrency models ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ, ਅਤੇ ਸਹੀ ਚੋਣ ਮੁੱਖ ਤੌਰ 'ਤੇ ਇਸ ਗੱਲ 'ਤੇ ਨਿਰਭਰ ਕਰਦੀ ਹੈ ਕਿ ਤੁਹਾਡਾ ਕੰਮ I/O-bound ਹੈ ਜਾਂ CPU-bound — ਇਹ ਫੈਸਲਾ GIL (ਜੋ threads ਨੂੰ Python ਕੋਡ ਨੂੰ ਸਮਾਨਤਾ ਨਾਲ ਚਲਾਉਣ ਤੋਂ ਰੋਕਦਾ ਹੈ) ਦੁਆਰਾ ਬਹੁਤ ਪ੍ਰਭਾਵਿਤ ਹੁੰਦਾ ਹੈ।
ਤਿੰਨ models
threading → multiple threads, ONE process. GIL-limited for CPU.
multiprocessing → multiple PROCESSES, each its own interpreter/GIL → true parallelism.
asyncio → single thread, cooperative coroutines yielding at await points.
