Not clear.
Note - using the "system" function will wait until the command given is processed.
To execute that command the parent process forks and executes the shell, which then processes the command.
So if that command then causes three commands to be executed (such as a pipe), then it will wait for the last of those commands to finsh.
So the process tree is:
Code:
your-program
\_ bash -invoked by the system library function
\_command3 -invoked by bash
\_command2
\_command1
BTW, this sort of sounds like a homework assignment...