Front page | perl.beginners |
Postings from March 2002
RE: nice, perl, fork and exec
Thread Previous
|
Thread Next
From:
Nikola Janceski
Date:
March 19, 2002 10:43
Subject:
RE: nice, perl, fork and exec
Message ID:
1449413DA482D311B67000508B5A12F50592DEFB@nyexchange01.summithq.com
thanks for that sample code. I added a little more to try it with multiple
child processes.
It turns out that the nice carries over to all the child processes on my
solaris box.
> -----Original Message-----
> From: Jonathan E. Paton [mailto:jonathanpaton@yahoo.com]
> Sent: Tuesday, March 19, 2002 1:28 PM
> To: beginners@perl.org
> Subject: Re: nice, perl, fork and exec
>
>
> > If I run a perl script with nice, (in Unix
> > it reprioritizes the process), and fork in
> > perl and run an exec "command" with the
> > child, does the nice priority apply to
> > he child process also? and what about the
> > exec of the child process does it apply
> > there too?
>
> IIRC...
>
> Whenever you launch a child process, the child
> has the same permissions as the parent had/has.
>
> For fork:
>
> I know, that on Linux for the first time through
> the child shares the same timeslot with its
> parent. I don't know, however, if that also
> applies to the next timeslots - it may be
> platform dependent.
>
> For exec:
>
> The process information (e.g. timeslot) applies
> as it did to the original.
>
> >
> > While we are on the subject, what about system()
> > and/or `` (backticks)?
>
> system/`` creates a child process which Perl
> carefully arranges behind the scenes. Perl blocks
> on these anyway whilst waiting for data, so you
> are unlikely to need to worry too much here.
>
> > man nice didn't give me any information about
> > child processes.
>
> man evil ;-)
>
> > This is probably a perlcore developer type
> > question huh?
>
> Not really, Perl implements stuff pretty much
> the way the C people do - who use libraries
> that show much of Unix's nasty guts in the APIs
> etc.
>
> > Or more likely a unix admin type question?
>
> Definately.
>
> > If so anyone know of a good unix mail list?
>
> Have a wonder around:
>
> www.linuxdoc.org
>
> you may find something on this topic, if all
> else fails look for the glibc book (older book)
> which has the C interface for fork/exec etc.
>
> Of course, you can check (and I recommend you
> do :) that I'm correct by doing something like:
>
> #!/usr/bin/perl -w
> exec 'perl test.pl SLEEP' unless @ARGV;
> sleep 120; # Sleep 2 minutes
>
> and starting it off with nice, then use ps.
>
> Jonathan Paton
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
>
----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.
Thread Previous
|
Thread Next