[contributed by Sékou Diakite, many thanks]
GRAS:
- * Introduce a listener thread in charge of receiving incomming
+ * Introduce a listener thread in charge of receiving incoming
messages from the network. It allows to overlap communication and
computation but most notably, it removes some stupid deadlocks due
to the fact that so far, a process could not send and receive at
messages during the transition associated to this event.\n
\n
Incoming messages are not handled as soon as they arrive, but only when
- the process declares to be ready to accept incomming events (using \ref
+ the process declares to be ready to accept incoming events (using \ref
gras_msg_handle or related functions). It ensures that the treatment of a
given message won't run in parallel to any other callback, so that
process globals (its state) can be accessed and modified without
\n
Processes can also wait explicitely for incoming messages matching some
given criterions (using \ref gras_msg_wait). Any messages received before the
- one matching the criterions will be added to the incomming messages'
+ one matching the criterions will be added to the incoming messages'
queue for further use. This may breaks the message delivery order.
Moreover, there is no restriction on when this can be done. So, a
callback to a given message can consume messages of other types. There is
<li>Process A sends a first message (depicted in red) with gras_msg_send(), do
some more computation, and then send another message (depicted in
- yellow). Then, this process handles any incomming message with
+ yellow). Then, this process handles any incoming message with
gras_msg_handle(). Since no message is already queued in process A at this
point, this is a blocking call until the third message (depicted in
magenta) arrives from the other process.</li>
<li>On its side, the process B explicitely wait for the second message with
gras_msg_wait(), do some computation with it, and then call
- gras_msg_handle() to handle any incomming message. This will pop the red
+ gras_msg_handle() to handle any incoming message. This will pop the red
message from the queue, and start the callback attached to that kind of
messages. This callback sends back a new message (depicted in magenta) back
to process A.</li>
from the receiver point of view.</li>
<li>gras_msg_wait() and gras_msg_handle() accept timeouts as argument to
-specify how long you are willing to wait at most for incomming messages. These
+specify how long you are willing to wait at most for incoming messages. These
were ignored here to not complexify the example any further. It is worth
mentionning that the send operation cannot be timeouted. The existance of the
listener should make it useless.</li>
\subsection GRAS_tut_intro_model_timing_policy Timing policy
All communication primitives allow 3 timout policies: one can only poll for
-incomming events (using timeout=0), wait endlessly for the communication to
+incoming events (using timeout=0), wait endlessly for the communication to
be performed (using timeout<0) or specify a maximal delay to wait for the
communication to proceed (using timeout>0, being a number of seconds).
It is important to note that timers are not prehemptive. They will not start
as soon as they are ready. Instead, they get served when you go into
-gras_msg_handle() (and they are served before incomming messages). This is
+gras_msg_handle() (and they are served before incoming messages). This is
because allowing timers to run in parallel to the callbacks would add
parallelism to the user code, which would have to protect data with mutexes.
This is a level of complexity I really don't want for user code. If you
The core of our distributed service is implemented (protocol, actions on
server side, and accessing function on client side). We should now
-initialize the server and let it wait for incomming messages.
+initialize the server and let it wait for incoming messages.
Defining when to stop the server can become tricky. The simplest solution is
to never let the server stop. It simply runs forever. But the simulator will
to attach a callback to the message. Of course, you usualy don't want to do
so on every nodes, but only on "servers" or "workers" or such. First of all,
you need to declare the callback itself. This function that will be executed
-on request incomming must follow a very specific prototype (the same
+on request incoming must follow a very specific prototype (the same
regardless of the call semantic):
\verbatim
2 2 0 1 0 7 250 -1 20 0.000 0 0 -1 0 0 5
21555 3870 19125 3870 19125 7470 21555 7470 21555 3870
4 0 0 240 -1 0 12 0.0000 2 90 435 19260 4635 name\001
-4 0 0 240 -1 0 12 0.0000 2 180 2385 19260 7110 incomming_communications\001
+4 0 0 240 -1 0 12 0.0000 2 180 2385 19260 7110 incoming_communications\001
4 0 0 240 -1 0 12 0.0000 2 180 2205 19260 7335 outgoing_communications\001
4 0 0 240 -1 0 12 0.0000 2 135 165 19260 6885 id\001
4 0 0 240 -1 0 12 0.0000 2 180 1200 19260 4410 type (cpu|link)\001
xbt_socket_my_port(globals->sock));
globals->endcondition = 0;
- /* 6. Wait up to 20 minutes for an incomming message to handle */
+ /* 6. Wait up to 20 minutes for an incoming message to handle */
gras_msg_handle(20.0);
/* 7. Housekeeping */
/* 5. Register my callback */
gras_cb_register("request", &server_cb_request_handler);
- /* 6. Wait up to 10 minutes for an incomming message to handle */
+ /* 6. Wait up to 10 minutes for an incoming message to handle */
gras_msg_handle(600.0);
/* 7. Free the allocated resources, and shut GRAS down */
XBT_INFO("Launch server (port=%d)", port);
sock = try_gras_socket_server(port);
- /* 6. Wait up to 10 minutes for an incomming message to handle */
+ /* 6. Wait up to 10 minutes for an incoming message to handle */
gras_msg_handle(600.0);
/* 7. Free the allocated resources, and shut GRAS down */
}
}
- /* 8. Wait up to 10 seconds for an incomming message to handle */
+ /* 8. Wait up to 10 seconds for an incoming message to handle */
while (globals->remaining_loop > (globals->create ? -1 : 0)) {
gras_msg_handle(-1);
xbt_socket_my_port(globals->sock));
globals->endcondition = 0;
- /* 6. Wait up to 10 minutes for an incomming message to handle */
+ /* 6. Wait up to 10 minutes for an incoming message to handle */
gras_msg_handle(10.0);
/* 7. Housekeeping */
XBT_INFO("Listening on port %d", xbt_socket_my_port(mysock));
- /* 5. Wait for the ping incomming messages */
+ /* 5. Wait for the ping incoming messages */
/** \bug if the server is gone before the forwarder tries to connect,
it dies awfully with the following message. The problem stands somewhere
* @hideinitializer
* @param timeout: How long should we wait for this message.
* @param msgt_want: type of awaited msg
- * @param[out] expeditor: where to create a socket to answer the incomming message
- * @param[out] payload: where to write the payload of the incomming message
+ * @param[out] expeditor: where to create a socket to answer the incoming message
+ * @param[out] payload: where to write the payload of the incoming message
* @return the error code (or no_error).
*
* Every message of another type received before the one waited will be queued
* right answer from the right host and so on. Any exception raised on the
* server is also passed over the network to the client.
*
- * Callbacks are attached to RPC incomming messages the regular way using
+ * Callbacks are attached to RPC incoming messages the regular way using
* \ref gras_cb_register.
*
* For an example of use, check the examples/gras/rpc directory of the distribution.
group communication
*/
- e_gras_msg_kind_count = 5 /* sentinel, dont mess with */
+ e_gras_msg_kind_count = 5 /* sentinel, don't mess with */
} e_gras_msg_kind_t;
* and such within a specific process.
*
* Timers are served by the gras_handle() function: if there is an elapsed
- * timer, the associated code gets executed before any incomming connexion
+ * timer, the associated code gets executed before any incoming connexion
* are checked.
*
* The section \ref GRAS_ex_timer constitutes a perfect example of these features.
/* @{ */
-/** \brief Opaque type describing a type description callback persistant state. */
+/** \brief Opaque type describing a type description callback persistent state. */
typedef struct s_xbt_cbps *xbt_cbps_t;
/* callbacks prototypes */
*/
static int msg_register_platform(lua_State * L)
{
- /* Tell Simgrid we dont wanna use its parser */
+ /* Tell Simgrid we don't wanna use its parser */
//surf_parse = console_parse_platform;
surf_parse_reset_callbacks();
MSG_create_environment(NULL);
*
* @param timeout: How long should we wait for this message.
* @param msgt_want: type of awaited msg
- * @param[out] expeditor: where to create a socket to answer the incomming message
- * @param[out] payload: where to write the payload of the incomming message
+ * @param[out] expeditor: where to create a socket to answer the incoming message
+ * @param[out] payload: where to write the payload of the incoming message
* @return the error code (or no_error).
*
* Every message of another type received before the one waited will be queued
* @param msgt_want: a dynar containing all accepted message type
* @param[out] ctx: the context of received message (in case it's a RPC call we want to answer to)
* @param[out] msgt_got: indice in the dynar of the type of the received message
- * @param[out] payload: where to write the payload of the incomming message
+ * @param[out] payload: where to write the payload of the incoming message
* @return the error code (or no_error).
*
* Every message of a type not in the accepted list received before the one
} while (period - now + begin > 0);
}
-/** @brief Handle an incomming message or timer (or wait up to \a timeOut seconds)
+/** @brief Handle an incoming message or timer (or wait up to \a timeOut seconds)
*
* @param timeOut: How long to wait for incoming messages (in seconds)
* @return the error code (or no_error).
volatile unsigned int cpt2 = cpt;
if (!ran_ok) {
XBT_DEBUG
- ("Use the callback #%u (@%p) for incomming msg '%s' (payload_size=%d)",
+ ("Use the callback #%u (@%p) for incoming msg '%s' (payload_size=%d)",
cpt + 1, cb, msg.type->name, msg.payl_size);
if (!cb(&ctx, msg.payl)) {
/* cb handled the message */
typedef struct s_gras_msg_listener_ {
xbt_thread_t listener; /* keep this first, gras_socket_im_the_server() does funky transtyping in sg_msg.c */
- xbt_queue_t incomming_messages; /* messages received from the wire and still to be used by master */
+ xbt_queue_t incoming_messages; /* messages received from the wire and still to be used by master */
xbt_queue_t socks_to_close; /* let the listener close the sockets, since it may be selecting on them. Darwin don't like this trick */
xbt_socket_t wakeup_sock_listener_side;
xbt_socket_t wakeup_sock_master_side;
I'm not the user process but I'm just the listener. Too bad */
XBT_VERB("Got a '%s' message (%s) from sock %p. Queue it for handling by main thread",
gras_msgtype_get_name(msg->type),e_gras_msg_kind_names[msg->kind],msg->expe);
- xbt_queue_push(me->incomming_messages, msg);
+ xbt_queue_push(me->incoming_messages, msg);
} else {
char got = *(char *) msg->payl;
if (got == '1') {
gras_msg_listener_t arg = xbt_new0(s_gras_msg_listener_t, 1);
XBT_VERB("Launch listener");
- arg->incomming_messages = msg_received;
+ arg->incoming_messages = msg_received;
arg->socks_to_close = xbt_queue_new(0, sizeof(int));
arg->init_mutex = xbt_mutex_init();
arg->init_cond = xbt_cond_init();
xbt_thread_join(pd->listener->listener);
// gras_socket_close(pd->listener->wakeup_sock_master_side); FIXME: uncommenting this leads to deadlock at terminaison
- xbt_queue_free(&pd->listener->incomming_messages);
+ xbt_queue_free(&pd->listener->incoming_messages);
xbt_queue_free(&pd->listener->socks_to_close);
xbt_free(pd->listener);
}
int pid; /* pid of process, only for SG */
int ppid; /* ppid of process, only for SG */
- gras_msg_listener_t listener; /* the thread in charge of the incomming communication for this process */
+ gras_msg_listener_t listener; /* the thread in charge of the incoming communication for this process */
} gras_procdata_t;
gras_procdata_t *gras_procdata_get(void);
}
}
- XBT_DEBUG("Min for resources (remember that NS3 dont update that value) : %f", min);
+ XBT_DEBUG("Min for resources (remember that NS3 don't update that value) : %f", min);
XBT_DEBUG("Looking for next trace event");
-/* cbps - persistant states for callbacks */
+/* cbps - persistent states for callbacks */
/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
* All rights reserved. */
#include "xbt/ex.h"
#include "xbt/datadesc/datadesc_private.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_cbps, xbt_ddt,
- "callback persistant state");
+ "callback persistent state");
typedef struct {
xbt_datadesc_type_t type;
enum e_xbt_dd_scalar_encoding encoding);
/****************************************************
- * Callback persistant state constructor/destructor *
+ * Callback persistent state constructor/destructor *
****************************************************/
xbt_cbps_t xbt_cbps_new(void);
void xbt_cbps_free(xbt_cbps_t * state);
cpp = cpp->nextSibling;
}
- XBT_DEBUG("Childs of %s: %s; nextSibling: %s",
+ XBT_DEBUG("Children of %s: %s; nextSibling: %s",
category->parent->name, res,
(category->parent->nextSibling ?
category->parent->nextSibling->name : "none"));