starting other programs from within python
Cliff Wells
LogiplexSoftware at earthlink.net
Fri Jul 19 12:43:26 EDT 2002
On Thu, 2002-07-18 at 17:16, hejduk wrote:
> >
> > If your goal is simply to execute applications from a menu, threads seem
> > like overkill to me. <shrug> I'd simply use the usual fork/exec methods. In
> > Python, these are in the os module along with the spawn methods you refer
> > to.
> >
> > --frank
>
> i thought that fork/exec involved a lot more overhead in terms of cpu
> usage and memory?
It depends upon your platform. On Linux fork() is very cheap. In fact,
in some benchmarks I saw many years ago, Linux fork() calls were cheaper
than Windows NT threads (in terms of startup times). Additionally,
things like copy-on-write help keep memory usage reasonable.
>From the Linux man pages:
"""
Under Linux, fork is implemented using copy-on-write
pages, so the only penalty incurred by fork is the time
and memory required to duplicate the parent's page tables,
and to create a unique task structure for the child.
"""
--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308
More information about the Python-list
mailing list