🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Threads, Processes and the GIL: all 10 questions

Quiz: Threads, Processes and the GIL · Question 9 of 10

Why must ProcessPoolExecutor code be inside if name == "main": on Windows?

Why must ProcessPoolExecutor code be inside if __name__ == "__main__": on Windows?

  1. A.Otherwise the processes cannot return values
  2. B.It makes the processes faster
  3. C.New processes re-import the file, and without the guard they would start new pools again
  4. D.Windows does not support processes otherwise
Answer & explanation

Correct answer: New processes re-import the file, and without the guard they would start new pools again

The guard makes sure only the original program creates the pool.

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 →