Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Show the Programmes for Parallel Systems?
Adding elements of an array using two processor
int sum, A[ n] ; //shared variables
void main ( ){
int i ;
for (i=0; i scanf ("%d",&A[i] ); sum=0; // now create process to be executed by processor P1 fork(1) add (A,n/2,n-1, sum); // process to add elements from index n/2 to - 1.sum is output variable // now create process to be executed by processor P0 add (A,0,n/2-1, sum); join 1 ; printf ("%d", sum); } add (int A[ ], int lower, int upper, int sum) { int sum1=0, i; for (i=lower; i<=upper; i++) sum1=sum1+A[i]; lock sum; sum=sum+sum1; unlock sum ; } In this program last half of array is passed to processor P1 that adds them. For the meantime processor P0 adds the first half of array. The variable sum is locked to avoid inconsistency.
scanf ("%d",&A[i] );
sum=0;
// now create process to be executed by processor P1
fork(1) add (A,n/2,n-1, sum); // process to add elements from index n/2 to -
1.sum is output variable // now create process to be executed by processor
P0 add (A,0,n/2-1,
sum);
join 1 ;
printf ("%d", sum);
}
add (int A[ ], int lower, int upper, int sum)
{
int sum1=0, i;
for (i=lower; i<=upper; i++)
sum1=sum1+A[i];
lock sum;
sum=sum+sum1;
unlock sum ;
In this program last half of array is passed to processor P1 that adds them. For the meantime processor P0 adds the first half of array. The variable sum is locked to avoid inconsistency.
There are various limitations of primary memory like limited capacity which is its not enough to store a very large volume of data and volatility which is when power is turned off
Q. How to convert Binary to Octal and Hexadecimal? Rules for these conversions are simple. For converting binary to octal binary number is splitted in groups of three, that are
What is asynchronous DRAM? In asynchronous DRAM, the timing of the memory device is controlled asynchronously. A specialized memory controller circuit gives the essential contr
How Web-Based Word Processing Works? Web-based word processors are hosted in the cloud, not on the hard drive-as are the documents formed with these applications. And these web
Different systems that can participate in grid computing as platform are: Windows 3.1, 95/98, NT, 2000 XP , DOS, OS/2, , supported by Intel ( x86); Mac OS A/UX (Unix) sup
Sometimes you may need to run scripts which have plotting commands without displaying the plots and without going into the script to comment out the commands. An example: if you're
And-Elimination rule: In generally English says that "if you know that lots of things are all true, so you know like any one of them is also true". Because you can specify a c
a. Explain Standard Streams and file streams. Differentiate among two types of stream. b. Write a program in C++ that inputs characters from the keyboard and prints them in reve
Compare the memory devices RAM and ROM. Ans. Comparison of Semi-conductor Memories RAM ands ROM The advantages of ROM are: 1. This is cheaper than RAM. 2. This is non-volatil
What are function modules? Function modules are general-purpose library routines that are available system-wide.
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd