全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写A multithreaded malloc
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写代寫C++作業，實現多線程BFS搜索
In this assignment you will perform a parallel breadth-first search (BFS) of the 4×3 Sliding Tile state space. The result of this search will be that the distance of every state in the state space from the initial configuration will be stored in an array. In C++ you can only access items in an array using an integer offset. Thus, we cannot directly map between our Sliding Tile puzzle class and an element in the depth array. Luckily, there is a 1-to-1 mapping between states in the puzzle and integers between 0 and 12!/2. We can perform this mapping using what are called “Ranking” and “Unranking” functions. A ranking function will convert a state into an integer, and an unranking function will convert an integer into the corresponding state. T
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写C++多線程程序作業代寫，實現多線程任務分配
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写In this lab you’ll implement a program which uses multiple threads to divide up a simple problem
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写into independent sub-tasks. Source code for this lab is supplied in Lab11Source.zip .
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写Write the function ThreadedSum which is declared as:
double ThreadedSum(int numThreads, size_t arraySize);
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写You’ll find an empty function definition in main.cpp in the supplied source code. This function
1. Allocate an array on the heap of type double with arraySize elements . This may get too large
for the stack, so make sure you allocate it on the heap (free store).
2. Run numThreads threads, each of which initializes an approximately equal portion of the
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写array. For example, if numThreads is 8, each thread should initialize 1?8 of the array. Make
sure you handle round-off correctly if arraySize is not an even multiple of numThreads. Each
element of the array should be initialized to the square root of the index of the element.
全优代写 - 北美Essay代写,Report代写,留学生论文代写作业代写3. Wait for all of the initialization threads to complete,