Clarifications wrt. Oblig1
Dear students,
Here are a couple clarifications with regards to Oblig1, which I have found to be suitable for general communication:
Task 1: Barriers
A cyclic barrier object should be constructed with a positive integer n - the number of threads to wait for, and have a single method - await. A process that calls await should get blocked on this call until n processes have called await. Such a barrier allows n processes to wait for one another before they go on to some subsequent stage in their (common) computation. A cyclic barrier can be used by n processes more than once, without re-initializing the object.
Task 2 - Producer/Consumer
Here, timing is important. You should be careful not to skew your results by doing work irrelevant to the task at hand! You should minimize the number of system calls in the code section you are timing. For example, you should not write to stdout in timed sections. As another example, if you can time a loop, that is better than timing each individual iteration. Otherwise, measuring the system time may trump the time it takes to execute an iteration.
Task 3: Kilroy
Your task is to report the number of nodes you can visit per second. First, you should ensure that your object actually moves! (This is not as simple, as it sounds!) Second, you should again not skew your timing by doing irrelevant work (such as writing to stdout). However, if your object actually moves, the skew due to writing to stdout is arguably negligible.
--
Oleks