Slashdot Mirror


Permanently Set Process Priority in Windows?

Dave asks: "I have a render farm set up for 3D Studio Max. I have a Render user that runs 3dsmax.exe when it is sent jobs by the render farm server. I have tried to set the process to low when it runs, and it works. However, when the computer is finished rendering the images, and is sent a new set to render, the priority goes back to normal (program closes in between renderings). This obviously defeats the purpose of rendering an image in the background while others are still working, as you can imagine having 3dsmax.exe pegged at 100% CPU, slows down the machine tremendously. Is there anything that can be done to set the render user's instance of 3dsmax.exe permanently to low? Or is it possible to just set 3dsmax.exe to the low priority. I know there is a command line that sets any .exe to low, but that also starts the program. I would like 3dsmax.exe to be set to low either: when render launches the program, or set 3dsmax.exe to low whenever it is launched. Can anything be done?"

25 of 125 comments (clear)

  1. start /low by teeheehee · · Score: 5, Informative

    If you check out 'help start' you can see that setting the priority of a process is pretty simple at the time of invocation.

    'start /low 3dsmax.exe' or 'start /low [program.exe]' should work for you.

    --
    "We are not always what we seem, and hardly ever what we dream."
    Schmendrick the Magician
    1. Re:start /low by teeheehee · · Score: 2, Informative

      Having re-read your post, I'm not sure if my reply helps :P

      I had thought that SysInternals had something to do this with command line, but was unable to find it. There's this third party tool which claims to be able to change the priority of a running process, but I've never used it to vouch for it: http://www.teamcti.com/pview/prcview.htm

      Sorry for the likely helpless quick-post. I should drink coffee either before or after reading, not at the same time!

      --
      "We are not always what we seem, and hardly ever what we dream."
      Schmendrick the Magician
    2. Re:start /low by SuiteSisterMary · · Score: 2, Informative

      At that rate, he should be able to edit the file type association to invoke the program itself.

      --
      Vintage computer games and RPG books available. Email me if you're interested.
  2. Prio - Process Priority Saver by neonprimetime · · Score: 4, Informative

    Your solution is here

    1. Re:Prio - Process Priority Saver by kestasjk · · Score: 2, Insightful

      You should avoid apps from places like that at all costs, especially when there are easy solutions involving free software.

      I'd say write an app which looks for 3dmax.exe processes at frequent intervals and sets them to low. With cygwin it'd take a couple of minutes to write a shell script. Do anything but don't use 'Priority Saver Deluxe Edition v10 for only $19.99', these companies exist because of ignorance/laziness and PageRank bots.

      --
      // MD_Update(&m,buf,j);
    2. Re:Prio - Process Priority Saver by aminorex · · Score: 2, Insightful

      So let me get this straight: Writing a program that people find useful and offering it for sale is somehow an evil deed? I'm sorry, but I think you've completely detached yourself from any sort of moral perspective, and quite possibly from reality itself. Hate to see you go.

      --
      -I like my women like I like my tea: green-
    3. Re:Prio - Process Priority Saver by amliebsch · · Score: 2, Interesting

      I agree with above. For example, the following C# code works (.NET 2.0):

      using System;
      using System.Collections.Generic;
      using System.Text;
      using System.Diagnostics;
      using System.Threading;
       
      namespace SetLowPriority
      {
          class Program
          {
              static void Main(string[] args)
              {
                  string pname=null;
       
                  if (args.Length==0)
                  {
                      Console.WriteLine("You must specify a process name.");
                  }
                  else
                  {
                      pname = args[0];
                  }
       
                  while(true)
                  {
                      Thread.Sleep(1000);
                      checkForProcesses( pname);
                  }
       
              }
       
              static void checkForProcesses(string pname)
              {
                  if (Process.GetProcessesByName(pname).Length == 0)
                  {
                      Console.WriteLine("{0} is not running.", pname);
                  }
                  else
                  {
                      int processCount = 0;
                      foreach (Process p in Process.GetProcessesByName(pname))
                      {
                          if (!(p.PriorityClass == ProcessPriorityClass.BelowNormal))
                          {
                              p.PriorityClass = ProcessPriorityClass.BelowNormal;
                              processCount++;
                          }
                      }
                      Console.WriteLine("{0} is running; {1} instances switched to low priority.", pname, processCount);
                  }
              }
          }
      }
      --
      If you don't know where you are going, you will wind up somewhere else.
    4. Re:Prio - Process Priority Saver by phfpht · · Score: 2, Insightful
      Preface: You are completely correct. I'll not dispute that.

      But, if you have "a problem" there *may* be a $19.95 solution that will work perfectly. But, just because it's $19.95 and neatly packaged doesn't mean it'll necessarily be any
      • a) easier to find (might still take an hour search just to find it amid the chaff of adware/junk out there) or
      • b) easy to use (installing a "nice package" may be quick, but using said program to solve "the problem" could still be complicated and time consuming).


      Commercial or OSS doesn't make or break any solution. You should always use the solution that works and leave idealogical hangups at the door if your interest is in solving "the problem".

      Or, to put it another way, paying someone $19.95 to research and package a solution for you doesn't guarantee they did it right. You'll still have to "spend" time to verify that yourself.

      Maybe that's what you meant, and if so I please disregard this post.
  3. Wrapper by Bromskloss · · Score: 4, Informative

    Mabye replace "3sdmax.exe" with a shellscript that runs the real "3dsmax.exe" with the correct priority. You might have to work out how the renderer gets its data, so your shellscript can make sure it isn't dropped somewhere along the way.

    --
    Swedish plasma phys. PhD student; MSc EE; knows maths, programming, electronics; finance interest; seeks opportunities
    1. Re:Wrapper by gEvil+(beta) · · Score: 3, Funny

      From the bottom of that page: "prioritymaster.com has been on the web since 1995!"

      ...and we have the website to prove it!!!

      --
      This guy's the limit!
  4. Your question contains its answer. by Magada · · Score: 2, Insightful

    "I know there is a command line that sets any .exe to low, but that also starts the program."
    Just make an alias to 3dsmax.exe that actually invokes the one-liner you are talking of. No?

    --
    Something bad is coming when people are suddenly anxious to tell the truth.
  5. Re:Another process question by giorgiofr · · Score: 2, Informative

    There's the whole Performance Monitor for that: you can save the value of many different parameters, such as CPU utilization, every n seconds, and generate reports based on those.

    --
    Global warming is a cube.
  6. Thank you, Cliff!!! by Anonymous Coward · · Score: 2, Insightful

    I don't have any answer, but am pleased to see Ask Slashdot offering up a real technical question, not just a pretext for uninformed ranting.

  7. Re:Another process question by flink · · Score: 3, Informative

    The hourglass is just a picture. It has no intrinsic meaning as far as the application goes. You're supposed to change the cursor to the hourglass when your program is about to do something that will cause it to cease reacting to user input. Then, after the blocking call, you change it back to a pointer. A process could be pegging the CPU and still be showing the arrow pointer because it can still respond to you (think software HD video decoding). It could also be showing an hourglass and not using any CPU or disk resources at all (like a network application waiting for the server to respond).

    Assuming you're on Windows, and that by "busy", you mean how often the CPU has been in use, then go into the Processes tab of Task Manager and look at the CPU time column for PID 0 (System Idle Process). Subtract that time from system up time to get the amount of time the CPU was in use, or divide to get idle%.

  8. A small programming project by mr_rattles · · Score: 3, Informative

    If you're a programmer you could grab the source code for a utility I wrote to kill processes by name as they appear and modify it to change the priority any time the process appears. The tool is called Process Hunter Daemon. You can get the source code at my homepage (http://yakko.cs.wmich.edu/~rattles/development/wi ndows/#phunterd).

    The benefit of going this route would be that it doesn't matter how someone started the 3D Studio Max executable, it would always get changed to low priority. Actually I might do the modification myself because I'm kind of digging the idea. The list of programs that ProcessHunterD looks for is configurable, you could just as easily make the priority configurable as well so you could change it to give other executables higher priority if you'd like.

  9. More effective solution? by voice_of_all_reason · · Score: 4, Insightful

    I'd love to know if there's a way to limit ALL processes to a certain percentage of total CPU... say 75%. There's no reason programs should routinely be able to run up every bit of processing power.

    1. Re:More effective solution? by gbjbaanb · · Score: 4, Informative

      not really. The windows task scheduler works on the principle that every process with the same priority gets equal share of the CPU. Now, if 1 app wants 100% of the CPU then it's going to be asking for it and using as much of its time slices as it can get, other apps get the same (if they want it - obviously most apps sit there twiddling their virtual thumbs waiting for the user, the disk, the network, etc). So if 2 apps want 100% each (as when you start an app whilst another is well busy) then they will each get 50%.. and take twice as long to do whatever it was they were doing, thus appearing to slow down user responsiveness.

      Usually the foreground app (ie window) gets a little bit extra so it makes Windows *more* responsive, but again, that doesn't help you if you're waiting for an app to start (as it'll be in the background...)(you can turn this feature off if you like - system control panel to make it more server like).

      So, with the system proposed, the starting app would not start any quicker - it would still want 75% of the CPU, as would the running app. The only benefit would be that the CPU had 25% time to sit there doing nothing. If you think you could use another app while those 2 fought over their 75% CPU resources, think that the app you want to use is also limited to 75% (and assuming you make it work and not sit mostly idle) it would be grabbing CPU time away from the 2 original apps, making them slower still.

      If you want more response, give 1 app a lower priority and Windows will leave it for a while until the higher priority app goes idle. I do not recommend doing this for explorer.exe :-)

      Incidentally, Linux uses a weighted round-robin scheduler (windows uses a plain one that gives equal time to all runnign aps of the same priority) that gives less time to apps the more they use the CPU, this is probably why you feel Linux is more responsive - an interactive app will spend more of its time waiting for the user, so when it does need to do something, it is given a larger amount of time than its peers. If you use it a lot though, you'd find it gets slower over time. (so if you have a text editor and a compiler running, the text editor gets more CPU time when it wants it, but if you set the editor to do a lengthy 100% CPU task, you'd find its responsiveness was not as good when it was finished).

  10. Re:Google It? by MobileTatsu-NJG · · Score: 3, Insightful
    I googled windows priority command line and the 6th result was titled: "smallbusiness.itworld.com - Windows Tip: Launching a low priority ..."


    Did you Google a little farther and find the answer to the question that was asked? The network rendering manager is spawning 3DSM, not somebody sitting at the computer. The start command won't work unless the network renderer is modified. What he needs is for Windows to always recognize that .exe is low priority so that mode is set regardless of how the app is actually started. He's already got the 'use human interaction to make the process low priority' bit working, so elite Googling skills didn't save the day.

    --

    "I like to lick butts!" by MobileTatsu-NJG (#32700246) (Score:5, Informative)

  11. Process Lasso by johu · · Score: 3, Informative

    You can do that with Process Lasso. http://www.bitsum.com/ProSuper.asp

  12. Re:Thanks... by Jerf · · Score: 2, Informative

    I'm by no means a windows guru, but I do know if Task Manager says the task is "not responding", that means it is no longer responding to Windows messages. The easiest way for that to happen is for the program to be single-threaded, and in the middle of a lengthy computation, thus never getting back to the message pump, which is what you're getting.

    You might be able to write a relatively simple program that just periodically sends a message to the window and looks for a response; if it doesn't get it in a certain time period, it assumes it to be unresponsive. I don't know what message is best to send (I don't know if there's a "ping" message, although presumably Task Manager is doing something like that so maybe there is), but I'm sure there's something you can use.

    Unfortunately, that's about as far as I can take you, except to also suggest that you don't need to whip out Visual Studio for this; any number of more pleasent languages will be able to do this, too. Python with the Win32 extensions, for instance, can send Windows messages directly with a wrapped SendMessage call.

  13. 3DS Max Startup script by Grotus · · Score: 4, Informative

    For this particular problem, the easiest solution would be to use a startup MAXscript on your render nodes which sets the priority.

    Or you could use a rendering manager which lets you control the priority of the render nodes, like Deadline from Frantic Films.

    --
    "From my cold, dead hands you damn, dirty apes!" - CH
  14. Except that Windows does it painfully by anomaly · · Score: 2, Interesting

    This is a sore point for me.

    I've got an XP box with 1.5GB RAM. Just checking Process Manager, I've got ~900MB RAM free - and less than 500MB of apps using RAM. Windows' default paging algorithm aggressively swaps LRU blocks, so regardless of whether I'm using all of my RAM (or more than 30%) I can count on windows swapping for a good amount of time during my work day - especially if I've had an application open and unused for a few hours.

    Your suggestion about disabling SWAP works - application access is rather like a rocket. Good show! Except for the fact that when swap is disabled, hibernation no longer works. In fact, I have to use a RAM defragger to keep Windows from blue screening when I hibernate. I call it "hibernation roulette."

    So, with windows, I have to choose whether I swap during the day, or whether I have to shut down and restart all of my applications every day. Ick.

    Any suggestions about how to be able to avoid swap *and* hibernate?
    FWIW, upgrading to SP2 and applying http://www.microsoft.com/downloads/details.aspx?am p;displaylang=en&familyid=4cbc68d2-09e1-4511-af14- 03f357180135&displaylang=en
    didn't help.....

    --
    But Herr Heisenberg, how does the electron know when I'm looking?
  15. ProcessTamer by Anonymous Coward · · Score: 2, Informative

    Try ProcessTamer. It lets you define rules and automatically raises/lowers the priority of "misbehaving" processes. Quite a nice app, too bad it has an annoying free registration procedure (as does most of the software on that site). --CK

  16. Mod parent up Prio looks like a good freeware util by blorg · · Score: 2, Insightful
    I just downloaded this myself and it seems very neat and tidy and integrates straight into Task Manager. It's as simple as adding "save priority" checkbox to the right-click menu. It also integrates a services tab (connected to the processes) and an optional TCP/IP tab which shows TCP/IP activity by process. And it has a few other nice features.

    Now I have only had it 5 minutes so can't give an in-depth account of how it is going to behave long-term regarding stability/system resources etc. but certainly the learning curve is non-existent if you know how to use task manager.

    Honestly, someone asks how to do something simple in Windows (note a closed source cost-money OS) and most of the replies divide between:
    1. completely igoring the problem and telling him how to _start_ a process with a given priority, duh;
    2. explaining how he can install cygwin and write a script himself to scan for processes and reset them to whatever priority (good luck on making that one neat and efficient in a 5-minute script;)
    3. reminding him that if was only using Linux he could recompile the kernel to achieve his aims (a completely irrelevant point in any case as Windows actually does expose interfaces to adjust process priorities. Recompiling the kernel is rarely the best way to achieve something if you have the option of a defined API. This is no different in Linux.)
    While the one answer that points out a simple and elegant freeware utility that does the exact job requested and does it well gets flamed.

    (And yes they do describe it as "freeware" on their website; I suspect what they mean to mean by "free for personal use" is that they retain copyright and you can't redistribute it, I don't think they actually intend to exclude commercial use - as suggested by the lack of a way to buy it on their purchase page.)