1.3.17 Processes and Threads

Win32 exposes processes and threads of execution within a process as objects. Functions exist to create, manipulate, and delete these objects.

A process object represents a virtual address space, a security profile (Windows NT only), a set of threads that execute in the address space of the process, and a set of resources or objects visible to all threads executing in the process. A thread object is the agent that executes program code. Each thread is associated with a process object which specifies the virtual address space mapping for the thread. Several thread objects can be associated with a single process object which enables the concurrent execution of multiple threads in a single address space (possible simultaneous execution in a multiprocessor system running Windows NT).

The process and thread functions include:

Function Description

CreateProcess Creates process and thread objects
CreateThread Creates an additional thread in an existing process
ExitProcess Exits the current process
ExitThread Exits the current thread
GetCurrentProcess Gets a process handle for the current process
GetCurrentProcessId Gets the process id for the current process
GetCurrentThread Gets a thread handle for the current thread
GetCurrentThreadId Gets the thread id for the current thread
GetProcessExitCode Gets the termination status for a process
GetThreadExitCode Gets the termination status for a thread
GetThreadPriority Gets the priority for a thread
GetThreadSelectorEntry  
OpenProcess Returns a handle to the process with the specified id
ResumeThread Resumes execution of a thread
SetThreadPriority Sets the priority for a thread
ShellExecute Executes a program.
Sleep Delays execution of the current thread for a specified time
SuspendThread Suspends execution of a thread
TerminateProcess Kills a process
TerminateThread Kills a thread
WaitForInputIdle Waits for a child process to reach GetMessage.
WinExec Executes a program.