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.
The decimal equivalent of (1100) 2 is ? Ans. (1100) 2 = (12) 10
Explain the different sub-functions of Process Scheduling. Process scheduling contains the subsequent sub-functions: 1. Scheduling: Chooses the process to be executed next
Sigmoid units - Artificial intelligence Remember that the function inside units take as input the weighted sum, S, of the values coming from the units associated to it. The fun
Q. Convert the following decimal numbers into 9s & 10s complement: 1) 3654 2) 99 3) 18.293 Q. Convert the following binary numbers into 1s& 2s complement: 1) 1101
Describe the working of components of I-way Infrastructure. Working of I-way Infrastructure components: a. Consumer access equipment shows a critical category, it is the abs
Explain non-adapting routing. Systems which do not implement adaptive routing are explained as using non-adapting or static routing, which routes by a network are explained by
Device Drivers in UNIX, MS-DOS and Windows System Though device drivers are in effect add-on modules they are however considered to be part of system because they are closely i
Why is TCP called end-to-end protocol? TCP is termed as an end-to-end protocol as this provides a connection directly by an application in one computer to an application on a r
In a single stage network: (A) There is no redundancy (B) There is redundancy (C) Alternative cross points are available (D) Alt
The defining traits of an object-oriented language are: * Encapsulation * Inheritance * Polymorphism
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