Quote:
Originally Posted by
fwrlfo
we asked to create a sender and receiver for a signals. sender knows his receiver by it's(receiver) PID .... my question is if i go to other computer and run my program will the pid chages than the first pid i got from old computer?
I think Jim thought you were confused about the difference between user IDs and process IDs (and you may be), but you also don't seem to understand the concept of a process ID.
When you run a command every utility invoked to run that command will get its own process ID. If you run the same command again, the process IDs of the utilities invoked will be different even if you run then on the same computer. If you want to send a signal to a process you need to know the process ID of the process to which you want to send the signal.
If you start a process in the background using your shell, the shell will give you the process ID of the last process in the pipeline you started. If you start a process in the foreground in a different window, you can use the
ps utility to find the process ID of running processes. If you write your own C program to invoke a sender and a receiver, the
fork() call that creates a new process will return the process ID of the newly created (receiver) process to the parent and you can then pass that process ID to the sender as an argument when you
exec the sender.
If you don't understand the properties of a process, this forum might not be the proper place for you to get started on the very basic underpinnings of the UNIX operating system.