Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPythonfree-threaded no-GILSingle-choice MCQ

On a free-threaded build, two threads run `counter += 1` ten million times each on a shared module-level int (no lock). Compared to a normal GIL build, what is the expected outcome?

import threading counter = 0 def work(): global counter for _ in range(10_000_000): counter += 1 ts = [threading.Thread(target=work) for _ in range(2)] for t in ts: t.start() for t in ts: t.join() print(counter)