Google Answers Logo
View Question
 
Q: re: Linux TOP command ( No Answer,   0 Comments )
Question  
Subject: re: Linux TOP command
Category: Computers > Operating Systems
Asked by: marcfest-ga
List Price: $5.00
Posted: 07 Feb 2003 11:30 PST
Expires: 07 Feb 2003 16:07 PST
Question ID: 158537
I have a script being invoked by users on my server
at /home/system1q11/htdocs/index.cgi

When I monitor server activities via the "top" command that script's
process will show up as "index.cgi".

Sometimes, though, there will be a process only designated as "PERL".
No script name. Doing the "pstree" command seems to indicate that
these processes also involve the index.cgi script.

Whenever a "PERL" process (as opposed to one designated "index.cgi")
shows up the process seems to hang and not go away (index.cgi should
never run for longer than a fraction of a second).

The common denominator of those problematic processes is that TOP does
not designate them as "index.cgi" but as "PERL".

HENCE MY QUESTION:
What does it means when TOP designates a process as PERL, and not by
its script name? I'm asking because this might be a clue for me to
solving this problem. In other words: Under what circumstance will TOP
say "PERL" and not "index.cgi"? What does this tell me about the
process referenced as PERL?

Thank you very much for helping.

Request for Question Clarification by krobert-ga on 07 Feb 2003 13:10 PST
marcfest-ga ,

I'm not absolutely sure about this as an answer so I am posting this
as an RQC rather than an answer.

Because a script is an interpret-ed program the interpret-er needs to
run in order to process the command. When index.cgi is "running", the
shell (bash or otherwise) is simply handing the program over to PERL.
PERL then executes the functions or programs listed in the script.

So... index.cgi "runs" until it is handed over to PERL, PERL runs for
the extent that the entire script runs (after being handed over).
Individual programs called from the script (if there are any in there)
should show up as separate processes.  PERL will then successfully
exit if the script successfully exits, otherwise you get an error (and
PERL should die gracefully anyway).

If your satisfied with this as an answer, I'll post it as such. 
Otherwise I'll let another researcher try to tackle it.

krobert-ga

Clarification of Question by marcfest-ga on 07 Feb 2003 13:35 PST
Am I right about this: Since the index.cgi typically only runs very
briefly I don't see it being handed over to PERL. Only when it hangs
(maybe by getting into some infinite loop somewhere) it sticks around
long enough for the "PERL" to show up in TOP, right?

Request for Question Clarification by krobert-ga on 07 Feb 2003 14:48 PST
If it's a very quick process, a lot of this is happening behind the
scenes.  If I recall correctly, TOP refreshes only every second or so,
so you may never even see anything show up. Perl will take a bit
longer to start and stop because it is a larger program, but once it's
loaded in memory it should run pretty quickly (in other words, it will
run quicker after loading the first time it's called).

Depending on how your system is configured, Perl may be running even
after index.cgi terminates. If it's running as a -system- process, it
will likely keep running after the cgi's termination.  If it's running
as a -user- process, it will likely exit after running.

krobert-ga
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy