← Quiz: Threads, Processes and the GIL: all 10 questions
Quiz: Threads, Processes and the GIL · Question 1 of 10
What does the GIL do in CPython?
What does the GIL do in CPython?
- A.It stops a program from starting more than one thread
- B.It allows only one thread to run Python code at a time in a process
- C.It locks files so that two programs cannot open them
- D.It makes every variable thread-safe
Answer & explanation
Correct answer: It allows only one thread to run Python code at a time in a process
Threads still exist and switch, but only one runs Python bytecode at any instant.
Can you get the rest right without peeking?
Take the timed Quiz: Threads, Processes and the GIL quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →