Job Objects
Processes can be collected together into job objects where the processes can be
controlled as a group, resource limits can be specified for all the job object member
processes, and accounting information can be maintained. Job objects were
introduced with Windows 2000 and are supported in all NT5 systems.
The first step is to create an empty job object with
, which
takes two arguments, a name and security attributes, and returns a job object
handle. There is a lso an
function to use with a named object.
destroys the job object.
simply add s a process specified by a process
handle to a job object; there are just two parameters. A process cannot be a
member of more than one job, so
fails if the
process associated with the handle is already a member of some job. A process
that is added to a job inherits all the limits associated with the job and adds its
accounting information to the job, such as the processor time used.
By default, a new child process created with
will also belong
to the job unless the
flag is specified in the
argument to . In the default case,
will fail if you attempt to assign the child process to a job.
Finally, you can specify control limits on the processes in a job using

Get Windows System Programming Third Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.