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.
Instruction Level It refers to the condition where different instructions of a program are implemented by different processing elements. Most processors have numerous execution
How to manage the web based projects? Many project management applications contain additional functions useful in the management of group projects. These features may contain g
Basic elements of Assembly language: Any Assembly language which consists 3 types of instruction statements that are used to define the program operations: Data secti
The circle can rotate clockwise and back. By using minimum hardware build a circuit to indicate the direction of rotating? Two sensors are required to determine the direction o
l need a help for my project pllz:) Write a program that will simulate ATM machine. The Program should prompt the user to enter a valid PIN password number of 5 digits (PIN: 12312)
Explain the term- Variables - Variables are used for local storage of data - Variables are usually not available to multiple processes and components. - Variables would
a. Explain the hardware mechanism for handling multiple interrupt requests. b. What are handshaking signals? Describe the handshake control of data transfer during input and out
THE NEED OF PARALLEL COMPUTATION With the growth of computer science, computational pace of the processors has also increased many a times. Though, there are definite constr
Discuss the risks of having a single root user and how more limited management abilities can be given to others users on Linux/UNIX systems
With a C program to read the text book number, title, author and publisher into a structure and print these values. # include # include void main() { struct boo
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