Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPythonmultiprocessing vs threading picklingSingle-choice MCQ

What is printed, and what does it reveal about how `multiprocessing` with the default start method on macOS/Windows handles a global counter?

import multiprocessing as mp counter = 0 def worker(): global counter counter += 1 return counter if __name__ == "__main__": counter = 100 with mp.Pool(2) as p: print(p.map(worker, range(4)))