Using Fork Pipe Signal Set C Program Uses Fork Create Two Processes Forking Create Registe Q37033893

Using fork, pipe and signal.

Set up a C program that uses fork to create two processes.Before forking, create and register

a signal handler for SIGUSR1 and/or SIGUSR2.

It will look something like:

#include <signal.h>

void handler(int isignal){/* C code goes here */}

signal(SIGUSR1, handler);

You’ll also want to create a pipe before you fork.

Use the pipe and signal to pass the client two numbers, have itadd them and pass the result

back to original process.

The forkee will probably look like:

{ for(;;) sleep(100);

}

and its signal handler will do the work.


Solution


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.