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 tools to automate the process of SQL Injection into login and other fields. One hacker process, using a one tool, will be to search out a number of weak targets using Goo
Describe the term- Systems Analysis A systems analysis team is every so often brought in to improve on an existing system. Often this involves moving from a paper-based filing
Q. What is Charge-coupled Devices? CCDs are employed for storing information. They have arrays of cells that can hold charge packets of electron. A word is signified by a set o
Common problem with Hill climbing: An alternative way of justifying the problem is that the states are boards with 8 queens already on them, so an action is a movement of one
Why floating point number more difficult to represent and process than integer? In floating point numbers we have to show any number in three fields sign, exponent and mantissa
The conversation speed of an analog to digital converter is maximum with which technique? Ans. With parallel comparator AD converter technique the conversation speed of an ana
A friend has promised to log in at a particular time. However, he needs to be contacted as soon as he logs in. The shell script checks after every minute whether he has logged in o
system area
Can the size of an array be declared at runtime? No, the size of an array can't be declared at run time, we always require to mention the dimensions of an array at
Types of software: A layer structure is described where Operating System is located on generally used software systems on desktops System software System sof
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