in reply to Suggestions on differentiating child processes

How do the children get which data set to work on? Probably your best approach is to have the parent assign the work the child is going to do. Then you can store the child's pid (the result of the fork) and the workload assigned to it...somewhere (either to a file, or have the program output it, or something--what's appropriate depends a lot on the details of your program).

Also, you might see what setting $0 does on your system, as it might be a quick and easy way to differentiate the children in a ps listing, though it only works on some OS's.

Replies are listed 'Best First'.
Re^2: Suggestions on differentiating child processes
by gnu@perl (Pilgrim) on Nov 12, 2004 at 15:54 UTC
    Your first suggestion is what I was considering, as outlined in my post. Unfortunately (for this I guess), I am using Solaris and the $0 data is obtained from the /proc filesystem by ps and cannot be changed from within the program.