Home > OS >  Help bosses! Linux programming a parent and child process!
Help bosses! Linux programming a parent and child process!

Time:09-24

According to the results of the program is running. Write a process of creating applications, requirements for: define variables var=50, creating the child process, the parent process to run, in the parent process: add var 5, using the alarm () function time 5 s, print the parent process id, parent for the child out of the rear can exit; In the child process: print the process id; Write to capture the signal function sig_alarm (), print the value of the variable var in the function, call the function process of Numbers and strings "SIGALRM" coming ", running the results are as follows (the following process, using the acquisition process, function) :
The parent pid=2279, var=50
The child process pid=2280, var=55
Var=55, pid=2279, SIGALRM "coming.
  • Related