Guidance for Coursework 1
Your code should be able to perform the following:
I. Store the unfolding problem states in a suitable data structure
This needs to be a thread-safe data structure since it will store problem states that can be popped by any thread that has nothing else to do. You do not need a fancy data structure (i.e. no need for fine-grained locking), but it must be thread safe. Each element of this thread-safe data structure is a struct that represents a problem state. A problem state comprises the variables that define a state of the chessboard, in addition to a promise of the solution associated with the state.
II. Launch a limited number of threads
You may want to create a solver that launches a number of threads in its constructor and joins them in the destructor. The solver allows a thread to pop the next state from the thread-safe data structure (created in Step I), and unfold the sub-problems associated with this state, while pushing these new states onto the thread-safe data structure. Keep in mind that your solver will need to keep track of the futures in each one of these sub-problem states. When the futures of the sub-problems become available, your solver will add up the values returned by them.
III. A free thread can pick up a task to solve
While a thread waits for the futures of its sub-problems to become available, it should be allowed to recursively pop a new problem state and unfold its sub-problems (as in Step II).
Programming
[SOLVED] data structure Guidance for Coursework 1
$25
File Name: data_structure_Guidance_for_Coursework_1.zip
File Size: 376.8 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.