1

When analyzing the process tree in C++, POSIX allows you to prune it using group ID. Several processes may be added to a particular group.

Eg. see the following POSIX function.

add my process to a group

Does Windows have an equivalent of the above? I would like to assign a bunch of processes I own to a group, and then control the group as a whole.

Eg.

kill all processes in my group

The Vivandiere
  • 3,059
  • 3
  • 28
  • 50
  • Perhaps https://learn.microsoft.com/en-us/windows/win32/procthread/processor-groups ? – Severin Pappadeux Dec 29 '22 at 21:51
  • 3
    @SeverinPappadeux - "Processor Groups" is not the same thing as "Process Groups". The former is about managing scheduling on CPU cores. Not the same thing as what the OP is asking about. – selbie Dec 29 '22 at 22:56
  • Why must Windows have the equivalent? Moreover, as @Artyer answered, [Job objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects) have the same function. – YangXiaoPo-MSFT Jan 05 '23 at 08:05

1 Answers1

2

Windows has process groups which each newly created child process is added to unless it is created with the CREATE_NEW_PROCESS_GROUP flag. This is only useful for the GenerateConsoleCtrlEvent function as far as I know.

Job objects might be more useful to you. For example, you can kill all process associated with a given job with TerminateJobObject.

Artyer
  • 31,034
  • 3
  • 47
  • 75