NEXT UP previous
Next: Answers

Exercises

  1. Write a C program which traps all the signals (that can be trapped) and displays a suitable message when any signal is received by the process.

  2. Write a program which reads and displays characters typed at the keyboard. Set up an alarmO which will print a message if no characters are typed within a short space of time.

  3. Write a program to send SIGKILL signals to all of your running processes except your current shell (and the current process) based on the following shell script:

    	pidlist=`ps -aux | grep "^$LOGNAME" | grep -v $$ | \
    	    tr -s " " | cut -f 2 -d " "`
    	for pid in pidlist
    	do
    		kill -9 $pid >/dev/null 2>/dev/null 
    	done
    

NEXT UP previous
Next: Answers