- About Processes and Threads
- Windows Kernel-Mode Process and Thread Manager
- Subsystem Processes
- Creating Threads
- Process and Thread Functions
- Dispatch Queue Function
- Process Functions
- Process Enumeration Functions
- Policy Functions
- Thread Functions
- Process and Thread Extended Attribute Functions
- WOW64 Functions
- Job Object Functions
- Thread Pool Functions
- Thread Ordering Service Functions
- Multimedia Class Scheduler Service Functions
- Fiber Functions
- NUMA Support Functions
- Processor Functions
- User-Mode Scheduling Functions
About Processes and Threads
Each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, thread local storage, a unique thread identifier, and a set of structures the system will use to save the thread context until it is scheduled. The thread context includes the thread’s set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread’s process. Threads can also have their own security context, which can be used for impersonating clients.
Microsoft Windows supports preemptive multitasking, which creates the effect of simultaneous execution of multiple threads from multiple processes. On a multiprocessor computer, the system can simultaneously execute as many threads as there are processors on the computer.
A job object allows groups of processes to be managed as a unit. Job objects are namable, securable, sharable objects that control attributes of the processes associated with them. Operations performed on the job object affect all processes associated with the job object.
An application can use the thread pool to reduce the number of application threads and provide management of the worker threads. Applications can queue work items, associate work with waitable handles, automatically queue based on a timer, and bind with I/O.
User-mode scheduling (UMS) is a lightweight mechanism that applications can use to schedule their own threads. An application can switch between UMS threads in user mode without involving the system scheduler and regain control of the processor if a UMS thread blocks in the kernel. Each UMS thread has its own thread context instead of sharing the thread context of a single thread. The ability to switch between threads in user mode makes UMS more efficient than thread pools for short-duration work items that require few system calls.
A fiber is a unit of execution that must be manually scheduled by the application. Fibers run in the context of the threads that schedule them. Each thread can schedule multiple fibers. In general, fibers do not provide advantages over a well-designed multithreaded application. However, using fibers can make it easier to port applications that were designed to schedule their own threads.
For more information, see the following topics:
Windows Kernel-Mode Process and Thread Manager
A process is a software program that is currently running in Windows. Every process has an ID, a number that identifies it. A thread is an object that identifies which part of the program is running. Each thread has an ID, a number that identifies it.
A process may have more than one thread. The purpose of a thread is to allocate processor time. On a machine with one processor, more than one thread can be allocated, but only one thread can run at a time. Each thread only runs a short time and then the execution is passed on to the next thread, giving the user the illusion that more than one thing is happening at once. On a machine with more than one processor, true multi-threading can take place. If an application has multiple threads, the threads can run simultaneously on different processors.
The Windows kernel-mode process and thread manager handles the execution of all threads in a process. Whether you have one processor or more, great care must be taken in driver programming to make sure that all threads of your process are designed so that no matter what order the threads are handled, your driver will operate properly.
If threads from different processes attempt to use the same resource at the same time, problems can occur. Windows provides several techniques to avoid this problem. The technique of making sure that threads from different processes do not touch the same resource is called synchronization. For more information about synchronization, see Synchronization Techniques.
Routines that provide a direct interface to the process and thread manager are usually prefixed with the letters «Ps«; for example, PsCreateSystemThread. For a list of kernel DDIs, see Windows kernel.
This set of guidelines applies to these callback routines:
- Keep routines short and simple.
- Do not make calls into a user mode service to validate the process, thread, or image.
- Do not make registry calls.
- Do not make blocking and/or Interprocess Communication (IPC) function calls.
- Do not synchronize with other threads because it can lead to reentrancy deadlocks.
- Use System Worker Threads to queue work especially work involving:
- Slow API’s or API’s that call into other process.
- Any blocking behavior which could interrupt threads in core services.
- If you use System Worker Threads do not wait on the work to complete. Doing so defeats the purpose of queuing the work to be completed asynchronously.
- Be considerate of best practices for kernel mode stack usage. For examples, see How do I keep my driver from running out of kernel-mode stack? and Key Driver Concepts and Tips.
Subsystem Processes
Starting in WindowsВ 10, the Windows Subsystem for Linux (WSL) enables a user to run native Linux ELF64 binaries on Windows, alongside other Windows applications. For information about WSL architecture and the user-mode and kernel-mode components that are required to run the binaries, see the posts on the Windows Subsystem for Linux blog.
One of the components is a subsystem process that hosts the unmodified user-mode Linux binary, such as /bin/bash. Subsystem processes do not contain data structures associated with Win32 processes, such as Process Environment Block (PEB) and Thread Environment Block (TEB). For a subsystem process, system calls and user mode exceptions are dispatched to a paired driver.
Here are the changes to the Process and Thread Manager Routines in order to support subsystem processes:
- The WSL type is indicated by the SubsystemInformationTypeWSL value in the SUBSYSTEM_INFORMATION_TYPE enumeration. Drivers can call NtQueryInformationProcess and NtQueryInformationThread to determine the underlying subsystem. Those calls return SubsystemInformationTypeWSL for WSL.
- Other kernel mode drivers can get notified about subsystem process creation/deletion by registering their callback routine through the PsSetCreateProcessNotifyRoutineEx2 call. To get notifications about thread creation/deletion, drivers can call PsSetCreateThreadNotifyRoutineEx, and specify PsCreateThreadNotifySubsystems as the type of notification.
- The PS_CREATE_NOTIFY_INFO structure has been extended to include a IsSubsystemProcess member that indicates a subsystem other than Win32. Other members such as FileObject, ImageFileName, CommandLine indicate additional information about the subsystem process. For information about the behavior of those members, see SUBSYSTEM_INFORMATION_TYPE.
—>
Creating Threads
The CreateThread function creates a new thread for a process. The creating thread must specify the starting address of the code that the new thread is to execute. Typically, the starting address is the name of a function defined in the program code (for more information, see ThreadProc). This function takes a single parameter and returns a DWORD value. A process can have multiple threads simultaneously executing the same function.
The following is a simple example that demonstrates how to create a new thread that executes the locally defined function, MyThreadFunction .
The calling thread uses the WaitForMultipleObjects function to persist until all worker threads have terminated. The calling thread blocks while it is waiting; to continue processing, a calling thread would use WaitForSingleObject and wait for each worker thread to signal its wait object. Note that if you were to close the handle to a worker thread before it terminated, this does not terminate the worker thread. However, the handle will be unavailable for use in subsequent function calls.
The MyThreadFunction function avoids the use of the C run-time library (CRT), as many of its functions are not thread-safe, particularly if you are not using the multithreaded CRT. If you would like to use the CRT in a ThreadProc function, use the _beginthreadex function instead.
It is risky to pass the address of a local variable if the creating thread exits before the new thread, because the pointer becomes invalid. Instead, either pass a pointer to dynamically allocated memory or make the creating thread wait for the new thread to terminate. Data can also be passed from the creating thread to the new thread using global variables. With global variables, it is usually necessary to synchronize access by multiple threads. For more information about synchronization, see Synchronizing Execution of Multiple Threads.
The creating thread can use the arguments to CreateThread to specify the following:
- The security attributes for the handle to the new thread. These security attributes include an inheritance flag that determines whether the handle can be inherited by child processes. The security attributes also include a security descriptor, which the system uses to perform access checks on all subsequent uses of the thread’s handle before access is granted.
- The initial stack size of the new thread. The thread’s stack is allocated automatically in the memory space of the process; the system increases the stack as needed and frees it when the thread terminates. For more information, see Thread Stack Size.
- A creation flag that enables you to create the thread in a suspended state. When suspended, the thread does not run until the ResumeThread function is called.
You can also create a thread by calling the CreateRemoteThread function. This function is used by debugger processes to create a thread that runs in the address space of the process being debugged.
Process and Thread Functions
This topic describes the process and thread functions.
Dispatch Queue Function
The following function creates a DispatcherQueueController.
Function | Description |
---|---|
CreateDispatcherQueueController | Creates a DispatcherQueueController which manages the lifetime of a DispatcherQueue that runs queued tasks in priority order on another thread. |
Process Functions
The following functions are used with processes.
Function | Description |
---|---|
CreateProcess | Creates a new process and its primary thread. |
CreateProcessAsUser | Creates a new process and its primary thread. The new process runs in the security context of the user represented by the specified token. |
CreateProcessWithLogonW | Creates a new process and its primary thread. The new process then runs the specified executable file in the security context of the specified credentials (user, domain, and password). |
CreateProcessWithTokenW | Creates a new process and its primary thread. The new process runs in the security context of the specified token. |
ExitProcess | Ends the calling process and all its threads. |
FlushProcessWriteBuffers | Flushes the write queue of each processor that is running a thread of the current process. |
FreeEnvironmentStrings | Frees a block of environment strings. |
GetCommandLine | Retrieves the command-line string for the current process. |
GetCurrentProcess | Retrieves a pseudo handle for the current process. |
GetCurrentProcessId | Retrieves the process identifier of the calling process. |
GetCurrentProcessorNumber | Retrieves the number of the processor the current thread was running on during the call to this function. |
GetEnvironmentStrings | Retrieves the environment block for the current process. |
GetEnvironmentVariable | Retrieves the value of the specified variable from the environment block of the calling process. |
GetExitCodeProcess | Retrieves the termination status of the specified process. |
GetGuiResources | Retrieves the count of handles to graphical user interface (GUI) objects in use by the specified process. |
GetLogicalProcessorInformation | Retrieves information about logical processors and related hardware. |
GetPriorityClass | Retrieves the priority class for the specified process. |
GetProcessAffinityMask | Retrieves a process affinity mask for the specified process and the system affinity mask for the system. |
GetProcessGroupAffinity | Retrieves the processor group affinity of the specified process. |
GetProcessHandleCount | Retrieves the number of open handles that belong to the specified process. |
GetProcessId | Retrieves the process identifier of the specified process. |
GetProcessIdOfThread | Retrieves the process identifier of the process associated with the specified thread. |
GetProcessIoCounters | Retrieves accounting information for all I/O operations performed by the specified process. |
GetProcessMitigationPolicy | Retrieves mitigation policy settings for the calling process. |
GetProcessPriorityBoost | Retrieves the priority boost control state of the specified process. |
GetProcessShutdownParameters | Retrieves shutdown parameters for the currently calling process. |
GetProcessTimes | Retrieves timing information about for the specified process. |
GetProcessVersion | Retrieves the major and minor version numbers of the system on which the specified process expects to run. |
GetProcessWorkingSetSize | Retrieves the minimum and maximum working set sizes of the specified process. |
GetProcessWorkingSetSizeEx | Retrieves the minimum and maximum working set sizes of the specified process. |
GetProcessorSystemCycleTime | Retrieves the cycle time each processor in the specified group spent executing deferred procedure calls (DPCs) and interrupt service routines (ISRs). |
GetStartupInfo | Retrieves the contents of the STARTUPINFO structure that was specified when the calling process was created. |
IsImmersiveProcess | Determines whether the process belongs to a Windows Store app. |
NeedCurrentDirectoryForExePath | Determines whether the current directory should be included in the search path for the specified executable. |
OpenProcess | Opens an existing local process object. |
QueryFullProcessImageName | Retrieves the full name of the executable image for the specified process. |
QueryProcessAffinityUpdateMode | Retrieves the affinity update mode of the specified process. |
QueryProcessCycleTime | Retrieves the sum of the cycle time of all threads of the specified process. |
SetEnvironmentVariable | Sets the value of an environment variable for the current process. |
SetPriorityClass | Sets the priority class for the specified process. |
SetProcessAffinityMask | Sets a processor affinity mask for the threads of a specified process. |
SetProcessAffinityUpdateMode | Sets the affinity update mode of the specified process. |
SetProcessInformation | Sets information for the specified process. |
SetProcessMitigationPolicy | Sets the mitigation policy for the calling process. |
SetProcessPriorityBoost | Disables the ability of the system to temporarily boost the priority of the threads of the specified process. |
SetProcessRestrictionExemption | Exempts the calling process from restrictions preventing desktop processes from interacting with the Windows Store app environment. This function is used by development and debugging tools. |
SetProcessShutdownParameters | Sets shutdown parameters for the currently calling process. |
SetProcessWorkingSetSize | Sets the minimum and maximum working set sizes for the specified process. |
SetProcessWorkingSetSizeEx | Sets the minimum and maximum working set sizes for the specified process. |
TerminateProcess | Terminates the specified process and all of its threads. |
Process Enumeration Functions
The following functions are used to enumerate processes.
Function | Description |
---|---|
EnumProcesses | Retrieves the process identifier for each process object in the system. |
Process32First | Retrieves information about the first process encountered in a system snapshot. |
Process32Next | Retrieves information about the next process recorded in a system snapshot. |
WTSEnumerateProcesses | Retrieves information about the active processes on the specified terminal server. |
Policy Functions
The following functions are used with process wide policy.
Function | Description |
QueryProtectedPolicy | Queries the value associated with a protected policy. |
SetProtectedPolicy | Sets a protected policy. |
Thread Functions
The following functions are used with threads.
Function | Description |
---|---|
AttachThreadInput | Attaches the input processing mechanism of one thread to that of another thread. |
CreateRemoteThread | Creates a thread that runs in the virtual address space of another process. |
CreateRemoteThreadEx | Creates a thread that runs in the virtual address space of another process and optionally specifies extended attributes such as processor group affinity. |
CreateThread | Creates a thread to execute within the virtual address space of the calling process. |
ExitThread | Ends the calling thread. |
GetCurrentThread | Retrieves a pseudo handle for the current thread. |
GetCurrentThreadId | Retrieves the thread identifier of the calling thread. |
GetExitCodeThread | Retrieves the termination status of the specified thread. |
GetThreadDescription | Retrieves the description that was assigned to a thread by calling SetThreadDescription. |
GetThreadGroupAffinity | Retrieves the processor group affinity of the specified thread. |
GetThreadId | Retrieves the thread identifier of the specified thread. |
GetThreadIdealProcessorEx | Retrieves the processor number of the ideal processor for the specified thread. |
GetThreadInformation | Retrieves information about the specified thread. |
GetThreadIOPendingFlag | Determines whether a specified thread has any I/O requests pending. |
GetThreadPriority | Retrieves the priority value for the specified thread. |
GetThreadPriorityBoost | Retrieves the priority boost control state of the specified thread. |
GetThreadTimes | Retrieves timing information for the specified thread. |
OpenThread | Opens an existing thread object. |
QueryIdleProcessorCycleTime | Retrieves the cycle time for the idle thread of each processor in the system. |
QueryThreadCycleTime | Retrieves the cycle time for the specified thread. |
ResumeThread | Decrements a thread’s suspend count. |
SetThreadAffinityMask | Sets a processor affinity mask for the specified thread. |
SetThreadDescription | Assigns a description to a thread. |
SetThreadGroupAffinity | Sets the processor group affinity for the specified thread. |
SetThreadIdealProcessor | Specifies a preferred processor for a thread. |
SetThreadIdealProcessorEx | Sets the ideal processor for the specified thread and optionally retrieves the previous ideal processor. |
SetThreadInformation | Sets information for the specified thread. |
SetThreadPriority | Sets the priority value for the specified thread. |
SetThreadPriorityBoost | Disables the ability of the system to temporarily boost the priority of a thread. |
SetThreadStackGuarantee | Sets the stack guarantee for the calling thread. |
Sleep | Suspends the execution of the current thread for a specified interval. |
SleepEx | Suspends the current thread until the specified condition is met. |
SuspendThread | Suspends the specified thread. |
SwitchToThread | Causes the calling thread to yield execution to another thread that is ready to run on the current processor. |
TerminateThread | Terminates a thread. |
ThreadProc | An application-defined function that serves as the starting address for a thread. |
TlsAlloc | Allocates a thread local storage (TLS) index. |
TlsFree | Releases a TLS index. |
TlsGetValue | Retrieves the value in the calling thread’s TLS slot for a specified TLS index. |
TlsSetValue | Stores a value in the calling thread’s TLS slot for a specified TLS index. |
WaitForInputIdle | Waits until the specified process is waiting for user input with no input pending, or until the time-out interval has elapsed. |
Process and Thread Extended Attribute Functions
The following functions are used to set extended attributes for process and thread creation.
Function | Description |
---|---|
DeleteProcThreadAttributeList | Deletes the specified list of attributes for process and thread creation. |
InitializeProcThreadAttributeList | Initializes the specified list of attributes for process and thread creation. |
UpdateProcThreadAttribute | Updates the specified attribute in the specified list of attributes for process and thread creation. |
WOW64 Functions
The following functions are used with WOW64.
Function | Description |
---|---|
IsWow64Message | Determines whether the last message read from the current thread’s queue originated from a WOW64 process. |
IsWow64Process | Determines whether the specified process is running under WOW64. |
IsWow64Process2 | Determines whether the specified process is running under WOW64; also returns additional machine process and architecture information. |
Wow64SuspendThread | Suspends the specified WOW64 thread. |
Job Object Functions
The following functions are used with job objects.
Function | Description |
---|---|
AssignProcessToJobObject | Associates a process with an existing job object. |
CreateJobObject | Creates or opens a job object. |
IsProcessInJob | Determines whether the process is running in the specified job. |
OpenJobObject | Opens an existing job object. |
QueryInformationJobObject | Retrieves limit and job state information from the job object. |
SetInformationJobObject | Set limits for a job object. |
TerminateJobObject | Terminates all processes currently associated with the job. |
UserHandleGrantAccess | Grants or denies access to a handle to a User object to a job that has a user-interface restriction. |
Thread Pool Functions
The following functions are used with thread pools.
Function | Description |
---|---|
CallbackMayRunLong | Indicates that the callback may not return quickly. |
CancelThreadpoolIo | Cancels the notification from the StartThreadpoolIo function. |
CloseThreadpool | Closes the specified thread pool. |
CloseThreadpoolCleanupGroup | Closes the specified cleanup group. |
CloseThreadpoolCleanupGroupMembers | Releases the members of the specified cleanup group, waits for all callback functions to complete, and optionally cancels any outstanding callback functions. |
CloseThreadpoolIo | Releases the specified I/O completion object. |
CloseThreadpoolTimer | Releases the specified timer object. |
CloseThreadpoolWait | Releases the specified wait object. |
CloseThreadpoolWork | Releases the specified work object. |
CreateThreadpool | Allocates a new pool of threads to execute callbacks. |
CreateThreadpoolCleanupGroup | Creates a cleanup group that applications can use to track one or more thread pool callbacks. |
CreateThreadpoolIo | Creates a new I/O completion object. |
CreateThreadpoolTimer | Creates a new timer object. |
CreateThreadpoolWait | Creates a new wait object. |
CreateThreadpoolWork | Creates a new work object. |
DestroyThreadpoolEnvironment | Deletes the specified callback environment. Call this function when the callback environment is no longer needed for creating new thread pool objects. |
DisassociateCurrentThreadFromCallback | Removes the association between the currently executing callback function and the object that initiated the callback. The current thread will no longer count as executing a callback on behalf of the object. |
FreeLibraryWhenCallbackReturns | Specifies the DLL that the thread pool will unload when the current callback completes. |
InitializeThreadpoolEnvironment | Initializes a callback environment. |
IsThreadpoolTimerSet | Determines whether the specified timer object is currently set. |
LeaveCriticalSectionWhenCallbackReturns | Specifies the critical section that the thread pool will release when the current callback completes. |
QueryThreadpoolStackInformation | Retrieves the stack reserve and commit sizes for threads in the specified thread pool. |
ReleaseMutexWhenCallbackReturns | Specifies the mutex that the thread pool will release when the current callback completes. |
ReleaseSemaphoreWhenCallbackReturns | Specifies the semaphore that the thread pool will release when the current callback completes. |
SetEventWhenCallbackReturns | Specifies the event that the thread pool will set when the current callback completes. |
SetThreadpoolCallbackCleanupGroup | Associates the specified cleanup group with the specified callback environment. |
SetThreadpoolCallbackLibrary | Ensures that the specified DLL remains loaded as long as there are outstanding callbacks. |
SetThreadpoolCallbackPersistent | Specifies that the callback should run on a persistent thread. |
SetThreadpoolCallbackPool | Sets the thread pool to be used when generating callbacks. |
SetThreadpoolCallbackPriority | Specifies the priority of a callback function relative to other work items in the same thread pool. |
SetThreadpoolCallbackRunsLong | Indicates that callbacks associated with this callback environment may not return quickly. |
SetThreadpoolStackInformation | Sets the stack reserve and commit sizes for new threads in the specified thread pool. |
SetThreadpoolThreadMaximum | Sets the maximum number of threads that the specified thread pool can allocate to process callbacks. |
SetThreadpoolThreadMinimum | Sets the minimum number of threads that the specified thread pool must make available to process callbacks. |
SetThreadpoolTimerEx | Sets the timer object. A worker thread calls the timer object’s callback after the specified timeout expires. |
SetThreadpoolTimer | Sets the timer object. A worker thread calls the timer object’s callback after the specified timeout expires. |
SetThreadpoolWait | Sets the wait object. A worker thread calls the wait object’s callback function after the handle becomes signaled or after the specified timeout expires. |
SetThreadpoolWaitEx | Sets the wait object. A worker thread calls the wait object’s callback function after the handle becomes signaled or after the specified timeout expires. |
StartThreadpoolIo | Notifies the thread pool that I/O operations may possibly begin for the specified I/O completion object. A worker thread calls the I/O completion object’s callback function after the operation completes on the file handle bound to this object. |
SubmitThreadpoolWork | Posts a work object to the thread pool. A worker thread calls the work object’s callback function. |
TpInitializeCallbackEnviron | Initializes a callback environment for the thread pool. |
TpDestroyCallbackEnviron | Deletes the specified callback environment. Call this function when the callback environment is no longer needed for creating new thread pool objects. |
TpSetCallbackActivationContext | Assigns an activation context to the callback environment. |
TpSetCallbackCleanupGroup | Associates the specified cleanup group with the specified callback environment. |
TpSetCallbackFinalizationCallback | Indicates a function to call when the callback environment is finalized. |
TpSetCallbackLongFunction | Indicates that callbacks associated with this callback environment may not return quickly. |
TpSetCallbackNoActivationContext | Indicates that the callback environment has no activation context. |
TpSetCallbackPersistent | Specifies that the callback should run on a persistent thread. |
TpSetCallbackPriority | Specifies the priority of a callback function relative to other work items in the same thread pool. |
TpSetCallbackRaceWithDll | Ensures that the specified DLL remains loaded as long as there are outstanding callbacks. |
TpSetCallbackThreadpool | Assigns a thread pool to a callback environment. |
TrySubmitThreadpoolCallback | Requests that a thread pool worker thread call the specified callback function. |
WaitForThreadpoolIoCallbacks | Waits for outstanding I/O completion callbacks to complete and optionally cancels pending callbacks that have not yet started to execute. |
WaitForThreadpoolTimerCallbacks | Waits for outstanding timer callbacks to complete and optionally cancels pending callbacks that have not yet started to execute. |
WaitForThreadpoolWaitCallbacks | Waits for outstanding wait callbacks to complete and optionally cancels pending callbacks that have not yet started to execute. |
WaitForThreadpoolWorkCallbacks | Waits for outstanding work callbacks to complete and optionally cancels pending callbacks that have not yet started to execute. |
The following functions are part of the original thread pooling API.
Function | Description |
---|---|
BindIoCompletionCallback | Associates the I/O completion port owned by the thread pool with the specified file handle. On completion of an I/O request involving this file, a non-I/O worker thread will execute the specified callback function. |
QueueUserWorkItem | Queues a work item to a worker thread in the thread pool. |
RegisterWaitForSingleObject | Directs a wait thread in the thread pool to wait on the object. |
UnregisterWaitEx | Waits until one or all of the specified objects are in the signaled state or the time-out interval elapses. |
Thread Ordering Service Functions
The following functions are used with the thread ordering service.
Function | Description |
---|---|
AvQuerySystemResponsiveness | Retrieves the system responsiveness setting used by the multimedia class scheduler service. |
AvRtCreateThreadOrderingGroup | Creates a thread ordering group. |
AvRtCreateThreadOrderingGroupEx | Creates a thread ordering group and associates the server thread with a task. |
AvRtDeleteThreadOrderingGroup | Deletes the specified thread ordering group created by the caller. |
AvRtJoinThreadOrderingGroup | Joins client threads to a thread ordering group. |
AvRtLeaveThreadOrderingGroup | Enables client threads to leave a thread ordering group. |
AvRtWaitOnThreadOrderingGroup | Enables client threads of a thread ordering group to wait until they should execute. |
Multimedia Class Scheduler Service Functions
The following functions are used with the multimedia class scheduler service.
Function | Description |
---|---|
AvRevertMmThreadCharacteristics | Indicates that a thread is no longer performing work associated with the specified task. |
AvSetMmMaxThreadCharacteristics | Associates the calling thread with the specified tasks. |
AvSetMmThreadCharacteristics | Associates the calling thread with the specified task. |
AvSetMmThreadPriority | Adjusts the thread priority of the calling thread relative to other threads performing the same task. |
Fiber Functions
The following functions are used with fibers.
Function | Description |
---|---|
ConvertFiberToThread | Converts the current fiber into a thread. |
ConvertThreadToFiber | Converts the current thread into a fiber. |
ConvertThreadToFiberEx | Converts the current thread into a fiber. |
CreateFiber | Allocates a fiber object, assigns it a stack, and sets up execution to begin at the specified start address. |
CreateFiberEx | Allocates a fiber object, assigns it a stack, and sets up execution to begin at the specified start address. |
DeleteFiber | Deletes an existing fiber. |
FiberProc | An application-defined function used with the CreateFiber function. |
FlsAlloc | Allocates a fiber local storage (FLS) index. |
FlsFree | Releases an FLS index. |
FlsGetValue | Retrieves the value in the calling fiber’s FLS slot for a specified FLS index. |
FlsSetValue | Stores a value in the calling fiber’s FLS slot for a specified FLS index. |
IsThreadAFiber | Determines whether the current thread is a fiber. |
SwitchToFiber | Schedules a fiber. |
NUMA Support Functions
The following functions provide NUMA support.
Function | Description |
---|---|
AllocateUserPhysicalPagesNuma | Reserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory. |
GetLogicalProcessorInformation | Retrieves information about logical processors and related hardware. |
GetNumaAvailableMemoryNode | Retrieves the amount of memory available in the specified node. |
GetNumaAvailableMemoryNodeEx | Retrieves the amount of memory that is available in the specified node as a USHORT value. |
GetNumaHighestNodeNumber | Retrieves the node that currently has the highest number. |
GetNumaNodeNumberFromHandle | Retrieves the NUMA node associated with the underlying device for a file handle. |
GetNumaNodeProcessorMask | Retrieves the processor mask for the specified node. |
GetNumaNodeProcessorMaskEx | Retrieves the processor mask for the specified NUMA node as a USHORT value. |
GetNumaProcessorNode | Retrieves the node number for the specified processor. |
GetNumaProcessorNodeEx | Retrieves the node number of the specified logical processor as a USHORT value. |
GetNumaProximityNode | Retrieves the node number for the specified proximity identifier. |
GetNumaProximityNodeEx | Retrieves the node number as a USHORT value for the specified proximity identifier. |
VirtualAllocExNuma | Reserves or commits a region of memory within the virtual address space of the specified process, and specifies the NUMA node for the physical memory. |
Processor Functions
The following functions are used with logical processors and processor groups.
Function | Description |
---|---|
GetActiveProcessorCount | Returns the number of active processors in a processor group or in the system. |
GetActiveProcessorGroupCount | Returns the number of active processor groups in the system. |
GetCurrentProcessorNumber | Retrieves the number of the processor the current thread was running on during the call to this function. |
GetCurrentProcessorNumberEx | Retrieves the processor group and number of the logical processor in which the calling thread is running. |
GetLogicalProcessorInformation | Retrieves information about logical processors and related hardware. |
GetLogicalProcessorInformationEx | Retrieves information about the relationships of logical processors and related hardware. |
GetMaximumProcessorCount | Returns the maximum number of logical processors that a processor group or the system can have. |
GetMaximumProcessorGroupCount | Returns the maximum number of processor groups that the system can have. |
QueryIdleProcessorCycleTime | Retrieves the cycle time for the idle thread of each processor in the system. |
QueryIdleProcessorCycleTimeEx | Retrieves the accumulated cycle time for the idle thread on each logical processor in the specified processor group. |
User-Mode Scheduling Functions
The following functions are used with user-mode scheduling (UMS).