in reply to What is this process

I run a script that emulates a tail -f on a log file and writes some records to another file. When looking at the output of a "ps" statement, I see processes called "perl" pop up and then go away.

Hard to tell from afar without knowing how you implemented your emulation of tail -f. Are you using a module, e.g. File::Tail, Event::File::tail or such? are you using backticks, piped open? If you posted your script, we wouldn't need to guess.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: What is this process
by yellowta (Initiate) on Sep 26, 2016 at 19:37 UTC
    Thanks! I think I have figured it out. I don't use a module. At EOF, I do a seek(IN, 0, 1) to reset EOF, and continue reading. I think it is the seek that is generating the processes. Quite a few more records are written to the log file that I am reading than I echo out. So, I probably do much more reading after hitting EOF. The timing makes sense. Also, I have another script that does a similar thing, except that it does not echo anything out. It has been running for a year. Never paid much attention to it. When I started watching for the perl processes on that box, it was doing the same thing. So the only thing in common between those two scripts is the seek. I think the fickle finger of fate is pointed squarely at the seek. Thanks again!
      I think it is the seek that is generating the processes.

      No. perl's seek doesn't imply spawning a new process. It boils down to a system call done in the same process, on my system (Linux) it is lseek(2).
      Does perl sport an echo function (see perlfunc)? There.

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'