Results 1 to 7 of 7
I have a question regarding how to keep track of the process which started from one process, and able to communicate to it, then kill it if necessary.
Currently, the ...
- 08-04-2005 #1Just Joined!
- Join Date
- Aug 2005
- Posts
- 19
linux c/c++ code to start/kill the process
I have a question regarding how to keep track of the process which started from one process, and able to communicate to it, then kill it if necessary.
Currently, the easiest way is use the system() call to start the process, but no PID can be track, impossible to kill it.
Any good idea of how to handle the process.
- 08-04-2005 #2
why not use fork()? That will return a PID you can use to monitor the child process.
http://www.cs.bsu.edu/homepages/fwo/cgi-bin/man.pl?forkRegistered Linux user #270181
TechieMoe's Tech Rants
- 08-04-2005 #3Linux Enthusiast
- Join Date
- Jan 2005
- Posts
- 575
Re: linux c/c++ code to start/kill the process
What kind of communication do you want to do ?
Originally Posted by dragondad
By the way apart from fork check out also execve
- 08-05-2005 #4Just Joined!
- Join Date
- Aug 2005
- Posts
- 19
high level abstraction layer of process management
Actually, I need to do some kind of process management from the main process, when main process parse the config file, it will determine how to start each sub process (to handle different task), each process should able to be started and killed individually, and need the communication channel (such as pipe or message queue) between the main process and the subprocess.
Any suggestion of the framework or process management package can be used. Thanks.
- 08-05-2005 #5Linux Enthusiast
- Join Date
- Jan 2005
- Posts
- 575
For pipes check out man 3 mkfifo
For killing them man 2 kill
- 08-06-2005 #6Just Joined!
- Join Date
- Jul 2005
- Posts
- 28
Have a look into linux threads. I think it's not wise to start different processes for a single program, and ofcourse you can share normal datas such as C variables.
- 09-09-2007 #7Just Joined!
- Join Date
- Sep 2007
- Posts
- 1
Kemo
You can use getpid(), it will return current process id.
Use getppid(), it will return parent process id.
For process and threads communications you can use shared memory. It is much easier, much faster. Search for it, if you didn't find anything useful ask again and i'll post useful things for you.



