Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Priority inheritance after Start "" /LOW  (Read 3971 times)

0 Members and 1 Guest are viewing this topic.

ALAN_BR

    Topic Starter


    Hopeful

    Thanked: 5
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Priority inheritance after Start "" /LOW
    « on: August 23, 2008, 11:40:15 AM »
    I had to add this extra line of code to the start of a batch file :-

    if %1#==# start "%~n0 %TIME%" /LOW CMD /C %~n0 %TIME% && EXIT

    The purpose of CMD /C %~n0 %TIME% && EXIT is to invoke itself again with %TIME% as an argument so the %1#==#" comparison will not sit in an endless loop - and since I needed any old argument I chose %TIME% as something of interest.

    My principle questions are, when the remainder of the script is executed at low priority which may be suspended when Windows thinks of anything (e.g. disk defrag) to fill up "idle" time, if this LOW priority script invokes DOS or Windows executables, is this low priority inherited by :-
    1. DOS commands - i.e. fc, copy, xcopy, etc., e.g. if xcopy was used to copy some folders, would its copy activity inherit the same "idle" priority and subject to defrag etc. ?
    2. Windows applications - e.g. if this script finished by launching a Windows Browser, and then the script ended and the Command Window closed, would the Windows Browser be left running at normal priority, or would this also encounter suspension whilst copying files because Windows decided to run defrag etc. ?

    A supplementary question :-  I launch this application from a shortcut in my start-up folder.  Originally I tried editing the shortcut my preceding with
    START "" /LOW
    but that only got an error that START was not recognised - is there a simple fix to the syntax, or is this just impossible ?

    PURPOSES

    At system start-up I run a batch file to inspect/compare system statistics.
    It always used to work before hitting Windows XP Home with Service Pack 3.
    Now the relevant system files are not always available before inspection/comparison. but the first line addition means the comparison is held pending for 50 Seconds whilst the system files are updated.

    Because of a different problem with SP3 there is a higher probability that the clock will sit alone on the bottom right corner, i.e. everything starts as it should, BUT the relevant icons fail to appear, and I no longer have immediate control of Volume, Safely Remove Hardware, etc.  This is especially true if ESET NOD32 detects and installs a virus update during system start-up.
    I am trying to reduce the prolonged high processor activity at start-up to see if this helps, and am now thinking of launching Xplorer2 (a double windows explorer) as the script concludes, instead of using a start-up folder link - but I don't want to degrade its speed of folder copying.

    Alan

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: Priority inheritance after Start "" /LOW
    « Reply #1 on: August 23, 2008, 02:58:52 PM »
    Quote
    My principle questions are, when the remainder of the script is executed at low priority which may be suspended when Windows thinks of anything (e.g. disk defrag) to fill up "idle" time, if this LOW priority script invokes DOS or Windows executables, is this low priority inherited by :-

    Batch files run at the same priority as the command shell. If you run your batch file in a shell window started by:

    Code: [Select]
    %comspec% /c start /low %comspec%

    you'll see in task manager that the command shell runs at low priority. Presumably so do all batch programs that utilize that instance of the shell program.

    Code: [Select]
    %comspec% /c start /low <path to started file>

    If a Windows program is started at the command line using the method above, it runs at the priority the user sets. If a Windows program is launched from the command line without being started, it runs at the priority the programmer wrote it for, unless the program has switches to modify the priority.

    I am not aware that Windows invokes defrag during idle. Is this a user setting? I do know the indexing service can run at idle, but many people turn off this "feature".

    Can you not use the sleep or ping command to kill 50 seconds?

     8)
    « Last Edit: August 23, 2008, 04:41:41 PM by Sidewinder »
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    ALAN_BR

      Topic Starter


      Hopeful

      Thanked: 5
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7
      Re: Priority inheritance after Start "" /LOW
      « Reply #2 on: August 23, 2008, 04:41:18 PM »
      Thank you very much.

      I have previously used Task Manger to find out what was hogging the CPU and to kill the culprit, but I never saw, nor was aware of, the ability to see priority levels.
      After your advice I spent 5 minutes with Task Manager and found that View had the option to show the base priority level column.

      Now I can see for myself the consequences of my actions BEFORE they bite me in the rear !

      You not only gave me a fish for today, you gave me the tools for fishing myself tomorrow !!!

      I may have used incorrect terminology when I said Windows runs defrag during idle time.  This is my understanding of why the disc light on my laptop seems to randomly burst into action when I am doing nothing.  The new to me column now shows me that 24 processes are running "Normal", 3 are "High" (why is winlogon.exe set "High" - surely I only need it when I log-on on at start-up ?), whist jqs.exe is "low" and DKService.exe is "Below Normal" - that is my defrag which I thought of as being "idle time".

      My START "" /LOW addition results in a delay whilst Windows is busy starting up.  This typically is only 15 to 20 Seconds, but this last day and perhaps 8 start-ups I have seen delays of up to 50 Seconds when ESET NOD32 finds a fresh virus signature (which can be "giganormus") to install.  There may be other situations tomorrow or next month that could require longer than 50 Seconds - and I dread to think what will happen when the next Patch Tuesday comes around !!!

      So holding off my script until conclusion of the busy start-up is effective, involves minimal delay, and will wait for 50 or even 500 seconds when need arises.
      A fixed 50 second delay would often be excessive, but occasionally inadequate.

      Before I discovered START "" /LOW I did consider using SLEEP, BUT when I downloaded and saw sleep.exe was 124 KB I reconsidered.
      My first P.C. was a second hand deluxe model with the extra size 20 MegaByte hard drive.  This established the criteria by which I judge the size of any download.  Now I have been dragged screaming and crying out of DOS and into Windows I cannot shake off my upbringing that small is beautiful !!!

      As a matter of interest, just in-case I have a future need for a "sleep delay" without the burden of a 124 KB executable, how would I use PING, preferably without aggravating some innocent internet user who might retaliate - especially if I hit someone that has control of a zombie army !!!

      Just one detail remains - I tried to prefix a shortcut with "START /LOW" but it never worked - do I need a special syntax, or is this simply impossible ?

      Once again, many thanks.

      Alan

      Sidewinder



        Guru

        Thanked: 139
      • Experience: Familiar
      • OS: Windows 10
      Re: Priority inheritance after Start "" /LOW
      « Reply #3 on: August 23, 2008, 05:26:21 PM »
      Some users think ping is a kludge, but I find it keeps with the KISS method of coding. It also does not require a download:

      Code: [Select]
      ping -w 1000 -n 51 127.0.0.1 > nul

      The above code is for 50 seconds (the first ping is nearly immediate) Note: 127.0.0.1 is your local machine, no need to worry about retaliation.

      I couldn't get a shortcut to a batch file to work; shortcuts are pointer files that only seem to confuse the shell program. Perhaps you can start the program from it's home directory:

      Code: [Select]
      %comspec% /c start /low <path to program>

      Good luck  8)
      The true sign of intelligence is not knowledge but imagination.

      -- Albert Einstein

      ALAN_BR

        Topic Starter


        Hopeful

        Thanked: 5
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 7
        Re: Priority inheritance after Start "" /LOW
        « Reply #4 on: August 24, 2008, 10:45:38 AM »
        Thank you for all your help.  All my questions on this are now fully resolved.

        I have made a note of your ping delay code.  I do not need it now but I am sure I will find a use for it soon.

        nb  ping met a special need last year :-
        My broadband speed connection was very erratic
        http://myspeed.visualware.com/ has a super speed test - it not only gives numbers, it also gives graphs of instantaneous speed and delay, and these showed that when I had a bad connection, it was actually full speed for about 200 to 400 mSec about once a second.  This gave me good ammunition against my ISP - but their first line Technical support still wanted me to re-check all my cables and telephone filters !!!

        Then I used DOS to launch a a prolonged burst of pings at 50 mSec intervals, simultaneously with the Windows Speed test, and the Speed test showed the same 500 to 800 mSec intervals each second of zero speed, whilst the ping replies just kept on happening without any loss or delay - clearly demonstrating "Traffic Management" that was affecting my TCP packet speed test, but allowing unrestricted ICMP packets without delay.

        Once again, many thanks
        Regards
        Alan