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.
Call request signal is: (A) Seize signal (B) Idle state signal (C) Line identification signal (D) Called subscriber alert signal Ans: Call request
To avoid race condition, the maximum number of processes that may be simultaneously inside the critical section is The maximum number of processes is one to ignore race conditi
Explain the Advantages of High Level Languages? The major advantage of high-level languages over low-level languages is that they are easier to write, read, and maintain. Ultim
Important points of simulations In this simulation it is essential to consider: (1) What and how data is gathered (2) How simulation is done (3) How system would wo
Hyper-threading, officially known as Hyper-threading Technology (HTT), is Intel's trademark for their execution of the simultaneous multithreading technology on the Pentium 4 micro
Common problem with Hill climbing: An alternative way of justifying the problem is that the states are boards with 8 queens already on them, so an action is a movement of one
The Concept of Program From a programmer's viewpoint, generally a program is a well-defined set of instructions written in a specific programming language, with predefined sets
Explain topology method used in LAN technology in detail. LAN Topologies: Network topology is a physical schematic that shows interconnection of the various users. There are
Define the term- Analysis The analysis involves some or all of the following stages: Fact finding - this is usually done in four ways. Understanding the current syst
Draw sequence diagram for property portal
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