CS 3733 Operating Systems, Fall 2010 Assignment 6
Due Wednesday, December 1, 2010
This assignment will be demonstrated in class on the due date.
No late assignments will be accepted.
Click here for instructions.
Part 0: Setup
Make a directory called assign6 for this assignment.
Download the PUP ch18 code as you did in the recitation,
run convertlinux,
and make and make sure everything works correctly. Try a client and server and
make sure they can communicate.
Make a part1 subdirectory and copy only the parts of the chapter 18
code needed to run the serverp and client2 programs.
You can tell what you need by looking at the compile lines for these
in the makefile.
Use a makefile to compile and run these programs
and make sure they can communicate.
Part 1: The server
Copy serverp.c into myserver.c and modify it so that
it is a parallel server that handles connections as follows:
- read two unsigned 32-bit integers from the remote host.
- Assume that each of these have been sent as 4 bytes in network byte order.
- Print a message to standard output giving the process ID of the process
and the values of these two numbers.
- The numbers will represent the range of values for running your
testRange function from Assignment 5, Part 1.
- Call testRange with these values.
- When testRange finds a bad value,
print a line to standard output as before,
giving information about the bad value,
but also including the process id of the process.
Output exactly one line per bad value using a single printf
statement.
- Modify testRange so that it also sends the bad value
as a 32-bit unsigned int in network
byte order to the remote host.
- When testRange is done, close the connection.
- The total number of bytes sent to the remote host should be
4 times the number of bad values found.
- If any communication with the remote client fails,
print an appropriate message.
The various child processes are all writing to standard output concurrently,
and it is possible that the lines sent to standard output will be interleaved.
Since we are only using this for debugging and interleaving should be very rare,
do not worry about this problem.
Write a program to test the server.
Copy client2.c into clientTester.c and modify it as follows.
- The program takes 4 command line parameters,
the first two being the same as client2 and the last two
will be unsigned ints.
- The program makes a connection to the remote host and sends the last
two parameters as 32-bit values in network byte order.
- It then goes into a loop, reading 32-bit integers in network byte order
from the remote host and printing them as unsigned 32-bit values
in hexadecimal.
Use this to test your server.
Try running at least two copies of the client concurrently
with the same server.
Save your results for both clients and the server. Include in your
results, information about whether the output is from a client or a server,
which machine the output came from, and what command line parameters were used.
Part 2: the client
Please note the following change: do not have the client print the value of getValue
or singlePrecision. Do not link the client with getValue.o.
Copy client2.c into myclient.c and modify it as follows:
- The program takes at least 5 command line parameters,
the first two being unsigned ints representing the range of values to test.
- The third parameter is a number representing the port to use.
- The next (fourth) is the number of pieces to break the range
of values into.
- The rest of the parameters are a list of hosts that are running the server
from part 1.
- If the number of hosts given is less than the fourth parameter,
cycle through the list and reuse hosts.
All hosts should be sent their ranges before any other processing is done,
so the the remote hosts work concurrently.
If there is an error connecting to any host, print an appropriate message
and exit the program.
- After all hosts have been contacted, the client should go into a loop
reading values and outputting the result.
- You must handle the output from the hosts concurrently as the values
are created.
- As each bad value comes in, print a single line including the
following information:
- the number that was received
- the host it was sent from.
- When all hosts have completed, print total number of values sent
from the remote hosts.
You know of at least three ways to handle the monitoring of the multiple network
file descriptors: child process, threads, select.
Whichever method you choose, each line must be output atomically,
so different lines do not interleave.
Test your program and make sure it works correctly.
Save the output from the client and each server.
Write a paragraph describing the algorithm you used for monitoring the network
file descriptors and how you ensured the syncronization.
Part 3: Testing on multiple architectures
The purpose of this part of the assignment is to make sure your client
and server can communicate correctly with a machine having a
different architecture.
Note the following change: only run the client on Solaris. Always
run the servers on Linux.
Remotely log into one of the blade machines (blade01-blade10).
These are running the Solaris operating system on a SPARC processor.
The SPARC processor under Solaris uses a big endian representation
of integers while the
Intel processors used in our Linux machines are little endian.
Modify your makefile so that typing make solaris will
produce a client executable for a Solaris machine.
This executable should have different names from the Linux version, but should
be created from the same source files. Be sure to use the correct libraries
when compiling on Solaris.
Test your programs with a Solaris client and Linux servers.
Save your output as before, labeling each
with the name of the machine used.
Handing in the assignment
Use this cover sheet for handing in your
assignment. Answer the questions listed on the cover sheet.
Come to class on Wednesday, December 1 with your printed source code and results.
Do not hand in your printout at the beginning of class.
Be prepared to run your server and client on either Linux or Solaris.
The executables should have been created before coming to class.