(Feb-02-2022, 01:41 PM)deanhystad Wrote: The difference between windows and unix is windows spawns a fresh process with all new global variables. This means each process has it's own global hotel[] and nobody adds items to the hotel[] in the parent process. To get around this you do not use global variables, but instead use local variables which are passed as arguments to the child processes. You can still use global variables in multiprocessing as long as they are not used to pass information back from the child processes. In your code origins[], ages[] and genders[] can be global variables. Every process will have their own variables, but they will all be the same.
In unix a process is forked. It starts out as an exact copy of the parent. This means the child processes have the same global variables as the parent processes.
Ok got it, more or less. I'm getting there. Excrutiatingly slowly, but I'm getting there.^^
So in the context of this code: can you edit the original so I can reverse engineer it, or is that too much trouble?
Also, does the manager make the code slower? And if it does, is there any point to multiprocessing in this case?
Or is there any other way to make a process return the list for the main process to pick up in some way? (In which case I would have to make separate functions for each process, I presume)