Windows Processes and Job Objects in TCC
When Windows creates a new process, it doesn’t create a parent / child relationship with the new process. This means a new “child” processes will continue running after the “parent” process has ended. Usually that’s what we want – but sometimes we want a way to link the parent and child process(es) together. For example, we might need to be able to stop a child process and any additional processes that child process might have started. Or we might want to restrict the amount of memory or CPU time the child processes can use.
A Windows job object allows you to:
1. Associate multiple processes with a single job, so you can control them as a group
2. Place restrictions on a job’s processes, including:
· Limit the maximum amount of memory for a job (or each process)
· Limit the maximum CPU time for a job (or each process)
· Limit the maximum number of processes in a job
· Set the priority class for the job’s processes
· Limit a job’s access to UI elements, including the clipboard, user handles, desktops, etc.
· Prevent a job’s processes from logging out, rebooting, or shutting down
Prior to v21, there hasn’t been a way to do this in a batch file. V21 now allows you to create and monitor Windows job objects with two new commands:
JOBS creates new Windows jobs and optionally attaches processes to a job. (You can also start a process in a job with the “START /job=jobname” option.) You can specify limits for a new or existing job, or display the current limit info for the job.
JOBMONITOR monitors activity and notifications for the specified job, including:
· End of job
· New process creation
· Process exit
· Job or process memory limits
· Job or process exceeded CPU time limits
(Note that due to obvious Windows security issues a process cannot change its own job limits.)