I’m curious why there are two separate IDs – dwProcessId and dwThreadId returned in the PROCESS_INFORMATION data structure when I call CreateProcess in win32 API programming?
In what cases would I use the dwThreadId? So far I haven’t found a use case. I only use the process id to identify the program that I started via CreateProcess.
Also I’m very curious why does Linux have just a pid (aka ProcessId) but Windows has both pid and threadid?
Every process has at least one thread. The thread id gives you the id of the first thread created for a process by the CreateProcess API. You can create more threads and they’d have id’s too.
They’re separate only because process ids are for processes and thread ids are for threads. I don’t think there’s much more to say about it!