Feb-02-2022, 01:41 PM
(This post was last modified: Feb-02-2022, 01:41 PM by deanhystad.)
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.
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.