What is the maximum process Id on Windows?

Shinjikun picture Shinjikun · Jul 25, 2013 · Viewed 18.3k times · Source

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.

Answer

Sergey Podobry picture Sergey Podobry · Jul 25, 2013

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).