syntax for kill is:- kill(pid,signal) here pid is the process id of process you want to kill .To execute this you have to define the signal handler for the signal you want to handle in th process(having the process id =pid)otherwise default action(i.e termination of process) will take place
1) an invalid signal is specified. 2) the pid doesn't exist ( its a zombie process ). 3) the process doesn't have the permission to send a signal to the target process.
Kill can be used between any two processes related or unrelated as long as you have the target process's pid.
For related processes the pid of the child is returned while forking it and the pid of the parent is obtained using getppid().
For unrelated processes you will have to pass the pid of the process you want to kill via a structure accessible to both processes like we pass the request of the client to the server, you can pass the pid of the process you want to kill from the server.