tkPvm Commands

The latest version of this file can be found at http://www.nici.kun.nl/tkpvm/commands.html

The following commands are currently implemented. Four commands are borrowed from Tk4.0, because they are usefull in pvmsh too.

Data types

In Tcl, string is the only known data type. In pvm any data type can be used. Therefore an automatic conversion is done implicitely, using the following rules: This means that a string containing "1.0" will be sent as a double, even if it is not meant to be. If the receiving process expects a string, this will go wrong. Also, it is impossible now to send floats, so always use doubles. Characters and short integers have the same problem. Use integers instead.

Task identifiers

In pvm each process has a unique number, which is called the task identifier (tid). This number is used when sending or receiving packages through pvm. The keywords id or parent are accepted as tid too. This allows the use of send parent ... in stead of send [parent] ...

Message tags

Each package that is sent or receives also has a message tag (msgtag). This can be seen as a channel number, which can be checked at the receiving side for many different purposes. Always use non-negative numbers for this (0 is valid).


Addhost

SYNOPSIS
addhost hostname ?hostname .....?
DESCRIPTION
Add hosts to the virtual machine.

After

SYNOPSIS
after ms ?command?
after idle command
after cancel id/command
DESCRIPTION
If ms is specigied, arrange for command to be run in ms milliseconds. If the command is not specified, the program will sleep for ms milliseconds.
If idle is specified, arrange for command to be run later when the program is idle.
These after commands can be cancelled later, using after cancel. Then id can be used, which is a handle returned by after

Bind

SYNOPSIS
bind tid msgtag ?command?
bind tid any ?command?
bind tid kill ?command?
DESCRIPTION
Bind the given command to the given tid/msgtag combination. Any time later when data is received through pvm, the command wil be executed. The keyword 'any' matches any tid or msgtag, but not the keyword kill. kill can be used to execute any command as soon as the process tid is killed.

During execution of command, only data that matches tid and msgtag can be received, So the recv command doesn't need to specify it any more. Inside the command there are 3 macro's that can be used to find out additional information about the received data:

%t
tid
%m
msgtag
%n
total number of bytes received.
This is usefull if tid ormsgtag (or both) have the value any.

If command is the empty string, the binding is deleted. If the command is missing, the currently bound command is returned.

Delhost

SYNOPSIS
delhost hostname ?hostname .....?
DESCRIPTION
Delete hosts from the virtual machine.

Dialog (not implemented yet)

SYNOPSIS
dialog title text bitmap default string ?string .....?
DESCRIPTION
Pops up dialog with a button for each string argument. Returns index of button user presses, starting from 0 or the leftmost button. The index default specifies the default button.

Exit

SYNOPSIS
exit ?errorcode?
DESCRIPTION
Exit this process.

Fileevent

SYNOPSIS
fileevent fileId readable|writable script
DESCRIPTION
Execute script wheneve file with handle fileId becomes readable/writable.

Halt

SYNOPSIS
halt
DESCRIPTION
Halt the virtual machine, killing all processes and daemons.

Id

SYNOPSIS
id
DESCRIPTION
Returns my own tid.

Joingroup

SYNOPSIS
joingroup groupname
DESCRIPTION
Join the group groupname. The instance number (starting with 0) is returned.

Kill

SYNOPSIS
kill tid ?tid .....?
DESCRIPTION
Kill the processes with the given tid's.

Leavegroup

SYNOPSIS
leavegroup groupname
DESCRIPTION
Leave the group groupname.

Parent

SYNOPSIS
parent ?tid?
DESCRIPTION
Returns the parent of tid. If this process has no parent, the result will be empty
If tid is not specified, id is assumed.

Recv

SYNOPSIS
recv arg ?arg...?
DESCRIPTION
Receive data from another process. The arguments indicate the expected format of the received data, and can have the following values:
char
character
string
string
int
integer
tid
task identifier. This is in fact the same as an integer, only the value is returned in hexadecimal notation
float
floating point
double
double
Note that although a pvmsh application cannot send characters and floats, receiving them is no problem.

The data will be received from the channel that currently is open. Generally this is specified by the bind command.

Reset

SYNOPSIS
reset
DESCRIPTION
Kill all processes, except myself.

Send

SYNOPSIS
send tid msgtag arg ?arg...?
send groupname msgtag arg ?arg...?
DESCRIPTION
Send all arguments to tid or groupname through channel msgtag. The arguments are sent as integers, doubles or string in accordance with the above conversion rules.

Spawn

SYNOPSIS
spawn ?options? name ?options?
DESCRIPTION
The given process will be spawned. Options:
-ntask num
number of taskes
-host hostname
which host
-arch arch
which architecture
-output fileId
redirect output of spawned processes to a file (e.g. stdout)
All options after name are options for the spawned process. These are not interpreted by pvmsh or pvmwish.

The spawn command returns a list of tid's that later can be used in other commands. An error is genereted if no processes can be spawned.

Term

SYNOPSIS
term name ?command?
DESCRIPTION
Pops up a text display. A new command name is defined that puts text on this display. If the user presses return anywhere, the content of the current line will be appended to command and executed.
EXAMPLE
term t1 puts stdout
t1 "This text is displayed"

Everything the user types on the text display will be written to stdout.

Tasks

SYNOPSIS
tasks
DESCRIPTION
Returns a list of all tid's running in the virtual machine.

Tkwait

SYNOPSIS
tkwait variable varName
DESCRIPTION
Pause program until global variable varName is modified.

Update

SYNOPSIS
update
update idletasks
DESCRIPTION
Handle pending events. If idletask is specified, only those operations normally deferred until idle state are processed.
Back to Home
written by J. Nijtmans for the MIAMI project