The father forks as many children as the parameter given from the command line.The children after birth are paused and the father awakens them by sending signal.
./test 4 5 1 3 2
as posted above 4, 5, .... stand for child 4, child 5, ... I save them consecutively as they are posted from the command line in array for saving their indexes (for later usage...) and their pids in another array . I want to send the signal (the father wants) consecutively as cited in the command line
When in the fathers code I send kill(....) I "activate" each process one time. If i want to activate each process mutiple times for example 2, do I include the kill statment in a loop? I did try something like that:
1. Signal handlers are not a message queue. If you blast rapid signals, expect things to not happen.
2. Watch out for your signal handler being reset to SIG_DFL on the first signal. A second signal might not be caught as you expect. Look at using sigaction() for a much more defined approach to signal handling.
3. You have a very limited set of functions you can safely call inside a signal handler. http://man7.org/linux/man-pages/man7/signal-safety.7.html
printf() isn't one of them.
Whilst sleep() is valid, it's a very bad idea to needlessly delay a signal handler.