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!
Example Programmes for Parallel Systems
Now we shall complete this with the examples on shared memory programming.
Example 13: Adding elements of an array using two processor int sum, A[ n] ; //shared variables
void main ( ){
int i ;
for (i=0; i // now create process to be implemented 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 implemented 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, the last half of the array is passed to processor P1 which adds them. Meanwhile processor P0 adds the first half of the array. The variable sum is locked to avoid inconsistency.
// now create process to be implemented 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 implemented 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, the last half of the array is passed to processor P1 which adds them. Meanwhile processor P0 adds the first half of the array. The variable sum is locked to avoid inconsistency.
What is anonymous FTP and why would you use it Anonymous FTP enables users to join to a host without using a valid login and password. Generally, anonymous FTP uses a login kno
DNS in the Internet -Domain name space is split into three sections: country, generic and inverse -Generic domains define hosts by generic behavior -Country domains are
Q. Illustrate Nonboundary-Level Masking with example? Nonboundary-Level Masking Example IP address 45 123 21 8 Mask 255 192 0 0 Subnet 45 64 0 0 123 0
Explain teh term- Bits and Bitmap Many tiny dots, which are put together to make a picture. Bits are combined to make a graphic image called a bitmap. GIF and JPEG files are
It is possible for a datagram to generate ICMP errors after it has been fragmented. For example, suppose that each of two fragments cannot be delivered. Seemingly, this would mean
Describe any good security technology A good security technology should be powerful enough to support the features that the administrators need, including rules validation to i
State the term - Lot of care required while programming It is a common and well-known saying that many developers of "secure systems" leave a "back door" way for themselves so
Q.Role of Host System? Hosts on OSI implementations don't handle network operations (simple terminal) but TCP/IP hosts participate in most network protocols. TCP/IP hosts do su
The purpose of internetworking is universal service across heterogeneous networks. To give this service all computers, and routers have to agree to forward information from a sourc
SONET STS SONET defines a hierarchy of signalling levels called as STSs (Synchronous Transport Signals). Every STS level supports a certain data rate specified in megabits p
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