Oh! You know, it occurred to me that the backtick (qx) might invoke its own process but I tested that it didn't when using bash as the shell rather than csh using the $$ pid sequence. I guess I assumed it would be the same with csh, but I get very different results. With bash:
#!/usr/bin/perl
print "my PID is $$\n";
print `bash -c "./test2.pl"`
test2.pl just outputs its own pid, and I consistently got a pid one off of the initial pid, like so:
$ ./test.pl
my PID is 21729
my PID is 21730
So it seemed that the bash component of the qx() wasn't invoking its own process, since it would have to get a pid before test2.pl did, but the numbers are sequential. However, doing it with csh I got:
$ ./test.pl
my PID is 21746
my PID is 21767
Somehow these two scripts are 21 process increments apart. It's not clear to me how that's happening. Do you know, am I misreading something here, is my testing procedure flawed, or is the csh call actually somehow grabbing 21 processes (or causing the OS to skip 21 pids?). I ran it repeatedly and each time I get a skip of 21 pids between test.pl and test2.pl.
Re: augh!
Date: 2003-10-24 04:51 am (UTC)test2.pl just outputs its own pid, and I consistently got a pid one off of the initial pid, like so:
So it seemed that the bash component of the qx() wasn't invoking its own process, since it would have to get a pid before test2.pl did, but the numbers are sequential. However, doing it with csh I got:
Somehow these two scripts are 21 process increments apart. It's not clear to me how that's happening. Do you know, am I misreading something here, is my testing procedure flawed, or is the csh call actually somehow grabbing 21 processes (or causing the OS to skip 21 pids?). I ran it repeatedly and each time I get a skip of 21 pids between test.pl and test2.pl.
Weird.