Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    The problem was that I was running the instances in two console windows in foreground. When I run them in background (using &) it works. It seems that Linux privileges processes running in foreground in a console and largely (completely?) ignores their niceness values. This makes sense as a user likely wants to interact with the program he/she started in a console window. Commented Apr 26, 2012 at 23:27
  • Any clarification on how this works exactly would be greatly appreciated. Commented Apr 26, 2012 at 23:34
  • Running a program in the foreground runs it as a child process of the console that spawned it, and child processes typically inherit the priority of their parent. Adding the & runs the program as a completely separate process, allowing you to control its priority individually. Commented Apr 26, 2012 at 23:42
  • Yes, but starting a program with nice (without &) does still change the priority of the child process. Commented Apr 27, 2012 at 0:01
  • It's possible that the system is limiting how far you can increase the priority of a foreground process attached to a console. After all if you increase the priority high enough that the parent console can't get any CPU time, then you can't even Ctrl+C to kill a runaway child process. I forget exactly how the kernel does this, but I do remember there being a mechanism for the kernel enforcing max/min priority limits. Commented Apr 27, 2012 at 18:31