Homework Assignments: 22C:178 & 055:134

Computer Communications Spring 1998

Assignment 2

[23 January]

Later in the semester, 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 also the HP system is the gettimeofday function. Another less simple system service is the getitimer & setitimer pair of functions. These two calls are also available on HP systems. 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.

Download this file and give it the name reptest.
Then download reptime.c and reptimel.c
Execute the command sh reptest, which should compile and execute the two C programs.
Using man gettimeofday and man getitimer learn about the two system calls.
Answer these questions:

Ted Herman