Per a request from the Chatterbox, it can never hust to have a brush up on the diffrences between system() and exec(). While the internal implimentation depends on the operating system, here are the genral diffrences :
system(): The system($command) command does the same thing as typing a command at the prompt in unix. A new child process is created, the program itself is loaded (be it /bin/ls or /usr/bin/perl), and begins processing (i will ignore the calls at a level lower than that).
exec(): The exec($command) call is quicker, because rather than creating a child process, and then loading the program to be run, it instead loads the program to be run into the current memory space. This means that if a.pl, running under pid 3 does exec("ls"), then the perl program will be unloaded from memory and the machine code for ls will be loaded in it's place, and will begin running under pid 3.
So, in short, system() creates a new process, in fresh memory.while exec() replaces the current program with the new one. An interesting note is that when using exec, the stdin, stderr and stdout are passed to (rather, inherited by) the new process, so reopening them will effect the next program.
OH, a sarcasm detector, that’s really useful | [reply] [d/l] [select] |
The perl scripts are launched from within another application that supports Perl scripting so the moment I start using exec the interaction with that application is lost also. I only want to kill the Perl script.
| [reply] |
Now, I'm thoroughly confused as to your setup and what you want to do with it. What exactly is this "other application"? Why is it launching perl scripts? Why is memory such an issue?
| [reply] |