Homework: 22C:178 & 055:134

Computer Communications Fall 1998

Assignment 1

[due 3 September]

For projects in this course, you will need to write programs that use (1) system calls, and (2) various forms of timers to monitor the efficiency of certain network operations. This assignment is to refresh your C skills and start to learn a few system calls.

One simple system call available using Linux and most unix systems is the gettimeofday function. Another less simple system service is the getitimer & setitimer pair of functions. There are yet other time-related system calls, and the command man -k time will display quite a number of them.

Two elementary programs illustrate some uses of gettimeofday and getitimer calls. The program reptime.c uses the gettimeofday call to report elapsed time in a program loop; the program reptimel.c also does this, but in a different way. To test these programs, follow these steps.

1.
Download this file and give it the name reptest.
2.
Then download reptime.c and reptimel.c
3.
Execute the command sh reptest, which should compile and execute the two C programs. If you have problems compiling and running these programs, please email the teaching assistant, Yu Chen, who will help diagnose the problem.
4.
Using man gettimeofday and man getitimer learn about the two system calls.
5.
Answer these questions:
Turning in your answers: Prepare an email answering the above questions. Mail the homework to herman@cs.uiowa.edu and specify in the subject line, the course number, the assignment number and the last four digits of your student ID number (we are hoping that four digits will be unique). So, for example if your student number is 123456789, then the subject line of your email should be:
178 homework 1, student 6789
If you do not have such a subject line, I will bounce your letter back to you and ask for a resubmission of the homework.