On Mon, 21 Mar 2016 16:01:41 +0530, Nitin Varyani said: > I am running a master user-level process at Computer 1 which sends a > process context like code, data, registers, PC, etc as well as *"pid"* to > slave processes running at other computers. The responsibility of the slave > process is to fork a new process on order of master process and attach *"pid" > *given by the master to the new process it has forked. Any system call on > slave nodes will have an initial check of " Whether the process belongs to > local node or to the master node?". That is, if kernel at Computer 2 pid of > the process is 1500
None of that requires actually controlling the PID of the child.
Consider this code:
int child_pid[5], j;
pid_t child;
for (j=0;j<5;j++) {
child = fork();
if (child == 0)
go_init_worker_process();
else
child_pid[j] = child;
}
Now you have 5 children, and know what process IDs they are, without
having to do any kernel hacking at all. This has been a long-understood
idiom in the Unix/Linux world - I remember first seeing it on SunOS 3.2 back
in 1985 or so...
pgpADWQ10Myy3.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
