exec* exiting?

Neil Macneale mac4-devnull at theory.org
Sun Aug 19 22:21:48 EDT 2001


Wow Alex,  sometimes it amazes me how much you write in this newsgroup.
A simple "mam execl" would have been enough :)

It turns out that its has been awhile since I used the exec* functions
in C, and now I remember why- I don't like fork()! I consider it black
magic.  Forking from a process which uses a lot of memory is not
something I want to do all the time.  Especially considering the program
I am writing.

In presponse to your comments on Ritchie and Thompsom- I love their
creation, but I have no problem calling parts of it 'lame'. There are
many aspects of the computer world that I consider 'lame', and you may
not. It's simply a matter of opinion.  I respect Ritchie and Thomson
for their creation, and Turing award is mearly a secondary effect of
thier talents.

Final note- The thing I like about python is that people excited about
it generally are not so condesending as the letter you posted below. I
happen to use pipse, sockets, and the ipcmsg functions on a daily basis,
by the way.  None of them are what I want, but thanks for reminding me 
about their existance.

Neil Macneale

Alex Martelli <aleaxit at yahoo.com> wrote:
> "Neil Macneale" <mac4-devnull at theory.org> wrote in message
> news:3b80296d$0$322$8eec23a at newsreader.tycho.net...
>> Why does the interpreter exit when I use the os.execl() function? Even when
>> the command works correctly, the interpreter exits. Am I supposed to run
>> this function is a seperate thread?  Thats lame, if so.
> 
> The os.exec* functions *overwrite the current process* (which is running
> the Python interpreter) with the executable you specify.  It's useless to
> run them in a separate *thread*: the whole *process* is overwritten.
> 
> I'm sure Dr Ritchie and Dr Thompson, Turing Award winners for the
> development of Unix (TM), which originated this arrangement, would
> be extremely saddened by finding out that you've deemed their
> brainchild 'lame' -- most particularly, don't let the ACM know, or they
> might take away their Turing Awards, the computer science equivalent
> of Nobel prizes, and wouldn't that be sad?
> 
> Nevertheless, if you're running on some Unix-derived system, you will
> generally use os.fork to generate a new process first, then in the child
> process (after setting the environment up) you will call os.exec* to
> run the intended executable for the child-process.  On other operating
> systems, if you don't intend for the interpreter process to terminate,
> don't use os.exec*; there are other alternatives, although none of
> them is as flexible and powerful as the one you consider 'lame'.  Look
> at os.spawn* or os.system if the parent and child need no special
> communication channels (pipes) between them, os.popen and its
> relatives if you do want a pipe between the processes (having more
> than one pipe is also possible, for bidirectional communication, but
> that is prone to lock-ups unless both ends are very careful in their
> I/O interactions).  Nowadays, sockets, rather than pipes, are often
> considered to be more flexible and powerful for inter-process
> communication (IPC).  Anyway, the alternatives are many, both for
> starting another process and for communicating with it.
> 
> 
> Alex

-- 

If you want to email me, remove the '-devnull' from my email address



More information about the Python-list mailing list