Question

Parallel Computing

Given a set of arrays as follows:

A[100] consists of random number in between 1 and 100

B[100] consists of random number in between 10 and 50

C[100] consists of random number in between 1 and 10

D[100] consists of random number in between 1 and 50

E[100] consists of random number in between 1 and 5

F[100] consists of random number in between 10 and 80

Perform calculation based on the following formula

Y=(A*B)+C+(D*E)+(F/2)

Based on the results calculated, find the minimum and maximum values. Display the overall calculation results, minimum and maximum values. The array size is set to 100.

Hint 1:

You can apply the decomposition based on the processes, threads, or assign multiple data per thread (e.g. 10 data per thread, 10 threads OR 25 data per thread, 4 threads).

Hint 2:

In generating the random number, you may apply the following codes:

srand(time(NULL));

a[i] = rand() % 100 + 1;

b[i] = rand() % 50 + 10;

c[i] = rand() % 10 + 1;

d[i] = rand() % 50 + 1;

e[i] = rand() % 5 + 1;

f[i] = rand() % 80 + 10;

Hint 3:

You may refer to the following serial program as a sample. But your answers must not be limited to this example.

Sample serial program

#include

#define ARRAY_SIZE 100

int main(){

       int i;

       double a[ARRAY_SIZE], b[ARRAY_SIZE], c[ARRAY_SIZE], d[ARRAY_SIZE], e[ARRAY_SIZE], f[ARRAY_SIZE], y[ARRAY_SIZE];

       double min, max;

       int imin, imax;

       /*A[100] consists of random number in between 1 and 100

       B[100] consists of random number in between 10 and 50

       C[100] consists of random number in between 1 and 10

       D[100] consists of random number in between 1 and 50

       E[100] consists of random number in between 1 and 5

       F[100] consists of random number in between 10 and 80*/

       srand(time(NULL));

       for (i = 0; i < ARRAY_SIZE; i++) {

              a[i] = rand() % 100 + 1;

              b[i] = rand() % 50 + 10;

              c[i] = rand() % 10 + 1;

              d[i] = rand() % 50 + 1;

              e[i] = rand() % 5 + 1;

              f[i] = rand() % 80 +10;    }

       //Y=(A*B)+C+(D*E)+(F/2)

       for (i = 0; i < ARRAY_SIZE; i++) {

              y[i] = (a[i] * b[i]) + c[i] + (d[i] * e[i]) + (f[i] + 2);

              printf("y[%d]=%.2f\n", i,y[i]);

       }

       //min

       for (i = 0; i < ARRAY_SIZE; i++) {

              if (i == 0) {

                     min = y[i];

                     imin = i;

              }

              else {

                     if (y[i] < min) {

                           min = y[i];

                           imin = i;

                     }

              }

       }

       //max

       for (i = 0; i < ARRAY_SIZE; i++) {

              if (i == 0) {

                     max = y[i];

                     imax = i;

              }

              else {

                     if (y[i] > max) {

                           max = y[i];

                           imax = i;

                     }

              }

       }

       printf("min y[%d] = %.2f\nmax y[%d] = %.2f\n", imin, min, imax, max);

       return 0;

}

Question 1

Decompose the given problem to tasks. You may use any of the decomposition techniques discussed in Module 3. Explain the decomposition techniques applied and draw the decomposition diagram.

Question 2

Represent the decomposed problem in Question 1 to task dependency graph.

Question 3

