Newsgroups: comp.parallel.pvm
From: Zheng Gengbing <zheng.gb@svr.bimp.pku.edu.cn>
Subject: Re: pvm_insert and pvm_locate
Organization: Peking Universary,China
Date: Fri, 5 May 1995 10:05:35 +0800
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Message-ID: <Pine.HPP.3.91.950505095048.21633A@svr.bimp.pku.edu.cn>

On 3 May 1995, Robert J. Block wrote:

> Hi, all.
> 
> I'm having a problem using the functions pvm_insert and pvm_locate
> in a very simple pair of programs I wrote that are trying to act
> like a client and server. 
> 
> The server does:
> 
> 	server_tid = pvm_mytid();
>   	pvm_insert("theserver", 0, server_tid);
> 	printf("server running, task id = %d\n", server_tid);
> 
> 	... waits for clients to call ...
> 
> 
> The client does:
> 
> 	int mytid = pvm_mytid();
> 	ret = pvm_lookup("theserver", 0, &server_tid);
> 
> 	... queries server for various stuff ...
> 
> The problem is, the client doesn't receive the correct tid from
> lookup.  It always gets the tid of the FIRST task that was started
> under the current pvm session, which is 262146 (hex 40002).
> So if I just initiated the pvm session and fire off the server,
> the client gets the correct tid, but any time afterwards it gets
> the wrong one.
> 
> I also tried changing the second parameter from 0 to -1 in both
> function calls, but with no difference.
> 
> Can someone who knows how these functions work please help me out?
> 
> Thanks,
> Rob Block (rblock@ncsa.uiuc.edu)
>  
> 
> 
> 


I found another thing interesting -- If you spawn the server program in PVM 
console ,the answer of client is always correct , however,the client always 
gets tid of 262146 if you run server  in shell prompt.
Also, the server should be started only once except you use the index -1 ,
or pvm_insert  will return  PvmDupEntry . 


--------------------------------------------------------------------------------
Gengbin Zheng                       *         Phone :  86-10-2585088
Computer Science Dept.              *         Email :   
Beijing University                  *            zheng.gb@svr.bimp.pku.edu.cn
Beijing 100871                      *
P.R.CHINA                           *
--------------------------------------------------------------------------------



