3 ms·
For a programming novice: Is CoW where a 'child' process operates on a copy of data stored elsewhere in memory, but you have some mechanism to always update the
by boppo1 3y ago
For a programming novice:
Is CoW where a 'child' process operates on a copy of data stored elsewhere in memory, but you have some mechanism to always update the copy any time the parent process modifies/writes to the original data?
- porridgeandrice 3y agoNo, if I have stuff, and I fork(), you, my child process is expected to have a copy of that stuff in it's current state. However, the kernel lies to you. It delays copying the stuff until I write to it i.e until I need to see a new state. Hence, "copy-on-write". In this case, I am the parent python process, you are the child processes started with the `multiprocessing` module, and the data is the numpy array. The implication is that the changes made by the parent process to the numpy array post fork() won't be visible to the child processes.