Starting Programs from a C program in Linux
I have a C program running on Ubuntu that starts up a power supply for a period of time and then stops it. During this period I need to start some ancillary programs on the same linux machine that read some sensors. The main program, and the ancillary programs are quite independent and do not need further intercommunication. (e.g. I don't need to wait or interrogate status). This helps insure the main program, which is critical, keeps running regardless of the outcome of the ancillary ones.
--to put it simply, I want to start the ancillary tasks as though I entered them separately from the shell/keyboard that started the main task.
So my question is how to accomplish this. I am looking at system, spawn, fork and exec and it is not entirely clear form the posts here or the man pages which fits. It seems as though some of these will "wait" the calling tasks. Others will share memory etc. I think maybe fork is the way to go, but I never like this method as apparently you have to copy all the code form both main and ancillary task into the same program and then select/run the appropriate code. system will apparently make the ancillary programs subsidiary to the calling program.
Can someone point me to the best way to do this?
Thanks
Fritz