A global interpreter lock (GIL) is a mutual-exclusion lock held by a programming language interpreter thread to avoid sharing code that is not thread-safe with other threads. In implementations with a GIL, there is always one GIL for each interpreter process.
Applications running on implementations with a GIL can be designed to use separate processes to achieve full parallelism, as each process has its own interpreter and in turn has its own GIL. Otherwise, the GIL can be a significant barrier to parallelism.
Refs
https://www.geeksforgeeks.org/mutex-vs-semaphore/
https://en.wikipedia.org/wiki/CPython
https://en.wikipedia.org/wiki/Global_interpreter_lock

No comments:
Post a Comment