Question: PLEASE USE C# using System; using System.Threading; namespace ConsoleApplication1 { // Simple Threading Examples - 4 // Using Threads to find of the sum of

PLEASE USE C#

PLEASE USE C# using System; using System.Threading; namespace ConsoleApplication1 { // Simple

using System; using System.Threading;

namespace ConsoleApplication1 { // Simple Threading Examples - 4 // Using Threads to find of the sum of numbers 0-100 class Program { public static int[] anarray = { 2, 3, 12, 15, 0, 4, 7, 9, 2, 7 }; public static int sum = 0;

static void myThreadMethod(object myarray) { // a[0] will be the threadid and a[1] will be the size of the numbers added int[] a = new int[2]; a = (int[])myarray;

int threadid = a[0]; int size = a[1];

for (int i = threadid * size ; i

static void Main(string[] args) { //Assume that the number and the processor numbers are given as: int p = 5; int n = anarray.Length; int size = n / p;

Thread[] t = new Thread[p];

for(int i=0;i

for (int i = 0; i

Console.WriteLine("result:{0}", sum); } } }

3. Given the serial code that finds the minimum of an array, convert the code into a parallel program, create at least three threads and use them to find the min of the elements of the array given in the code. Submit your code. (20 points) /I given the array int[] a-(4, 3, 1, 6, 8, 9, 1ee, 23, 13, 44, 14, 67, 89, 34, 23, 69, 1, 65, 32, 33, 4,5,6,18 // start min from a random big number int min-1000; /I adds every item of the array to the sum for (int i i

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!