Platform SDK: DLLs, Processes, and Threads |
The JOBOBJECT_BASIC_LIMIT_INFORMATION structure contains basic limit information for a job object.
typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION { LARGE_INTEGER PerProcessUserTimeLimit; LARGE_INTEGER PerJobUserTimeLimit; DWORD LimitFlags; SIZE_T MinimumWorkingSetSize; SIZE_T MaximumWorkingSetSize; DWORD ActiveProcessLimit; ULONG_PTR Affinity; DWORD PriorityClass; DWORD SchedulingClass; } JOBOBJECT_BASIC_LIMIT_INFORMATION, *PJOBOBJECT_BASIC_LIMIT_INFORMATION;
The system periodically checks to determine whether each process associated with the job has accumulated more user-mode time than the set limit. If it has, the process is terminated.
The system periodically checks to determine whether the sum of the user-mode execution time for all processes is greater than this end-of-job limit. If it is, the action specified in the EndOfJobTimeAction member of the JOBOBJECT_END_OF_JOB_TIME_INFORMATION structure is carried out. By default, all processes are terminated and the status code is set to ERROR_NOT_ENOUGH_QUOTA.
Value | Meaning |
---|---|
JOB_OBJECT_LIMIT_ACTIVE_PROCESS | Establishes a maximum number of simultaneously active processes associated with the job. |
JOB_OBJECT_LIMIT_AFFINITY | Causes all processes associated with the job to use the same processor affinity. |
JOB_OBJECT_LIMIT_BREAKAWAY_OK | If any process associated with the job creates a child process using the CREATE_BREAKAWAY_FROM_JOB flag while this limit is in effect, the child process is not associated with the job.
This limit requires use of a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure. The BasicLimitInformation member is a JOBOBJECT_BASIC_LIMIT_INFORMATION structure. |
JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION | Forces a call to the SetErrorMode function with the SEM_NOGPFAULTERRORBOX flag for each process associated with the job.
If an exception occurs and the system calls the UnhandledExceptionFilter function, the debugger will be given a chance to act. If there is no debugger, the functions returns EXCEPTION_EXECUTE_HANDLER. Normally, this will cause termination of the process with the exception code as the exit status. |
JOB_OBJECT_LIMIT_JOB_MEMORY | Causes all processes associated with the job to limit the job-wide sum of their committed memory. When a process attempts to commit memory that would exceed the job-wide limit, it fails. If the job object is associated with a completion port, a JOB_OBJECT_MSG_JOB_MEMORY_LIMIT message is sent to the completion port. |
JOB_OBJECT_LIMIT_JOB_TIME | Establishes a user-mode execution time limit for the job. This flag cannot be used with JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME. |
JOB_OBJECT_LIMIT_PRIORITY_CLASS | Causes all processes associated with the job to use the same priority class. For more information, see Scheduling Priorities. |
JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME | Preserves any job time limits you previously set. As long as this flag is set, you can establish a per-job time limit once, then alter other limits in subsequent calls. This flag cannot be used with JOB_OBJECT_LIMIT_JOB_TIME. |
JOB_OBJECT_LIMIT_PROCESS_MEMORY | Causes all processes associated with the job to limit their committed memory. When a process attempts to commit memory that would exceed the per-process limit, it fails. If the job object is associated with a completion port, a JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT message is sent to the completion port. |
JOB_OBJECT_LIMIT_PROCESS_TIME | Establishes a user-mode execution time limit for each currently active process and for all future processes associated with the job. |
JOB_OBJECT_LIMIT_SCHEDULING_CLASS | Causes all processes in the job to use the same scheduling class. |
JOB_OBJECT_LIMIT_WORKINGSET | Causes all processes associated with the job to use the same minimum and maximum working set sizes. |
JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK | Allows any process associated with the job to create child processes that are not associated with the job.
This limit requires use of a JOBOBJECT_EXTENDED_LIMIT_INFORMATION structure. The BasicLimitInformation member is a JOBOBJECT_BASIC_LIMIT_INFORMATION structure. |
The valid values are 0 to 9. Use 0 for the least favorable scheduling class relative to other threads, and 9 for the most favorable scheduling class relative to other threads. By default, this value is 5. To use a scheduling class greater than 5, the calling process must enable the SE_INC_BASE_PRIORITY_NAME privilege.
Processes can still empty their working sets using the SetProcessWorkingSetSize function, even when JOB_OBJECT_LIMIT_WORKINGSET is used. However, you cannot use SetProcessWorkingSetSize to change the minimum or maximum working set size.
The system increments the active process count when you attempt to associate a process with a job. If the limit is exceeded, the system decrements the active process count only when the process terminates and all handles to the process are closed. Therefore, if you have an open handle to a process that has been terminated in such a manner, you cannot associate any new processes until the handle is closed and the active process count is below the limit.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Unsupported.
Header: Declared in Winnt.h; include Windows.h.
Processes and Threads Overview, Process and Thread Structures, GetProcessAffinityMask, JOBOBJECT_END_OF_JOB_TIME_INFORMATION, JOBOBJECT_EXTENDED_LIMIT_INFORMATION QueryInformationJobObject, SetInformationJobObject, SetProcessWorkingSetSize