Program that open new terminal window and executes command on it

So i have a program that im going to consider the "Control" program, whenever the Control program is executed i want Control to open up 3 new Terminal windows and i want the Control program to make the 3 terminals execute the same program called "Child Program" so there are 4 terminals in use, the Control Program and 3 instances of the Child program, so the user can move around the windows and execute difrrent things in the program, whenever the Control program is terminated the other windows should close aswell. How will i be able to make the Control program create 3 new gnome-terminal windows and make those terminal windows execute a program.
I don't know what kind of parameters "gnome-terminal" does accept, but when using "xterm" you execute any command inside its window with option "-e" as last one followed by the command name.

xterm -e "Child Program"

Your task could be simple done using a shell script but if you prefer C or C++ code, your "Control" program may fork() three child processes which run your "Child Program" using one of the exec() calls. Finally your parent process may wait for all of its childs and terminating after done.

"Control" may accept a signal handler (see signal(3)) which kills all its childs by sending an appropriate signal to pid 0.
Registered users can post here. Sign in or register to post.