lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

system() vs. fork()


From: Raúl Núñez de Arenas Coronado
Subject: system() vs. fork()
Date: Tue, 17 Jul 2001 10:12:06 +0200

    Hi Graham :)

>> Under Unix it would be better and faster to use fork()+exec*().
>> This way the prg2lout could be in the same binary as Lout, and
>> execution of filters would be much faster and less memory hungry,
>> since no shell is invoked.
>a new primitive called, say, @Script{...} which allowed
>embedded scripting language commands [or other program
>commands] to be embedded, I would like
>to know how you'd actually communicate the output to
>Lout?

    Dunno. Maybe thru a pipe to the child process, maybe with a
message queue, unix socket, etc... There are lots of ways to do that.

>If, for some reason [which I can't think of now...],
>you wanted to, say, run a lot of complex scripts but
>preferred to create the results (Lout source) *in memory*
>-- for speed -- how could you tell Lout to:
>"Stop reading the current source file and
>please temporarily switch to reading the memory
>block pointed to by (pointer). Once you've done that
>please carry on in the source file where you left off."
>[I'm sure there are issues here I have no concept of].

    I don't think this is difficult at all. The biggest problem for
me is that I'm not familiar with the Lout source code. Communicating
processes under Unix is quite simple.

>I'm just posing the question -- I have no idea
>of the answer. I know that Lout is fast and
>that the existing @Filter works well but the idea of
>not having to continually call the shell because
>Lout had the scripting language "built in?" might be
>an interesting avenue to explore. Maybe not?

    I don't know. I think that Lout is fast the way it is now and I
don't feel like changing the 'system()' calls for 'fork()+exec()'
calls. Anyway, the @Script command can be quite useful for directly
executing some scripts. The only advantage (IMHO) is that no shell is
invoked, but under Linux this is not really and advantage: forking a
new shell is cheap, since Linux forks using a copy-on-write mechanism
and is fairly unprobable that doing the fork will eat more memory.
This can be different under other Unix, and surely will be terrible
under Windoze, no doubt ;)))

    Raúl

P.D.- Do you have a 7-bit system? I say because of my name appears
truncated, without 8-bit characters :?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]