I am implementing a multiprocessor program in python, and for each of the subprocesses they should all read part of the file.
Since reading a file from disk is expensive, I want to read it only once and put it into shared memory.
1. If I use mmap, it can work with fork, but I canβt find a way to exchange the mmaped file between processes in the multiprocessing module.
2. If I read in a file in str and saved the line in sharedctypes.RawArray ('c', str), an error may occur if str has \ 0, the RawArray generated is truncation of the file.
Any idea?
source share