Consider the following segment taken from a C program: for(j = 1; j { printf(“ nEnter an integer value:”); scanf(“%d”, &x); if(x == 0) y(j)=0; if(x != 0) y(j)=10; } a. Recode it so it will run more...


Consider the following segment taken from a C program:


for(j = 1; j <=>


{


printf(“ nEnter an integer value:”);


scanf(“%d”, &x);


if(x == 0)


y(j)=0;


if(x != 0)


y(j)=10;


}


a. Recode it so it will run more efficiently in a single-processor system.


b. Given that a multiprocessing environment with four symmetrical processors is available, recode the segment as an efficient concurrent program that performs the same function as the original C program.


c. Given that all processors have identical capabilities, compare the execution times of the original C segment with the execution times of your segments for parts (a) and (b).



Jan 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here