This code works well in Mac/Linux, but not in Windows.
import mmap
import os
map = mmap.mmap(-1, 13)
map.write("Hello world!")
pid = os.fork()
if pid == 0: # In a child process
print 'child'
map.seek(0)
print map.readline()
map.close()
else:
print 'parent'
- What’s the equivalent function of os.fork() on Windows?
Depending on your use case and whether you can use python 2.6 or not, you might be able to use the multiprocessing module.