Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: exec, system, or backticks

by perlcapt (Pilgrim)
on Oct 20, 2004 at 16:10 UTC ( #400908=note: print w/replies, xml ) Need Help??

in reply to Re^2: exec, system, or backticks
in thread exec, system, or backticks

I'm studying to the code, trying to work out what is going on. My first comment was just a reaction to trying to find where the subroutine arguments were going and how used. etc.

I'm not sure about the performance differences between backticks and the system call. I do know you don't want exec because it essentially replaces the script process with the new process of the exec call. There would be no way for your next line to be reached.

Are you benchmarking the spawning of processes here? What's up? -ben (perlcapt)


I came across this Spawing other programs in Perl which might help. The big difference it useability between backticks and system() is what they return. Backticks return the stdout of the spawned process, and system() returns the exit code. -ben

Replies are listed 'Best First'.
•Re^4: exec, system, or backticks
by merlyn (Sage) on Oct 20, 2004 at 16:20 UTC
Re^4: exec, system, or backticks
by tc1364 (Beadle) on Oct 20, 2004 at 16:33 UTC
    Not sure what is meant by benchmarking the spawning of processes, but the only processes that the code is keeping track of is the parent and child processes from the fork. What should I be doing and or benchmarking? -- Code Over View -- When the child process is created it is sent to the sub send_dk or sub send_ip. Both of these sub's do basically the same thing except one is for passing Datakit info to the Expect script ($swbt_dms) and the other passes IP info into the Expect script. The output from the Expect script is evaluated in the sub ck_results and then the code continues in the sub send_dk where depending on the results the child process hits an "exit" command.
      Benchmarking (in computing field) has mostly to do with performance comparisons. There is a whole suite of perl modules Benchmark and Benchmark::Harness, neither of which have I used. I did work for several years on Spec95 Benchmarks and at the BYTE Magazine Lab. I don't know if you are looking for performance evaluation, but if you are, I'm passing on these experiences:

      • Perl is great "harness" for doing benchmarks. The SPEC 95 benchmarks are all (and there are many) run from a quite sophisticated Perl testing application. The BYTE Unix benchmarks (which have survived longer than the actual magazine) were writen prior to Perl, had a harness using various UNIX utilities, all of which are part of Perl. I believe they were eventually migrated to a Perl "harness."
      • The forking of a new processes is a significant part of the starting of an application or test. One very good way to test an application that doesn't include the desireable: is to use the system time (1) command/utility.

      In this later case, I would use a Perl invocation like this:

      my $results = system("time $program_to_time");
      And parse the results.

      Not sure if any of this is of any interest to you. If so, I'll dig up what I can. -ben

      P.S., Those SPEC95 benchmarks were a real pain, from which I learned: a whole lot about Perl and the fundemetal difference between UNIX and VMS.

Re^4: exec, system, or backticks
by tc1364 (Beadle) on Oct 20, 2004 at 16:39 UTC
    Thank you for your help, I sincerely appreciate it! Terry

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://400908]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2017-07-24 01:59 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (347 votes). Check out past polls.