Write a full program that consists of multithreading implements using Pthread in C language. Provide the source code in text (not screen capture), and the output in an image form. Attach the source code file (.c) in the submission too.


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Parallel Computing
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • I want an answer, what should I choose? The ratio of the amplitudes of two beams...

    I want an answer, what should I choose? The ratio of the amplitudes of two beams forming an interference fringe pattern is 8/2. (a) What is the value of the maximum irradiance (max) and minimum irradiance (min) if their electric field vectors are perpendicular? (b) What visibility results? Select one or more: a. Imax 16 (21)2. Imin = (az)? b. Visibility = 15(21)2/17 (a.)2 c. Visibility d. Imax = 8 (a). Imin = 2 (a)? e. Visibility = 5/4 f....

  • (b) What is the probability of generating a random number between 0.35 and 0.65? (c) What...

    (b) What is the probability of generating a random number between 0.35 and 0.65? (c) What is the probability of generating a random number with a value less than or equal to 0.20? (d) What is the probability of generating a random number with a value greater than 0.60? (e) Generate 50 random numbers by entering =RAND() into 50 cells of an Excel worksheet. This answer has not been graded yet. (f) Compute the mean and standard deviation for the...

  • I have a multithreaded java sorting program that works as follows: 1. A list of double...

    I have a multithreaded java sorting program that works as follows: 1. A list of double values is divided into two smaller lists of equal size 2. Two separate threads (which we will term sorting threads) sort each sublist using a sorting algorithm of your choice 3. The two sublists are then merged by a third thread merging thread that merges the two sublists into a single sorted list. SIMPLE EXECUTION >java SortParallel 1000 Sorting is done in 8.172561ms when...

  • Most computer languages include a function that can be used to generate random numbers. In Excel,...

    Most computer languages include a function that can be used to generate random numbers. In Excel, the RAND function can be used to generate random numbers between 0 and 1. If we let x denote a random number generated using RAND, then x is a continuous random variable with the following probability density function. for 0 sxs 1 elsewhere (a) Graph the probability density function. f(x) f(x) EEEEEEEEEEEEE Endas tiers - 3 - Terce BOORTE E segments Egertice Tesegent o...

  • 1) A buck chopper like that in Figure I has the following data 250 μΗ, D E 40 V, T Find: 50 μ. L ...

    1) A buck chopper like that in Figure I has the following data 250 μΗ, D E 40 V, T Find: 50 μ. L 0.4, C-60 μF, and R 10 Ω. ) the value of L necessary for the continuous current mode (b) Vc (c) Imax and Imin (d) Av r like that in Figure 1 requires an output power of 100 at an output voltage of 24 V from a 60-V supply. The switching fre- quency is 60 kHz....

  • 4. 3/6 points Previous Answers ASWSBE13 6.2.004. My Notes Ask Your Teacher Most computer languages include...

    4. 3/6 points Previous Answers ASWSBE13 6.2.004. My Notes Ask Your Teacher Most computer languages include a function that can be used to generate random numbers. In Excel, the RAND function can be used to generate random numbers between 0 and 1. If we let x denote a random number generated using RAND, then x is a continuous random variable with the following probability density function. ROX) i for 0 SX S1 10 elsewhere (a) Graph the probability density function....

  • Help with a Parallel and Distributed Programming assignment. In this assignment, you will be expl...

    Help with a Parallel and Distributed Programming assignment. In this assignment, you will be exploring different methods of counting the prime numbers between 1 and N. You will use 8 threads, and each will be given a range in which to count primes. The question is: where do you store your counter? Do you use a local variable? Do you use a global variable? Please use the following function to determine whether an integer number is a prime. // Return...

  • (S%) Problem 13: In a simple AC circuit shown on the right, C 0.075 F. L...

    (S%) Problem 13: In a simple AC circuit shown on the right, C 0.075 F. L 0.55 H, R. 36 ma sin(cot), where I, 5.5 A and co 35 rad/s max Randomized Variables C 0.075 F L 0.55 H R 36 O Imax 5.5 35 rad/s AV Otheexpertta.com A 10% Part (a) Express the capacitive reactance,XC, in terms of C, and co A 10% Part (b) Calculate the numerical value of Xa in ohms. A 10% Part (c Express the...

  • Help with a Parallel and Distributed Programming assignment. In this assignment, you will be expl...

    Help with a Parallel and Distributed Programming assignment. In this assignment, you will be exploring different methods of counting the prime numbers between 1 and N. You will use 8 threads, and each will be given a range in which to count primes. The question is: where do you store your counter? Do you use a local variable? Do you use a global variable? Please use the following function to determine whether an integer number is a prime. // Return...

  • 4. Write a program that generates one hundred random integers between 0 and 9 and displays...

    4. Write a program that generates one hundred random integers between 0 and 9 and displays the count for each number. (Hint: Use rand()%10 to generate a random integer between 0 and 9. Use an array of ten integers, say counts, to store the counts for the number of 0’s, 1’s,…..,9’s.) this program kinda works but i cant figure out why its making more than 100 random numbers ls) [*] test2.cpp test3.cpp #include<stdio.h> #include<stdlib.h> int main() 4 { int a[14],is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT