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.
Explain the term- Hacking Use of passwords and ids to prevent illegal access to files. Also locking the computer itself or locking computer room can help here. Encryption s
Write a BASH/C shell script which takes a name of a directory as a command line argument, and prints unique login name of the users having files in that directory. Your code should
In how many ways line of code of assembly language can be divided? A line of code of an assembly language program can be divided in three columns called as fields. The fields d
Calculation of physical address and Logical address.
Different search strategies- artificial intelligence: To help us think about the different search strategies, we use two analogies. Firstly, we suppose that the professor keep
Explain the Client-Server Interaction Using Messages As we have learned, client- server interaction may be managed in many ways. A message- based interaction is perhaps the bes
For the purposes of this assignment, you are the accountant for an industrial property development company, Devprop Leasing Co., that typically develops warehouse and industrial co
What is Assembler A macro-assembler or assembler normally forms a part of operating system. That translates an assembly language program into machine language program.
What is byte addressable memory? The assignment of successive addresses to successive byte locations in the memory is known as byte addressable memory.
Can SMTP be used as transfer protocol for Web pages? Why? SMTP is an easy mail transfer protocol. This uses ASCII text for all communications. SMTP needs reliable delivery- the
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