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.
Design a 4 : 1 multiplexer with strobe input using NAND gates. Ans. Design of 4 : 1 multiplexer with strobe input using NAND gates.
How many services are supported by internet? The firewall software assists at least Internet services: HTTP, FTP, Gopher, SMTP and Telnet. DNS name resolution, preferably th
Define Time Sharing. Time Sharing: Sharing of a computing resource among various users by means of multiprogramming and multi-tasking is termed as timesharing. By permittin
What is a screen group? How it is useful? Screen group is a field in the Screen Attributes of a screen. Here we can explain a string of up to four characters which is availa
Q. Subsequent statements set every element of matrix? Let a= [2,4,6,8,10], b=[1,3,5,7,9], c=[0,0,0,0,0] Consider the subsequent program section FORALL (i = 2:4) a(i)
Q. How will these instructions perform? Let's assume that above machine instructions are stored in three consecutive memory locations 1, 2 and 3 and PC contains a value (1) tha
write an assembly language program for fibonacci series?
a) Make a cell array variable that would kept for a student his or her name, university id number, and GPA. Print this information. b) Make a structure variable that would kept
Write a verilog code to swap contents of two registers with and without a temporary register? With temp reg : always @ (posedge clock) begin temp=b; b
Determine the negation of the statement? "2 is even and -3 is negative"? Answer: 2 is odd or -3 is not negative.
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