[Thread Prev][Thread Next][Index]

pipe and FIFO



Dear Ferreters,

I have try those four things using Ferret.
All those methods works but only the #4 is fast.

#1
/Ferret/bin/ferret > /dev/null -gif < guille_commands.jnl

#2
cat guille_commands.jnl  |  /Ferret/bin/ferret  > /dev/null -gif

#3 (popen and pclose within a C programm)
if( (ferret = popen("/Ferret/bin/ferret > /dev/null -gif","w")) == NULL)

    printf("pipe not open\n");
    ....
   fprintf(ferret,"DEFINE AXIS/X=%.4f:%.4f:0.1/UNITS=meter
xlong\n",minlon,maxlon);
    ....
    ....
pclose(ferret);

#4
/* after having created a FIFO called tube */
/Ferret/bin/ferret > /dev/null -gif < tube &
cat guille_commands.jnl >> tube



The three first are very slow. When I didnt't redirect the output
/dev/null I can see Ferret executing all the commands on my screen.  If
I give Ferret about 20 commands, it will take lots of time to write it
on the screen and I won't be able to see my gif until it is finished. I
tought maybe a simple indirection could do the job ( > /dev/null) but it
took exactly the same time except that it is not verbose.

When I use a named pipe (#4) Ferret executes my commands very quickly
and the gif is alright.

My question is:
What is the difference for Ferret between those three methods. Why #1,
#2 and #3 executes very slowly and seems to take time to write
everything character by character? Why #4 is faster? To me, all methods
should do the same thing!?


Thanks,
Guille.






[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement