X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/664906a2f0058fcf83456ff2f4e7a3dbf97d4afe..e1c1a57d9f9a058f64abc00f8671d3a7c3d68f6b:/src/simix/README_attempt_without_stack diff --git a/src/simix/README_attempt_without_stack b/src/simix/README_attempt_without_stack index 4985d0cc97..4ad29b0812 100644 --- a/src/simix/README_attempt_without_stack +++ b/src/simix/README_attempt_without_stack @@ -46,7 +46,7 @@ A simple to use and efficient trace parser is also provided: void replay_trace_reader_free(replay_trace_reader_t *reader); /* get a new event. Don't free the content, strdup what you want to keep after next call to reader_get() */ - const char * const*replay_trace_reader_get(replay_trace_reader_t r); + const char **replay_trace_reader_get(replay_trace_reader_t r); /* return a "file:pos" description of the last thing we read. */ const char *replay_trace_reader_position(replay_trace_reader_t r); Check replay_trace_reader.c for souce code, and replay_MPI.c for @@ -59,22 +59,22 @@ Dark side: restrictions on user code The incredible performance of this approach comes at a price: using SimGrid this way is a *real* pain in the ass. You cannot use MSG nor -GRAS nor SMPI nor nothing (because none of these interfaces were coded +SMPI nor nothing (because none of these interfaces were coded with the *extrem* requirement of the state_machine in mind), and you -can only rely on SIMIX. From SIMIX, you can only use requests (ie, the -SIMIX_req_* functions). Moreover, you must know that each blocking -request will result in an interruption of your execution flow. +can only rely on SIMIX. From SIMIX, you can only use simcalls (ie, the +simcall_* functions). Moreover, you must know that each blocking +simcall will result in an interruption of your execution flow. Let's take an example: If your code contains: - smx_action_t act = SIMIX_req_comm_isend(......); - SIMIX_req_comm_wait(act); - SIMIX_req_comm_destroy(act); + smx_action_t act = simcall_comm_isend(......); + simcall_comm_wait(act); + simcall_comm_destroy(act); The execution flow is interrupted brutally somewhere within -SIMIX_req_comm_isend(), the variable act will never be set (and any +simcall_comm_isend(), the variable act will never be set (and any code written after the first line is discarded). -Indeed each SIMIX syscall results in an interruption of the calling +Indeed each SIMIX simcall results in an interruption of the calling process, but in state_machine there is only one system stack and the whole state describing the process is in the structure describing it. So, when we need to remove one process from the system, to pause it, @@ -83,10 +83,10 @@ in which maestro put it, whatever what the user process put on it. In short, each time simix wants to interrupt a process, state_machine does a longjmp(2) to the point just before calling the user code. As a -result, each time you do a syscall, your stack is destroyed to restore +result, each time you do a simcall, your stack is destroyed to restore it in the state where maestro put it before calling your code. -This means that you cannot do anything after a syscall, and that the +This means that you cannot do anything after a simcall, and that the stack is not a safe storing area for your data. So, you have to write your code as a state machine, with a big ugly @@ -97,14 +97,14 @@ run_fun(globals, res) { switch (globals->state) { case l1: /* default value st. we take that branch the first time */ globals->state = l2; - SIMIX_req_comm_isend(....); /* syscall=>hard interrupt on our code*/ + simcall_comm_isend(....); /* syscall=>hard interrupt on our code */ case l2: /* we'll take that branch the second time we're scheduled */ globals->comm = res; globals->state = l3; - SIMIX_req_comm_wait(globals->comm); /* syscall=>interrupt */ + simcall_comm_wait(globals->comm); /* syscall=>interrupt */ case l3: globals->state = where_you_want_to_go_today; - SIMIX_req_comm_destroy(globals->comm); + simcall_comm_destroy(globals->comm); } } @@ -113,4 +113,4 @@ argument to the run_fun(). Isn't all this beautifully awful?? A few gotos in your code are just -what you need to go 20 years back to the good old time of gwbasic... \ No newline at end of file +what you need to go 20 years back to the good old time of gwbasic...