Google It Support Professional Certificate · Free Practice Question Hard
Question 7
Which of the following statements is true regarding Python's Global Interpreter Lock (GIL)?
-
A
GIL allows multiple threads in a Python program to execute simultaneously on multiple CPU cores.
-
B
GIL ensures that only one thread executes at a time in a Python process, making it challenging to achieve true parallelism for CPU-bound tasks.
-
C
GIL is a Python library used for graphical user interface (GUI) development.
-
D
GIL is a data structure used for efficient memory management in Python.
Reveal correct answer
Correct answer: B
Explanation
The Global Interpreter Lock (GIL) in Python is a mutex that protects access to Python objects, preventing multiple native threads from executing Python bytecodes at once. This limitation impacts the performance of multi-threaded Python programs, especially for CPU-bound tasks.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
