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.
iLab 2: Office Network Expansion Connect to the iLab here. Submit your assignment to the Dropbox located on the silver tab at the top of this page. (See "Due Da
Question 1: a) How is the four-way exchange employed for mutual authentication in WPA/RSN? b) Elaborate on how inquiry attacks and traffic monitoring attacks can be u
What are the advantages and disadvantages of the three types of routing tables? The three types of routing tables are fixed, dynamic, and fixed central. The fixed table must be
what is the use of route print?
FDDI Media FDDI signifies a 100 Mbps token-passing dual-ring LAN that uses a fiber-optic transmission medium. Even though it operates at faster speeds FDDI is similar to Tok
What is a Management Information Base (MIB)? A Management Information Base is part of each SNMP-managed device. Every SNMP agent has the MIB database that having information ab
Application of Satellite Communication started with the installation and commissioning of STD- “B” Earth Station having 11m diameter antenna in 1982, Initially with to only three
Q. Illustrate Data-Link Layer in osi layers model? Data-Link Layer: This layer takes the data messages or frames from the Network Layer and gives for their actual transmissio
The IP class procedure does not split the 32-bit address space into same size class and the classes do not have the same value of networks. A prefix of n bits gives 2n unique ne
State about the Packet filter firewalls They remain the most common type of firewall in use as of today. They were the earliest firewalls developed and were capable of permitt
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