I'm trying to understand Python's Multi-processing module using the below given sample example but never been successful so far. I'm running the code in Spyder and it always hangs there with no output in the console. I learnt in some article that multiprocessing module doesn't work in Spyder console, so I created an exe out of it and executed in cmd but my VDI crashed and couldn't connect for hours until many attempts to restart. can I get suggestions on what I should do to make the below code run !
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
p = Pool(5)
print(p.map(f, [1, 2, 3]))