.. (לתיקייה המכילה) | ||
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. Those who do not assume that will be given a bonus. |
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. |
Is X better than Y? What assumptions can we make about the number of threads? Board size? | |
If you have a real dilemma you should come to the reception hours. Giving a reasonable explanation of your choice in the documentation is also enough. Even if you make the wrong choice in the end, as long as you mention that you considered the right one, and give a reasonable argumentation against it, you will not lose points. The board size we will use for testing will be around 100x100 cells, 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. |
What's the formal definition of the correct solution | |
Let d(i,j) be distance between cell i and j. Distance is defined as follows. Consider a graph where the nodes are all the cells in the field, and two nodes are connected if their respective cells depend on each other. Distance between cell i and j is the shortest path in this graph between the respective nodes) Let g(i) be the current generation of cell i The solution is considered correct if it allows two cells i and j with d(i,j)=k and abs(g(i)-g(j))=k to coexist on the same field, with the space complexity O(1) regardless of k. Note that max(d(i,j)) where abs(g(i)-g(j)) is n, which is the size of the field. So if the space req. of your solution is O(k), it is turns to O(n) to satisfy the above condition, so it is wrong. |
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 |