Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

Dynamic Process Groups

To generate and manage dynamic groups, a separate library libgpvm3.a must be connected with the user programs that make use of any of the set functions. Group management work is handled by a group server that is automatically in progress when the first group function is invoked. Any PVM task can connect or leave any group dynamically at any time without having to inform any other task in the affected groups. Tasks can shows messages to groups of which they are not members. Now we are giving some routines that manage dynamic processes:

  • int pvm_joingroup( char *group )

Enrolls the calling process in a named group. group is a group name of an presenting group. Returns instance number. Instance numbers run from 0 to the number of group members minus 1. In PVM 3, a task can connect multiple groups. If a process departs a group and then rejoins it, that process may receive a dissimilar instance number.

  • int info = pvm_lvgroup( char *group )

   Unenrolls the calling process from a named group.

  • int pvm_gettid( char *group, int inum )

Returns the tid of the process recognized by a group name and instance number.

  • int pvm_getinst( char *group, int tid )

Returns the instance number in a set of a PVM process.

  • int size = pvm_gsize( char *group )

Returns the number of members at present in the named group.

  • int pvm_barrier( char *group, int count )

Blocks the calling process up to all the processes in a group has called it. count shows the number of group members that must call pvm_barrier before they are all released.

  • int pvm_bcast( char *group, int msgtag )

Transmits the data in the active message buffer to a group of processes. msgtag is a message tag supplied by the user. It agree to the user's program to distinguish between dissimilar kinds of messages .It should be a nonnegative integer.

  • int info = pvm_reduce( void (*func)(), void *data, int count, int datatype, int msgtag, char *group, int rootginst)

 Performs a decrease operation over members of the particular group. func is function defining the operation performed on the global data. Predefined are, PvmMin, PvmMax ,PvmSum and PvmProduct. Users can describe their own function. data is pointer to the starting address of an array of local values. count shows the number of elements of datatype in the data array. Datatype is the kind of the entries in the data array. msgtag is the message tag supplied by the user. msgtag should be greater than 0. It allows the user's program to distinguish between different kinds of messages. group is the group name of an existing group. rootginst is the illustration number of group member who gets the result.

We are writing here programs that shows the use of these functions in the parallel programming:

Example 2: Hello.c

#include "pvm3.h" main()

{

int cc, tid, msgtag;

char buf[100];

printf("%x\n", pvm_mytid());

cc = pvm_spawn("hello_other", (char**)0, 0, "", 1, &tid);

if (cc == 1) {

msgtag = 1;

pvm_recv(tid, msgtag);

pvm_upkstr(buf);

printf("from t%x: %s\n", tid, buf);

} else

printf("can't start hello_other\n");

pvm_exit();

}

In this program, pvm_mytid( ), returns the TID of the running program (In this case, task id of the program hello.c). This program is intended to be invoked by hand; after printing its task id (obtained with pvm_mytid()), it starts a copy of another program called hello_other using the pvm_spawn() function. A successful spawn happens the program to implement a blocking receive using pvm_recv. After getting the message, the program prints the message sent by its counterpart, as well its task id; the buffer is take out from the message using pvm_upkstr. The final pvm_exit call dissociates the program from the PVM system.

hello_other.c

#include "pvm3.h"

main()

{

int ptid, msgtag;

char buf[100];

ptid = pvm_parent();

strcpy(buf, "hello, world from ");

gethostname(buf + strlen(buf), 64);

msgtag = 1; pvm_initsend(PvmDataDefault); pvm_pkstr(buf);

pvm_send(ptid, msgtag);

pvm_exit();

}

Program is a listing of the ''slave'' or spawned program; its first PVM action is to get the task id of the ''master'' using the pvm_parent call. This program then gets its hostname and transfers it to the master using the three-call sequence - pvm_initsend to initialize the send buffer; pvm_pkstr to place a string, architecture-independent manner and in a strongly typed, into the send buffer; and pvm_send to trasnfer it to the destination process shows by ptid, ''tagging'' the message with the number1.

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M9525785

Have any Question?


Related Questions in Computer Network & Security

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

True or false1 tcp ensures error free transmission2 the

TRUE or FALSE 1. TCP ensures error free transmission. 2. The process that initiates the communication is the server. 3. A host can serve as both server and client in a P2P network. 4. Audio and video applications cannot ...

Short answers1 the discussion question to debate is how

Short Answers: 1. The discussion question to debate is how have companies like Apple, Microsoft and the big providers (ATT, Verizon, Sprint, etc) impacted communication today? 2. Technology wise what do you imagine for t ...

The software company niksoft is selling a new defense

The software company NikSoft is selling a new defense against DDoS attacks. Their software looks at the source IP address on all incoming packets, and if it finds any IP address that accounts for more than 1% of traffic ...

Task1 in each of the following scenarios there is a

Task 1. In each of the following scenarios there is a relationship to work life in the IT industry. With each of the following question, ensure that your answer includes the explanation of how it would be applied to work ...

Network project management assignment -purpose of the

Network Project Management Assignment - Purpose of the assessment - The purpose of this assignment is to build a clear understanding of project management fundamentals and their application, specifically: demonstrate pro ...

Question suppose public-key cryptography is used to encrypt

Question : Suppose public-key cryptography is used to encrypt the communications between Alice and Bob. Alice's public key is eA, private key is dA; Bob's public key is private key is de. Now Bob wants to send a message ...

1srin response to nmap -n -sn localhost what kind of

1. SR In response to "nmap -n -sn localhost": What kind of information did the nmap scan results show you, specifically? 2. FIB What does the "-sn" option do in nmap? ping scan -disable port scan 3. SR How does the "-sn" ...

Autonomous consumptionnbsp 660marginal propensity to

Autonomous consumption  = 660 Marginal propensity to consume  = 0.8 Autonomous taxation  = 200 Income tax rate =  0.2 Planned investment  = 500 Government spending  = 500 Autonomous net exports  = 300 NX  = 0.04 Calculat ...

Assignment descriptionproject scope a typical

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As