FAQ/Announcements for Lab3 from Nutt
Announcements:
- Set a schedule and stick to it!
- I would suggest that you complete Part A no later than Monday, December
3rd. This is a minor program in the end (see the FAQ below) but
completion of this will help you feel confident you are on the right track for
the final program. You may show me your code for this part for
confirmation if you like.
- I would suggest that you complete part B no later than Friday, December
8th. Again, this is a minor program in the end (assuming that you
completed part A successfully). In order to really test this one you
will need to add in a more complex process running between the set and get.
You may want to look ahead and steal the Fibonacci method from part c.
Again, you may show me your code for confirmation if you like.
- Part C (the only program I will actually collect) is due on Friday,
December 15th. I would heavily suggest using his skeleton program on
pages 93-95. If you have completed parts A and B successfully, then
filling in the gaps in his program should be almost trivial (more than
anything it will be time consuming considering the scope of variables that
need to be set and signal handlers that need to be copied/modified from the
earlier parts). Again, if you have done parts A and B, the hardest thing
about part C is setting up the children and parents properly, and that is all
in his skeleton code.
- When I test your program for part C, I will be providing the fibarg via the command line (as
implied in the skeleton code.) Make sure you set up your code to accept
this argument. You should set up your code to either error if I forget
this argument, or default to some preset value (25 or 30).
FAQ
Q: What does he mean in Part A when he says "implement your version of
gettimeofday()?" That isn't really described anywhere else in the chapter.
A: You are correct. What he really wants you to do is develop a
short program which uses ITIMER_REAL and the "signal" capabilities of C to
create a timer. I would suggest you modify the code on page 87 and 88 to
do this. However, instead of using the values used on those pages, you
will want to set up ITIMER_REAL to signal once per second. Put some dummy
process between the setitimer and getitimer calls (read a single character from
stdin) so that you have some control over how long between the time you start
the timer and read the timer. Since you will likely not provide input
before the timer goes off, you will also need to create your own signal handler
(see page 92 although your handler will not actually take a parameter) which
counts that it was signaled and resets itself.