UW-Madison
Computer Sciences Dept.

CS739 Spring 2009: Programming Assignment 4 -- Concurrent Erlang

Due: Tuesday, March 10, End of day (whatever you consider the end of day...)
Reading: Chapter 7 and 8 of Programming Erlang

You are again welcome to work with others for this assignment, but each person must turn in their own code and graphs.

Overview

For this assignment, you will create a small concurrent program that benchmarks process creation and message passing while exploring N-version programming.

The benchmark should create C client processes and 3 server processes. As in N-Version programming, the 3 server processes compute the same function, but in slightly different ways. The client does not completely trust the results returned by any one server: therefore, the client asks all 3 servers to compute the result and uses majority voting to determine the correct result.

The sophisticated function that each server computes for this assignment is the multiplication of two arguments. Think of 3 slightly different ways you can write a function that multiplies two numbers together and have each of the 3 servers use a different approach.

Make sure you define errors reasonably. For example, if the 3 servers all give different results, then the client should throw an error.

The C client processes should all be asking the servers to compute the functions concurrently; there is no coordination across the C clients. Each of the clients should repeat the sending, adding, receiving of results, and voting M times. C and M should be command-line arguments to your program.

Evaluate the Impact of M and C

Time how long your benchmark program takes as a function of C and M. (Don't do any I/O to slow things down, please.)

Pick some interesting values for C and M. Vary them (independently is fine) and measure the time for the program. Graph the results (remember to label your axes). Be sure you report the details of the machine you are running on (e.g., Erlang version, OS version, CPU details, and amount of memory).

Turning in your assignment

Please bring to class a print out of your graph (just the graphs, not the code anymore).

Please copy your code to the directory ~cs739-1/Spring09/handin/[login]/P4 where [login] is your CS login name.

Again, comment your code enough that someone can follow what you did.

We won't grade you on elegance, or simplicity, or creativity, or anything other than functionality and comments. If different students come up with wildly different solutions, we'll try to share some of the different approaches.

You might find it interesting to look at the write-ups others have done for the ring benchmark specified as Problem 2 in 8.11 of the book. If you google "Erlang ring benchmark" you can look at other people's code and timing results from now until the end of the semester...