Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Protected Member Functions | Protected Attributes

simgrid::msg::Process Class Reference

Public Member Functions

 Process (String hostname, String name) throws HostNotFoundException
 Process (String hostname, String name, String args[]) throws HostNotFoundException, NativeException
 Process (Host host, String name)
 Process (Host host, String name, String[]args)
void pause ()
void restart ()
boolean isSuspended ()
Host getHost ()
int getPID ()
int getPPID ()
void migrate (Host host)
void run ()
abstract void main (String[]args) throws MsgException
void taskSend (String mailbox, Task task, double timeout) throws TransferFailureException, HostFailureException, TimeoutException
void taskSend (String mailbox, Task task) throws TransferFailureException, HostFailureException, TimeoutException
Task taskReceive (String mailbox) throws TransferFailureException, HostFailureException, TimeoutException
Task taskReceive (String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException
Task taskReceive (String mailbox, double timeout, Host host) throws TransferFailureException, HostFailureException, TimeoutException
Task taskReceive (String mailbox, Host host) throws TransferFailureException, HostFailureException, TimeoutException

Static Public Member Functions

static int killAll (int resetPID)
static Process fromPID (int PID) throws NativeException
static Process currentProcess ()
static void waitFor (double seconds) throws HostFailureException

Data Fields

long bind
long id
Vector< String > args

Static Public Attributes

static long nextProcessId = 0

Protected Member Functions

 Process ()
void addArg (String arg)

Protected Attributes

String name

Detailed Description

A process may be defined as a code, with some private data, executing in a location (host). All the process used by your simulation must be declared in the deployment file (XML format). To create your own process you must inherit your own process from this class and override the method "main()". For example if you want to use a process named Slave proceed as it :

(1) import the class Process of the package simgrid.msg import simgrid.msg.Process;

public class Slave extends simgrid.msg.Process {

(2) Override the method function

 * 	public void main(String[] args) {
 *		System.out.println("Hello MSG");
 *	}
 *  

} The name of your process must be declared in the deployment file of your simulation. For the example, for the previous process Slave this file must contains a line : <process host="Maxims" function="Slave"/>, where Maxims is the host of the process Slave. All the process of your simulation are automatically launched and managed by Msg. A process use tasks to simulate communications or computations with another process. For more information see Task. For more information on host concept see Host.


Constructor & Destructor Documentation

simgrid::msg::Process::Process (  )  [inline, protected]

Default constructor (used in ApplicationHandler to initialize it)

simgrid::msg::Process::Process ( String  hostname,
String  name 
) throws HostNotFoundException [inline]

Constructs a new process from the name of a host and his name. The method function of the process doesn't have argument.

Parameters:
hostname The name of the host of the process to create.
name The name of the process.
Exceptions:
HostNotFoundException if no host with this name exists.
simgrid::msg::Process::Process ( String  hostname,
String  name,
String  args[] 
) throws HostNotFoundException, NativeException [inline]

Constructs a new process from the name of a host and his name. The arguments of the method function of the process are specified by the parameter args.

Parameters:
hostname The name of the host of the process to create.
name The name of the process.
args The arguments of the main function of the process.
Exceptions:
HostNotFoundException if no host with this name exists. NativeException
simgrid::msg::Process::Process ( Host  host,
String  name 
) [inline]

Constructs a new process from a host and his name. The method function of the process doesn't have argument.

Parameters:
host The host of the process to create.
name The name of the process.
simgrid::msg::Process::Process ( Host  host,
String  name,
String[]  args 
) [inline]

Constructs a new process from a host and his name, the arguments of here method function are specified by the parameter args.

Parameters:
host The host of the process to create.
name The name of the process.
args The arguments of main method of the process.

Member Function Documentation

static int simgrid::msg::Process::killAll ( int  resetPID  )  [inline, static]

This method kills all running process of the simulation.

Parameters:
resetPID Should we reset the PID numbers. A negative number means no reset and a positive number will be used to set the PID of the next newly created process.
Returns:
The function returns the PID of the next created process.
void simgrid::msg::Process::addArg ( String  arg  )  [inline, protected]

This method adds an argument in the list of the arguments of the main function of the process.

Parameters:
arg The argument to add.
void simgrid::msg::Process::pause (  )  [inline]

Suspends the process by suspending the task on which it was waiting for the completion.

void simgrid::msg::Process::restart (  )  [inline]

Resumes a suspended process by resuming the task on which it was waiting for the completion.

boolean simgrid::msg::Process::isSuspended (  )  [inline]

Tests if a process is suspended.

Returns:
The method returns true if the process is suspended. Otherwise the method returns false.
Host simgrid::msg::Process::getHost (  )  [inline]

Returns the host of a process.

Returns:
The host instance of the process.
Exceptions:
NativeException on error in the native SimGrid code
static Process simgrid::msg::Process::fromPID ( int  PID  )  throws NativeException [inline, static]

This static method gets a process from a PID.

Parameters:
PID The process identifier of the process to get.
Returns:
The process with the specified PID.
Exceptions:
NativeException on error in the native SimGrid code
int simgrid::msg::Process::getPID (  )  [inline]

This method returns the PID of the process.

Returns:
The PID of the process.
int simgrid::msg::Process::getPPID (  )  [inline]

This method returns the PID of the parent of a process.

Returns:
The PID of the parent of the process.
static Process simgrid::msg::Process::currentProcess (  )  [inline, static]

This static method returns the currently running process.

Returns:
The current process.
void simgrid::msg::Process::migrate ( Host  host  )  [inline]

Migrates a process to another host.

Parameters:
host The host where to migrate the process.
static void simgrid::msg::Process::waitFor ( double  seconds  )  throws HostFailureException [inline, static]

Makes the current process sleep until time seconds have elapsed.

Parameters:
seconds The time the current process must sleep.
Exceptions:
HostFailureException on error in the native SimGrid code
void simgrid::msg::Process::run (  )  [inline]

This method runs the process. Il calls the method function that you must overwrite.

abstract void simgrid::msg::Process::main ( String[]  args  )  throws MsgException [pure virtual]

The main function of the process (to implement).

void simgrid::msg::Process::taskSend ( String  mailbox,
Task  task,
double  timeout 
) throws TransferFailureException, HostFailureException, TimeoutException [inline]

Send the given task in the mailbox associated with the specified alias (waiting at most given time)

Exceptions:
TimeoutException 
HostFailureException 
TransferFailureException 
void simgrid::msg::Process::taskSend ( String  mailbox,
Task  task 
) throws TransferFailureException, HostFailureException, TimeoutException [inline]

Send the given task in the mailbox associated with the specified alias

Exceptions:
TimeoutException 
HostFailureException 
TransferFailureException 
Task simgrid::msg::Process::taskReceive ( String  mailbox  )  throws TransferFailureException, HostFailureException, TimeoutException [inline]

Receive a task on mailbox associated with the specified mailbox

Task simgrid::msg::Process::taskReceive ( String  mailbox,
double  timeout 
) throws TransferFailureException, HostFailureException, TimeoutException [inline]

Receive a task on mailbox associated with the specified alias (waiting at most given time)

Task simgrid::msg::Process::taskReceive ( String  mailbox,
double  timeout,
Host  host 
) throws TransferFailureException, HostFailureException, TimeoutException [inline]

Receive a task on mailbox associated with the specified alias from given sender

Task simgrid::msg::Process::taskReceive ( String  mailbox,
Host  host 
) throws TransferFailureException, HostFailureException, TimeoutException [inline]

Receive a task on mailbox associated with the specified alias from given sender


Field Documentation

This attribute represents a bind between a java process object and a native process. Even if this attribute is public you must never access to it. It is set automatically during the build of the object.

Even if this attribute is public you must never access to it. It is used to compute the id of an MSG process.

Even if this attribute is public you must never access to it. It is compute automatically during the creation of the object. The native functions use this identifier to synchronize the process.

String simgrid::msg::Process::name [protected]

The name of the process.

The arguments of the method function of the process.


Back to the main Simgrid Documentation page Generated for SimGridAPI by doxygen