(1) I\'m trying to use pool.map followed by pool.join(), but python doesn\'t seem to be waiting for pool.map to finish before going on
This is not the correct way to use map.
f will have his own copy of foo. To share a variable between different processes you should use a Managermap are, usually, expected to return a value.I suggest you to read some documentation.
However here is a dummy example of how you could implement it:
from multiprocessing import Pool
foo = {1: []}
def f(x):
return x
def main():
pool = Pool()
foo[1] = pool.map(f, range(100))
pool.close()
pool.join()
print foo
if __name__ == '__main__':
main()
You may also do something like pool.map(functools.partial(f, foo), range(100)) where foo is a Manager.