The assignment is due at the beginning of class on Wednesday, November 17. Please follow the instructions in submitting your assignment.
#define SNOOZE_TIME 150000 int main() { bigtime_t start, elapsed_time; /* set own thread priority */ set_thread_priority(find_thread(NULL), 120); for (;;) { start = system_time(); snooze(SNOOZE_TIME); elapsed_time = system_time() - start; printf("%Lu microseconds late\n", elapsed_time - SNOOZE_TIME); } return 0; }
Time dispersion is defined as measures of spread for the time, e.g., as variance, time difference (difference to slowest and fastest clocks) or average difference with respect to the local clock.
You should multicast the time every 30 seconds. You do not have to worry about round-trip computation; this exercise just provides a rough notion how closely the time between machines is synchronized. Use the multicast address 239.1.2.3, a TTL of 16 and port 5678. The port number should be user-configurable with a -p parameter on the command line. If you need to do testing "undisturbed" by others, use port your uid + 1024.
gethostbyname()
, find out how many dictionary words are
already registered as domains in .com and how long it takes to
resolve them successfully or to fail. Pick 250 consecutive words,
starting at a random offset, from /usr/dict/words or any other
appropriate English-language dictionary. Provide statistics for the
distribution of success and failure times separately, in increments of
50 ms.
You can download resparse-1.3 and take a look at its documentation, if you need it (but you can solve the problem without this).
Sun RPC: Write an RPC-based calendar client and server. The client should be able to add and query appointments. Appointments consist of a start time, end time (both as Unix time) and a text string. Queries should be by time (all appointments that span this time) or string prefix match, so that a query for "Dinner" matches "Dinner with Joe" and "Dinner at home". Measure the request latency and find out how much this latency is due to marshalling. (In the next assignment, you will do something similar for Corba.)
You can use the tftp client to test your server.
The default TFTP port of 69 is not accessible to user programs, so
your server should be configurable (using a -p
command line option), with a default of port 69.
The server should be able to handle several requests at once, with requests from each client getting its own thread. (You may use as many threads as you deem appropriate.) Be careful about where subsequent requests are sent to. Initial time-out is one second. Sending of multiple files is handled by the client; to the server, this just looks like requests from several clients.
Since you are using UDP, you can ignore the section labeled Internet User Datagram Header [2]. In other words, you do not have to be concerned with generating checksums.
Use the syslog facility to log requests.