Chapter 7 requires the student to extend previously
written programs in three interesting ways. In
Experiment 7.1 and 7.2 they rewrite previously
written programs to provide concurrency using
threads and processes respectively.
In 7.3 they build a multiservice server.
The degree of difficulty will depend heavily
on their previous work in operating systems.
If they have a solid background in forks and threads,
this chapter should not be too bad. One
factor that hindered me all the way through
was the inability of gdb
to
handle threads and forks. In Experiment 7.3
my server was not handling the echo function
although file transfer was fine. I got into
gdb
and stepped through the
fork
function. It returned values
such as 5040 and 5060,
that is, it seemed to return such values.
In fact, with any breakpoint set, the program
would never get to my echo handler, yet if you
just ran the program, even in gdb
,
it would reach that handler. Nasty!
I have found that the debugger that comes with Sun's
C compiler is much better at handling these complications.
Number 7 in Experiment 7.2 is absolutely
critical in my humble opinion. I thought that
I had written this server correctly, but it
failed at this point.
This site is maintained by W. David Laverell
of the Computer Science Department
at Calvin College. For assistance or corrections,
please contact him at .