CS 3733 Operating Systems, Spring 2007 Assignment 3 Comments
This assignment was graded on a basis of 30 points.
- Percent error is allowed to be negative.
- Don't say that the parts that need protection are the variables
count and sum.
The parts of the program that need protection are the parts of the program
that modify (or access) count and sum currently.
After the threads are joined, these do not need to be protected.
- Make sure you join all of the threads, not just the last one.
In the C implementation, you need an array of tids.
- Don't use System.currentTimeMilles for timing.
It is not as accurate as you think.
Use System.nanoTime (in Java 5 and later).
- In the Java implementation, all threads should use the same instance
of Random. See the template for Part 3.
- Java class names start with an upper case letter.
- When showing the output, it should be clear what parameters you used
when running the program.
- Do not use global variables (or instance variables) unless there is
a reason to do so. Otherwise, variables should be local to the
function (method) that uses them.
- Consider the following:
I ran on machine X and it gave the correct results.
I ran on machine Y and it gave incorrect results.
Therefore machine X is better than machine Y.
What is wrong with this?
Hint: Often it means that machine Y is better than machine X.
- What is the difference between:
sum += sin(x) * sin(x);
and
w = sin(x) * sin(x);
sum += w;