Search code examples
windowswinapiprocesspid

What is the maximum process Id on Windows?


What is the maximum process id I can get by calling DWORD GetProcessId(HANDLE) or DWORD GetCurrentProcessId()? It is not documented on the API's documentation page.


Solution

  • According to the Pushing the Limits of Windows: Processes and Threads blog post by Mark Russinovich number of processes is limited only by available memory. So theoretically maximum process id is DWORD_MAX aligned to 4: 0xFFFFFFFC (as pid/tid values are aligned to 4 on Windows).