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.
Assignment: write a C program and a MASM procedure. The C program calls the MASM procedure to perform letter case conversion. Text sections covered: 12.1 to 12.3.1 Write a
What is the role of MAR and MDR? The MAR (memory address register) is used to hold the address of the location to or from which data are to be transferred and the MDR(memory d
Q. How to copy several files in one stroke? The COPY command can also be used to copy several files in one stroke by using wildcards. For example, consider the following comman
Complete Binary tree A complete binary tree can be described as a binary tree whose non leaf nodes have nonempty left and right sub tree and all leaves are at the similar level
Q. Explain about Cathode Ray Tubes? Cathode ray tube is the major technology on that televisions and monitors have been based. CRT is a partially evacuated glass tube which is
Q. Explain Relative Addressing Scheme? In this addressing technique the register R is the program counter (PC) which contains the address of current instruction being executed.
What do you understand by WWW? WWW (World Wide Web): It is an architectural framework for accessing linked documents outspread over thousands of machines the whole world.
Perform the following calculations assuming that all numbers are stored in 16-bit registers as 2's complement binary numbers with no overflow provision. Convert each of the numbers
Define Process. Process: It is a program in execution; process execution should progress into sequential fashion. Process contains: program counter stack dat
A software development company wants to create a social network application where users can post brief audio messages giving their thoughts. Each user of the application will ha
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: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd