Describe the functionality of each of the following system c

Describe the functionality of each of the following system calls:

a. kill(456, 0);

b. waitpid(-1,&status, 0);

c. raise(SIGUSR1);

Solution

a. kill(456,0): This is used to send any signal to any process group or process.
Here pid=456 and sig=0
Pid is positive. But sig is 0. So no signal will be sent to the process with pid 456.
But error checking is still performed; this can be used to check for the existence
of a process ID 456.

b. waitpid(-1,&status,0);
here pid=-1, status sig=status, options=0
if pid==-1, then it waits for any child process.
The waitpid() system call suspends execution of the calling process until a child process has changed state (waiting for termination).

c. raise(SIGUSR1);
The raise() function sends the signal sig to the running program.
Then the signal handler in the program will be executed.

Describe the functionality of each of the following system calls: a. kill(456, 0); b. waitpid(-1,&status, 0); c. raise(SIGUSR1);Solutiona. kill(456,0): This

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site