Question: 1 . [ 1 POINT ] In the main thread, declare a list of 2 million numbers and initialize it with random numbers between -

1.[1 POINT] In the main thread, declare a list of 2 million numbers and initialize it with random numbers between -5 and 20
2.[1 POINT] Divide the list into ten sublists.
3.[1 POINT] Define a function named sum_of_squres to calculate the sum of squares of a list.
4.[5 POINTS] Create ten child threads so that each of them is responsible to find the sum_of_squres for each sublist.
5.[1 POINT] The main thread should then sum all the returned results from the child threads to get the final result.
6.[1 POINT] The main thread should then reinitialize the original list with new random numbers and repeat the whole process for 100 times.
7.[6 POINTS] Use barriers to synchronize the work between the main thread and the child threads.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!