-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot limit multi process at same time #74
Comments
Are you using SysInternals from a Microsoft Store package? If so, then they will have already a job assigned (UWP container job) and procgov won't be able to create its own job object. I have plans to support UWP apps, but I haven't yet worked on that. If you download SysinternalsSuite package and try to run the apps from it, everything should work properly (as with any other non-UWP application): $cpus = Start-Process -FilePath c:\temp\SysinternalsSuite\CPUSTRES64.EXE -PassThru
$testl = Start-Process -PassThru -FilePath c:\temp\SysinternalsSuite\Testlimit64.EXE -ArgumentList @("-m", "-c", "1000", "-e", "100")
procgov64.exe -v --cpurate 60 -p "$($cpus.Id),$($testl.Id)" Output:
|
Actually, I will leave it opened and close once I do some more research on UWP apps. Thanks for reporting and let me know if it's actually the problem I described :) |
Thanks for reply so quickly :). Are you using SysInternals from a Microsoft Store package?Yes, I'm using SysInternals, which downloaded from MS official site. Following your above steps and launching applications with "windows power shell", the procgov64 can limit the CPU usage for above apps successfully. I have a question here, AFAIK, I can start up an application(e.g. CPUSTRES64.exe) with below ways: If I launch application with a, I CANNOT add resource limit to the application. seems method (a) add the application to a UWP container job automatically, but b/c does not, is my understanding correct? Is there any way to prevent windows from adding application into UWP container job automatically? |
Thank you for these additional tests. So it looks that the problem is that procgov tries to add two UWP processes in the same job. I suspect it is problematic because UWP processes have already jobs assigned. If you try to run procgov with one PID at a time, it should work. So, in your example, instead of running
That will create separate jobs for each of the processes that will be "merged" with the original UWP jobs. As I wrote, I need to do some research on UWP and also improve the errors reported by procgov (the Access Denied is only about the second process - the first one is properly assigned to the job). If you would like to experiment more, one way to check if a process runs in a job is by using Process Explorer. Run it as admin, find the process you want to check and open the Job tab in its properties, for example: |
Thank you for replying my questions :). After reading the manual of windows job object api here: see above outlined text: If the process is already associated with a job, the job specified by hJob must be empty or it must be in the hierarchy of nested jobs to which the process already belongs, and it cannot have UI limits set (SetInformationJobObject with JobObjectBasicUIRestrictions). For more information, see Remarks. for cpustres64 started by windows shell(explorer), it's already in an UNNAMED job object. for cpustres64 started by windows terminal/power shell, it's not in any job object. I believe this is the root cause of this behavior :) I'm trying to limit resource usage e.g. CPU/memory of a set of applications TOGETHER, but not one by one, so I'm trying to create a jobobject and add all processed I want to limit into the job object, but failed as above. any comments/thoughts on this? :) |
The job hierarchy is not really a "hierarchy". I was able to successfully add a new job to a process that had already a job assigned. The requirement is that the new job must be more "limiting" than the previous one. However, I'm not sure why we get an error when trying to assign multiple processes to the same job. does not necessarily mean there is no job. You need to run Process Explorer as Admin and when there is no Job tab in the properties, then there is no job for real :) Anyway, for your case, if the applications you want to limit are not store apps, you should be fine with using -p with a list of PIDs. |
I'm sure that the "process explorer" is launched with "Admin" permission on above screenshot. a. for the process start from explorer, in its job tab, we can see the process is put into an unnamed job in my test: (b) could be added into new created job, even the job object is not empty. weird, will continue to try some other case. |
launch two processes
a. testlimit64.exe
b. cpustres64.exe
try to limit above new created processes by below command line
question:
did miss I anything before launching procgov64?
The text was updated successfully, but these errors were encountered: