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.
Java uses layout managers to lay out components in a consistent manner across all windowing platforms. As Java's layout managers aren't tied to absolute sizing and positioning, the
Q. What is Ordered directive? This directive is used in combination with for and parallel for directives to cause an iteration to be executed in order that it would have been h
Error detection mechanism may include checking mechanical and data communication errors. These errors must be reported to processor. The illustrations of kind of mechanical errors
Q. Write a menu driven program to find 9's and 10's complement of a decimal number using file. Perform necessary validation with proper message that entered numbers must be de
What is meant by refreshing of the screen? Some method is required for maintaining the picture on the screen. Refreshing of screen is completed by keeping the phosphorus glowi
What is an advantage of executing a process in background? The most common reason to put a process in the background is to permit you to do something else interactively without
As we already know, HTML (Hypertext Markup Language) is the language we use to create Web documents. Now we will read "Hello World!" As given below:
Q. Illustrate about Direct Addressing mode? In this technique operand field of instruction specifies direct address of intended operand for example if instruction LOAD 500 uses
A call processor in an exchange requires 120 ms to service a complete call. What is the BHCA rating for the processor? If the exchange is capable of carrying 700 Erlangs of traffic
Somehow, the worksheet has external links to files that are no longer around. How can we delete the links? Ans) This happens all of the time to MrExcel. I downloaded a little
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