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.
As the name suggests, the function acts as a friend to a class. As a friend of a class, it can access its private & protected members. A friend function is not a member of the clas
Specify the goals of parsing. Goals: a. To check the validity of source string b. To agree on the syntactic structure of a source string. For invalid string this rep
Q. Convert the following into POS form 1. (AB + C + DC)(AB + BC + D) 2. WYZ + XYZ + W'X'Y + W'XYZ 3. XY + XZ + X'YZ' 4. (A+B'+C) (AB+AC') 5. F(A,B,C,D)=M(0,3,
Prolog Programming Language - Artificial intelligence: Most of the programming languages are procedural: the programmer specifies exactly the correct instructions (algorithms)
If you open your computers case, the motherboard is the flat, rectangular piece of circuit board to which the whole thing seems to connect to for one reason or one another. It'
Q. Explain about FAT - Inode? Today modern PC comprises total capacity of nearly 40GB for storage of program and data Due to this huge capacity in place of having just one oper
State the implementation of a security policy The implementation of a security policy should invariably cover all parameters of security such as physical access to the server,
Describe the VON NEUMANN ARCHITECTURE Most of present computer designs are based on idea developed by John vonNeumann referred to as the VON NEUMANN ARCHITECTURE. V
Q. Describe about general-purpose microprocessor? Keeping rapidity with electronics as more and more components were fabricated on a single chip fewer chips were required to ma
Bitwise-AND Operator: & AND-expression : relational-expression AND-expression & equality-expression The bitwise-AND operator (&) compares each bit of its first operand t
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