Question: Write a C program called even.c that takes the input parameter n and prints the first n even numbers. We want the program to run

Write a C program called even.c that takes the input parameter n and prints the first ā€œnā€ even numbers. We want the program to run slowly, so that it executes long enough to receive a signal. To achieve this, you should place a sleep(5) after every print statement. Compile and run to test it works ok.

Most Unix systems will understand SIGHUP and SIGINT. Every signal has a default action associated with it, for example the default action for SIGINT is to terminate the process.

You should modify your even number program to handle the signals as follows:

  1. When it receives a HUP signal, it should print "Ouch!" and continue.
  2. When it receives a INT signal, it should print "Yeah!" and continue.

Step by Step Solution

3.42 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the modified C program evenc that handles SIGHUP and SIGINT signals C includ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Operating System Questions!