procmail
[Top] [All Lists]

Re: Avoiding flag c cloning penalty. An more efficient way?

1998-08-24 14:15:33
Jari Aalto <jari(_dot_)aalto(_at_)ntc(_dot_)nokia(_dot_)com> writes:

   As my procmail scripts grow and grow I have started becoming
   very paranoid about system load and extra processes. It came
   to my mind that 
   
   -- If c flag is used, procmail forks a clone. Child executes
      that recipe and dies.

Procmail only forks a full-blown clone on a recipe with the 'c' flag
whose action is a nested block.  If it's a simple mailbox deliver,
pipe, or forward action then procmail does not fork a 'clone' (for pipe
and forward actions procmail does have to fork, but only so it can
execute the action).


   -- Other recipes continue in Parent.

   Now, I run shell commands that need not to be serialized,
   so instead of doing the std way:


       :0 hic
       | command

   I can avoid the extra fork altogether by using

       :0
       * ? command
       { }

These take the same number of forks to execute.  They also take the
same effective number of writes (in case you're concerned about that).
The latter also requires that procmail wait for the command to finish.

 
   But would it also be same as

       dummy = `command`

   Any diffrence between 2 and 3 or other remarks?

This is worse than the above two, as procmail has to not only wait for
the command to complete but also save the output into the named
variable.



Philip Guenther

---------------------------------------------------------------- 
Philip Guenther                 UNIX Systems and Network Administrator
Internet: guenther(_at_)gac(_dot_)edu   Voicenet: (507) 933-7596
Gustavus Adolphus College       St. Peter, MN 56082-1498

<Prev in Thread] Current Thread [Next in Thread>