<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: question regarding background process in shell in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144534#M717862</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In back ground process are running in less priority then in foreground.&lt;BR /&gt;&lt;BR /&gt;Sunil</description>
    <pubDate>Mon, 15 Dec 2003 05:42:02 GMT</pubDate>
    <dc:creator>Sunil Sharma_1</dc:creator>
    <dc:date>2003-12-15T05:42:02Z</dc:date>
    <item>
      <title>question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144529#M717857</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I just want to know the advantages and disadvantages of a process running in back ground. In a script, I found the following piece of code which I did not get the logic behind...&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;while true do &lt;BR /&gt;sleep 5 &amp;gt;/dev/null&amp;amp; &lt;BR /&gt;bgpid=$! &lt;BR /&gt;wait $bgpid&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;What will be the difference if I write the above code as ...&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;while true do &lt;BR /&gt;sleep 5 &amp;gt;/dev/null&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;any advantage of having sleep in background and waiting for the process to terminate? Will there be any problem if I make sleep in the current shell and remove the wait??? Please clarify...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;VJ.</description>
      <pubDate>Mon, 15 Dec 2003 05:18:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144529#M717857</guid>
      <dc:creator>vasundhara</dc:creator>
      <dc:date>2003-12-15T05:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144530#M717858</link>
      <description>It is an exercise left there :)&lt;BR /&gt;&lt;BR /&gt;There is really no difference in this script, but looks like a test for a real script.&lt;BR /&gt;&lt;BR /&gt;What was its name ?&lt;BR /&gt;&lt;BR /&gt;Base question is: what is the purpose of a script, that do only sleep ??&lt;BR /&gt;&lt;BR /&gt;  Massimo&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Dec 2003 05:25:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144530#M717858</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-12-15T05:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144531#M717859</link>
      <description>VJ.&lt;BR /&gt;&lt;BR /&gt;If you rewrite the code as suggested it will behave exactly the same.&lt;BR /&gt;The original code runs a background process and then waits for it to complete - absolutely pointless.&lt;BR /&gt;&lt;BR /&gt;The reason to run things in background is so that you can do some other processing while the background job executes. Maybe your original script used to do this but got changed along the way, that's the only explanation I can think of.&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Mon, 15 Dec 2003 05:25:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144531#M717859</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-15T05:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144532#M717860</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thnx alot for the quick responce. My only doubt is will there be aby difference in the utilisation of the resources when a command is run in bg/fg?&lt;BR /&gt;&lt;BR /&gt;Will assign points without fail.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;VJ.</description>
      <pubDate>Mon, 15 Dec 2003 05:32:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144532#M717860</guid>
      <dc:creator>vasundhara</dc:creator>
      <dc:date>2003-12-15T05:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144533#M717861</link>
      <description>Can't imagine any resource implications of running a process in background or foreground. &lt;BR /&gt;The only difference is that with a background job, the shell continues processing commands (until it does a "wait").&lt;BR /&gt;There is the potential to start several background jobs simultaneously, which, if each is resource intensive, could cause problems, but with a trivial thing like sleep, there is no issue.&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Mon, 15 Dec 2003 05:40:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144533#M717861</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-15T05:40:17Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144534#M717862</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;In back ground process are running in less priority then in foreground.&lt;BR /&gt;&lt;BR /&gt;Sunil</description>
      <pubDate>Mon, 15 Dec 2003 05:42:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144534#M717862</guid>
      <dc:creator>Sunil Sharma_1</dc:creator>
      <dc:date>2003-12-15T05:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144535#M717863</link>
      <description>From a performance point of view, the background form is a little heavier, because you have to handle the bg....&lt;BR /&gt;&lt;BR /&gt;But we are talking about infinitesimals....&lt;BR /&gt;&lt;BR /&gt;  Massimo&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Dec 2003 05:48:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144535#M717863</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-12-15T05:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144536#M717864</link>
      <description>Hi if you put a process into background you can then use the nice command to control  the amount of process given to the script.&lt;BR /&gt;&lt;BR /&gt;But as the script only sleeps its not worth the bother.&lt;BR /&gt;&lt;BR /&gt;I dont think you need to send output from sleep to /dev/null as there should be none&lt;BR /&gt;&lt;BR /&gt;John.</description>
      <pubDate>Mon, 15 Dec 2003 05:55:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144536#M717864</guid>
      <dc:creator>John Carr_2</dc:creator>
      <dc:date>2003-12-15T05:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144537#M717865</link>
      <description>I think the first form is a bug.&lt;BR /&gt; &lt;BR /&gt;As far as I remember, in the shell, "wait" takes a job number not a process ID or it takes no  argument thus "waiting" for all child processes to finish.&lt;BR /&gt; &lt;BR /&gt;Having said that, I think the intention is to demonstrate the "wait" command but I think "sleep" is a bad example of where it might be useful. Also, redirecting output to /dev/null seems a bit dramatic to me and very few people would ever bother to do that.</description>
      <pubDate>Mon, 15 Dec 2003 06:05:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144537#M717865</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-15T06:05:07Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144538#M717866</link>
      <description>For Mark: wait needs a PID&lt;BR /&gt;&lt;BR /&gt;the job-id you are mentioning is used with the commands fg and the other job control if any other command :)&lt;BR /&gt;&lt;BR /&gt;  Massimo</description>
      <pubDate>Mon, 15 Dec 2003 06:08:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144538#M717866</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-12-15T06:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144539#M717867</link>
      <description>Massimo,&lt;BR /&gt; &lt;BR /&gt;I have to say that it would seem to make sense to use a PID bearing in mind that that is what you prbably want, however I just checked man sh-posix and I get this&lt;BR /&gt; &lt;BR /&gt; wait [job]&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Mon, 15 Dec 2003 06:13:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144539#M717867</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-15T06:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144540#M717868</link>
      <description>Mark: i checked the man page, and it turned out to be wait [pid].&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So, i think that there are both the bulti-in command wait and the external command wait..&lt;BR /&gt;&lt;BR /&gt;Look at this:&lt;BR /&gt;&lt;BR /&gt;yomodvts:/var/mail&amp;gt; which wait&lt;BR /&gt;/usr/bin/wait&lt;BR /&gt;yomodvts:/var/mail&amp;gt; typeset wait&lt;BR /&gt;yomodvts:/var/mail&amp;gt; type wait&lt;BR /&gt;wait is a shell builtin.&lt;BR /&gt;yomodvts:/var/mail&amp;gt; file /usr/bin/wait&lt;BR /&gt;/usr/bin/wait:  commands text&lt;BR /&gt;yomodvts:/var/mail&amp;gt; more /usr/bin/wait&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# @(#) $Revision: 72.2 $&lt;BR /&gt;&lt;BR /&gt;# This is the execable version of wait utility implemented&lt;BR /&gt;# using posix shell built-in wait command.&lt;BR /&gt;&lt;BR /&gt;wait $@&lt;BR /&gt;exit $?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#################################&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I didn't ever checked it before ,&lt;BR /&gt;sorry :(&lt;BR /&gt;&lt;BR /&gt;We both were perfectly right.&lt;BR /&gt;&lt;BR /&gt;  Massimo</description>
      <pubDate>Mon, 15 Dec 2003 06:18:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144540#M717868</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-12-15T06:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144541#M717869</link>
      <description>Isn't it nice when we can both be right :)&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Mon, 15 Dec 2003 06:21:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144541#M717869</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-15T06:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144542#M717870</link>
      <description>Thanks alot for all the responces. I just want to check at least one resouce utilisation factor for both cases mentioned above. For example, how much memory will be used when its run in bg/fg. &lt;BR /&gt;&lt;BR /&gt;Can anyone help me how to find memory used for a particular process???</description>
      <pubDate>Mon, 15 Dec 2003 06:32:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144542#M717870</guid>
      <dc:creator>vasundhara</dc:creator>
      <dc:date>2003-12-15T06:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144543#M717871</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I use backgound processes in a shell, when there is a chance, that the command issued may hang, like in my case ftp. I wait, see the return codes in the log file and after five minutes I terminate frp and start from scratch.&lt;BR /&gt;&lt;BR /&gt;You can see the size of a process by:&lt;BR /&gt;UNIX95= ps -eo pid,ppid,sz&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Dec 2003 06:47:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144543#M717871</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-15T06:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144544#M717872</link>
      <description>The difference between these two on memory consumption is going to be so tiny, I can't see how you would measure it.  The first one is slightly longer and therefore requires slightly more memory though possibly not and I guess the shell allocates memory is chunks anyway so the difference probably doesn't exist.&lt;BR /&gt; &lt;BR /&gt;I think you need to realise that unix is elegant.  The only reason anything runs in the foreground at all is because processes open the terminal as their standard input and the shell thinks it would be a good idea to wait for them to finish. If you use the "&amp;amp;", the shell decides not to wait for it and the standard input is closed. &lt;BR /&gt; &lt;BR /&gt;This means that resource wise, the two are almost identical.</description>
      <pubDate>Mon, 15 Dec 2003 06:54:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144544#M717872</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-15T06:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144545#M717873</link>
      <description>&amp;gt;&amp;gt;Can anyone help me how to find memory used for a particular process??? &lt;BR /&gt;&lt;BR /&gt;Look in the "sz" col of "ps -l"&lt;BR /&gt;&lt;BR /&gt;"man ps" for more info.&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Mon, 15 Dec 2003 06:56:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144545#M717873</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-15T06:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: question regarding background process in shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144546#M717874</link>
      <description>Actually there is a subtle difference between the two, how the shell handles signals.&lt;BR /&gt;&lt;BR /&gt;If you have the 'sleep' running in the foreground, any kill signal passed to the shell will be processed AFTER sleep exits. In the case where the shell is waiting for the background process signals will be processed IMMEDIATELY.&lt;BR /&gt;&lt;BR /&gt;Of course, this matters only if your script has been written to process signals in some way e.g. trap 'whatever' n&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Mon, 15 Dec 2003 07:31:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-regarding-background-process-in-shell/m-p/3144546#M717874</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2003-12-15T07:31:49Z</dc:date>
    </item>
  </channel>
</rss>

