Father and Son Variables
When creating son process with fork(), does it have its own copy of function's local variables? I mean if I change local variable of a function where son was created, will the father see the change or they have different copies of the variables? What about global variables or pointers to variables ?
Yes, the child has it's own copy. No, the parent does not see what happens to it and vice versa. This includes global variables, etc. They are running as seperate processes, the same as if at fork() you you had instantiated two programs.
Originally Posted by khdani
Thank You MK27 and C_ntua