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.
What is dynamic memory allocation? The mechanism of allocating needs amount of memory at run time is known as dynamic allocation of memory. Sometimes it is needed to allocate m
Q. Explain Error Detection and Correction Codes? Before we wind up data representation in reference of today's computers one should determine about code that helps in correctio
Write short note on Quantization. Quantization: This is the first step in PCM. The whole amplitude range of the modulating signal is divided in a number of standard levels term
how can we design a multiplier by using ASM chart and then design the data controller ?!!
State the term in detail $strobe $strobe. This task is very similar to $display task except for a slight difference. If many other statements are executed in same time unit as
What are assembler directives? Ans: These are the instructions that direct the program to be executed. They have no binary corresponding so they are called pseudo-opcodes. The
What are disadvantages of the asynchronous reset and synchronous reset? Disadvantages of asynchronous reset: Make sure that the release of the reset can arise within one c
A graph 'G' with 'n' nodes is bipartite if it have no cycle of odd length.
Q. Example to show a single digit ? Displaying a single digit (0 to 9) Presume that a value 5 is stored in BL register then to output BL as ASCII value add character ‘0' to
What are the disadvantages of Bespoke Software - Very dependent on suppliers of the software; if they go out of business there would be little or no support if problems occ
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