Assignment 7
Read chapter 18 of the textbook and be able to answer the self-test
questions at the end of the chapter.
- Answer the non-programming exercises at the end of Das chapter
18.
- Do the following Self-Test. What was your score?
Molay, chapter 8 Self-test.
- Download ch18.zip with the examples from
chapter 18 of Das. Write a Makefile to compile all of the
programs. Demonstrate the use of signal.c,
signal2.c, and killprocess.c following the
example of the textbook.
- Write a signal handler that catches the SIGINT (CTRL-C) and SIGUSR1
signals. The parent process (your program) should never
exit on CTRL-C. You may want to look at the BLP alarm.c.
The following requirements apply:
- You should accumultate the handling of CTRL-C in the handler. That
is to say, you should have a variable counter accumulate each time the handler
is called, and print out the current count in the handler. For instance,
if you've hit CTRL-C 6 times, your handler should print out something to
the effect of "You've pressed Ctrl-C 6 times. Aren't you getting the
message that I'm invulnerable?"
- Your program should accept a command line argument that specifies
the MAXSTOPS allowed, after which, Ctrl-C is handled in the default way (i.e.,
the program terminates). So if the user passes in '10' on the command
line, the program prints out it's message above the first 9 times, but the
10th time CTRL-C is pressed, the default action applies (program termination).
- You should print out a message that states that your program received
the SIGUSR1 signal when it is handled. You should be able to issue
a kill command to send your program the SIGUSR1 signal, and have that signal
handled properly (by printing out a receipt notification) and then continue
to function and handle subsequent CTRL-C and SIGUSR1 signals.
- Modify the program forkdemo2.c from Molay, chapter 8
so that it also prints out the parent process ID for each forked
process. Use that information to build a tree showing the operation of
the program.
- Do exercises 8.6, 8.8 and 8.9 from Molay.
- Write a Qt program to show the predefined colors. Model your
output after the following example.
- Write Qt programs to show the brush and pen styles. Model your
output after the following examples.
or
- Write a Qt program to illustrate endcaps and joins. Here are
some examples to get you started.
 
and
- Write Qt programs to show the following geometric shapes, each
in a 300 x 200 window.
Maintained by John Loomis,
last updated 25 October 2006