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.
Q. Explain the typical organization of a computer? There are two principal components: hardware and software. The former refers to physical components such as memory unit (MU),
Discuss the 5-level switching hierarchy recommended by CCITT. Hierarchical networks are able of handling heavy traffic where needed, and at similar time use minimal number of t
What is secondary list? It permits you to enhance the information presented in the basic list. The user can, for example, select a line of the basic list for which he require
What are advantages and drawbacks of latches? Advantages and drawbacks of latches: Area of a latch is classically less than a Flip Flop. It consumes less power, becaus
What is the maximum size of the memory that can be used in a 16-bit computer and 32 bit computer? The maximum size of the memory that can be used in a 16-bit computer is 2 memo
Question: a) Why do we use the Internet as the new distribution channel for e-banking products and services? b) In the context of e-banking or e-commerce, outline some o
Explain how Viewstate is being formed and how it is keeps on client. The type of ViewState is System.Web.UI.StateBag, which is a dictionary that keeps name/value pairs. View St
do you have a question the anser?
Q. Create an input buffer ? CODE SEGMENT ... MOV AH, 0AH ; Move 04 to AH register MOV DX, BUFF ; BUFF must be defined in data
In the first part of Assignment 2A you will develop a simple Patient class, representing an Patient who is to be admitted for a minor procedure that only requires a 1-2 day stay in
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