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:
\_ bash -invoked by the system library function
\_command3 -invoked by bash
BTW, this sort of sounds like a homework assignment...