Skip to main content

Explain Python's Global Interpreter Lock (GIL).

Entry Python
Quick Answer The GIL (Global Interpreter Lock) is a mutex in CPython that allows only one thread to execute Python bytecode at a time. This means CPU-bound multi-threaded code doesn't actually run in parallel. I/O-bound threads still benefit (GIL is released during I/O). For CPU-bound parallelism, use multiprocessing (separate processes, no GIL) or C extensions that release the GIL.

Answer

GIL allows only one thread to execute Python bytecode at a time.
Limits CPU-bound threading.
I/O-bound threads work well.
Multiprocessing bypasses GIL.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice