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.
Define e-commerce? The term 'electronic commerce' has develop from electronic shopping, to imply all aspects of business and market processes enabled by the Internet and World
Question: (a) State possible Large Scale System Applications different from those mentioned in (c) which may have a component running in the Cyber City. (b) According to you
Upgrading Magento to the latest version is a fairly easy task. Copy and Paste this key magento-core/Mage_All_Latest VIA Magento Connect where it states Paste extension key to insta
Cross Bar The crossbar network is the easiest interconnection network. It has a two dimensional grid of switches. It is a non-blocking network and give connectivity among inp
Before getting into the design the designer should go by the SRS prepared by the System Analyst. The main tasks of design are Architectural Design & Detailed Design. In Arch
What is program-controlled I/O? In program controlled I/O the processor repeatedly checks a status flags to achieve the needed synchronization among the processor and an input
It is recommended that you capture your assignment as a Hierarchical Design in Multisim. Look at the Help topic Working with Larger Designs. Design and thoroughly test each module
Arithmetic Pipelines The method of pipelining can be applied to a variety of complex and slow arithmetic operations to speed up the processing time. The pipelines used for arit
the counter shown Q2Q1Q0=000 The status of Q2Q1Q0 after the pulse
Distinguish between enhancement mode and depletion mode metal oxide semiconductor field effect transistors giving their characteristics. Ans. Enhancement mode and depleti
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