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.
solution for oadovan string inc language
Multithreaded Architecture: It is clear now that if we give many contexts to multiple threads, then processors with multiple contexts are known as multithreaded systems. These sys
Shared executes most of the security features into OLAP. If multiple accesses are needed admin can make essential changes. The default security level for all OLAP products is read
Explain about the two services that are used to deal with communication. Message Service: Used by the application servers to change short internal messages, all system commu
What is the function of a TLB (translation look-aside buffer)? A small cache called the TLB is interporated into MMU, which having of the page table entries that correspondi
Q. Explain about Hyper-threading? Non threaded program instructions are executed in a single order at a time until the program completion. Presume a program have four tasks nam
Activity of a some enzyme was calculated in extracts from brain, heart and lung. In every tissue, the activity was calculated various times, giving the following results (in
Q. Create a Web page from which customers can order equipment? Suppose your boss wants you to create a Web page from which customers can order computer equipment. You need to c
Q. Programming with parallel virtual machine? The general method for writing a program with PVM is like this: A user writes one or more sequential programs in C++, C or FOR
Why address bus is unidirectional and data bus is bidirectional? Ans) Because there is no require address transaction among processor and peripheral device but data bus is req
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