.. (לתיקייה המכילה) | ||
In Question 1 of the dry part, do we need to find a particular configuration of the board that allows maximum concurrency? | |
No, your answer should be for the general case (the best that can be said without assuming dead/alive configuration). |
Is it OK to assume that one cell needs all its neighbors to reach the same generation in order to proceed. | |
Yes. It is OK to assume that. |
In Question 4 of the dry part, is the solution ...? OR | |
Any reasonable solution that removes the particular problem mentioned in the question is OK. Reasonable means that the overhead of your solution is at most the overhead of the original. Don't worry if you cannot find the answer right away. You will probably understand this question only after you have done the other questions correctly. You can try to implement without it first. If you design your code correctly, adding it later will not take much additional effort. |
Hints for better solution of the HW. | |
1. Don't rush to start programming before considering on paper every subtlety of the solution 2. Do NOT confuse b/w thread and object. Object is identified by its type, where each type has a particular data structure and a set of functions(methods). Different objects of the same type __do__not__ share non-static data. Thread is only a concept of executing some code. In particular, a thread can run a certain function which changes the state of a given object. If this function is run by multiple threads, the access to the shared data must be (usually) synchronized. In Java there is a confusion b/w the "thread" as a concept, and Thread as an object which allows to implement this concept. |
What is a JAR file and how to create one? | |
http://java.sun.com/docs/books/tutorial/deployment/jar/build.html http://java.sun.com/docs/books/tutorial/deployment/jar/run.html Straightforward from Eclipse: 1) Select your project 2) Export -> Java -> Jar 3) Next, Next 4) Select your main class at the bottom 5) Finish 6) Don't forget to test it! |
Is it OK to use ... locks? | |
The locks requirement is the lowest priority. Among several solutions that achieve the same level of parallelism, those that use fewer global object should be preferred. And among those with the same number of global object, those that use fewer locks. |
What assumptions can we make about the number of threads? Board size? | |
The board size we will use for testing will be around 100x100 cells, ~32 threads and ~100 generations. |
Can a thread read data from other threads' parts of the board (bordering cells)? | |
Not directly, but by invoking a "get" function on the other threads' objects. |
it seems to us that there's a bug in ex1.java, in line 38 - hSplit is compared to the y size instead of the x size. For example trying to run the program with the command-line parameters 4 5 3 4 5 returns "Wrong number of splits specified", while 4 5 3 5 4 succeeds. | |
Indeed there is a bug. Please fix it yourself. Just replace line 38 with this one if (vSplit>field.length||hSplit>field[0].length){ |
Are we allowed to use more threads than specified by the split input parameters? | |
No. Use exactly the number of threads specified, and each thread is assigned to its area in the beginning of the run, and this assignment does not change |
Clarification for rule 3.2 | |
The cell is dead for good already in the second consecutive generation. For instance, if a healthy living cell in generation 100 becomes sick in generation 101, and it has been calculated that in the next-generation the cell is also sick , meaning that it still has 4 living neighbors in generation 101, then the cell becomes dead for good in generation 102. |
"Dead for good", what is it good for? | |
A cell which becomes 'dead for good' will not resurrect in any case, no matter its neighbors situation and it stays dead from that generation and forth. |