mquinson [Sat, 27 Oct 2007 08:24:36 +0000 (08:24 +0000)]
Kill the useless _MSG_process_create_with_env_from_SIMIX(). _MSG_process_create_from_SIMIX() is part of the private API of MSG (I mean internal to the lib), so it can be changed without pissing of users
mquinson [Sat, 27 Oct 2007 07:34:39 +0000 (07:34 +0000)]
I think I now better understand the surf internals: each resource can be *either* a cpu or a link, so we can merge all the get_??_properties into only one method. No object will need both of them. This could be further improved by moving this to a function in surf directly instead of leaving this in models, but it would be the first attribute being handled that way, so I prefer keeping the pseudo object philosophy in place in surf
quasar [Fri, 26 Oct 2007 16:45:56 +0000 (16:45 +0000)]
* Cleanup the DTD by renaming:
<cpu> to <host>
<network_link> to <link>
<route_element> to <link:ctn>
"name" attributes to "id"
* Modify the DTD to add properties to <process>, <host> and <link>
In the DTD, these are <prop name=... value=...> subtags, and this
can be retrieved as a xbt_dict from the source code (see below)
* Add the following functions to the user API to retrieve (as
xbt_dict) the properties defined in XML:
xbt_dict_t SD_link_get_properties(SD_link_t link);
const char* SD_link_get_property_value(SD_link_t l,char* name);
and, on the same model,
SD_workstation_get_{properties,property_value}()
MSG_process_get_{properties,property_value}()
MSG_host_get_{properties,property_value}()
gras_process_get_{properties,property_value}()
gras_os_host_get_{properties,property_value}()
* Modify the parser to work in one pass only.
Some more work may be done so that surf does the parsing after the
models have declared the callbacks.
* Enforce the order in the DTD: routes must come after the last CPU,
router and link
cherierm [Fri, 26 Oct 2007 08:56:35 +0000 (08:56 +0000)]
This change the semantic of the timed function. The behavior depends now of the value of the parameters delay or timeout. If these parameters are negative, the timed function have the behavior of a blocking function. For example the following call : xbt_os_mutex_timedacquire(mutex,-1) is equivalent to xbt_os_mutex_acquire(mutex). If you set these parameters to zero
the timed function have the behavior of a try function. For example, to try to lock a mutex you must call the xbt_os_mutex_timedacquire() function with the parameter delay/timeout set to zero.
Finally, if you specify a delay more than zero, the timed function try to acquire the lock until the delay was expired, which is the normal behavior of the function.
Remark : the changes of the other files are the consequence of this new semantic : because the timed functions also implement the behavior of the try functions, theirs declarations and theirs definitions are removed.
cherierm [Thu, 25 Oct 2007 11:57:20 +0000 (11:57 +0000)]
Most of this change is the consequence of the refactoring of the name of the function connected to the mutex object and of the unsupported semaphore function on MAC OS X.
The file synchro.h rename the functions xbt_mutex_acquire() and xbt_mutex_release() to xbt_mutex_acquire() an respectively xbt_mutex_release().
This file also contains the declaration of two new functions xbt_mutex_tryacquire() and xbt_mutex_timedacquire(). The first
is the non blocking version of the function xbt_mutex_acquire() (if the lock is already owned by an other thread the function immediately
returns). The second function xbt_mutex_timedacquire() attempts to get the mutex during a specified delay (timeout), if the lock is not available
during this delay the function returns (throws a timeout exception). These functions (for the real life) are defined in the file xbt_rl_synchro.c and (for the simulation) in the file xbt_sg_synchro.c.
The header xbt_os_thread.h declare two new functions xbt_os_mutex_tryacquire() and xbt_os_mutex_timedaquire(). These functions represent
the implementation of the xbt_mutex_tryacquire() and xbt_mutex_timeacquire() for the real live.
These functions are implemented in the source code file xbt_os_thread.c.
The change in the files dynar.c and xbt_queue.c, philosopher.c and parallel_log_crashtest.c is the consequence of the refactoring of the functions previously described.
cherierm [Thu, 25 Oct 2007 11:55:34 +0000 (11:55 +0000)]
The configuration file visualc.h is change to declare the _WIN32_WINNT macro before the inclusion of the windows.h header (this permits to use the TryEnterCriticalSection() only available if the previous macro is more or equals to 0x400).
mquinson [Tue, 23 Oct 2007 13:43:32 +0000 (13:43 +0000)]
Do not include the useless semaphore standard header. It's not needed, and moreover, it seems to load stdio itself. So, loading semaphore from here causes getline to become undefined since stdio.h is loaded before portable.h got a chance to declare _GNU_SOURCE
mquinson [Tue, 23 Oct 2007 13:29:19 +0000 (13:29 +0000)]
* Check that sem_timedwait is available (since it's not on mac osx)
* Check only once that pthread is available (and use previous result
the second time)
* Remove a useless rewrite (s/pthreads/pthread/) in with_context since
nobody ever put pthreads as a value to this variable.
cherierm [Tue, 23 Oct 2007 09:42:53 +0000 (09:42 +0000)]
This new directory contains two samples explaining the usage of the semaphore interface provide by the xbt layer.
The first example : sem_basic, show how to use a semaphore to manage the access of a global variable shared by multiple threads.
The second example : sem_sched, show how to use the semaphore interface to implement a simple context switch based on threads.
cherierm [Tue, 23 Oct 2007 09:37:14 +0000 (09:37 +0000)]
This change is about the refactoring of the source code of the objects use int the msg synchronization mechanism :
- the functions xbt_os_mutex_lock() and xbt_os_mutex_unlock() are renamed xbt_os_mutex_acquire() and xbt_os_mutex_release() respectively
- the functions xbt_os_sem_wait() and xbt_os_sem_post() are renamed xbt_os_sem_acquire() and xbt_os_sem_release() respectively
This renaming impacts the folowing files :
- xbt_os_thread.h and xbt_os_thread.c
- context.c
- xbt_rl_synchro.c
- run_context.c
In addition the function unschedule() declared an defined in the file context.c is renamed yield().
The prototype of the function xbt_os_sem_init() takes now only one parameter : the initial value of the semaphore.
The second parameter of the function xbt_os_sem_timedacquire() which replace the function xbt_os_sem_timedwait() is now a double (desired timeout in seconds).
To finish, the semaphore interface of the xbt portability layer does not expose the functions xbt_os_sem_open() and xbt_sem_close().
cherierm [Mon, 22 Oct 2007 09:29:37 +0000 (09:29 +0000)]
This change exports the gras_procdata pointer and use the Win32 function GetCurrentProcessId() instead the function GetCurrentProcess() to get the process identifier
cherierm [Mon, 22 Oct 2007 09:02:24 +0000 (09:02 +0000)]
Visual C++ already declare the environ variable in the stdlib.h. So this redeclaration cause a warning for this compiler. The declaration of this variable is now platform depend (WIN32 doesn't need this declaration). The pointer of the callback functions context default an context terminate are now exported in the Win32 dll.
cherierm [Mon, 22 Oct 2007 08:51:31 +0000 (08:51 +0000)]
This change concerne the usage of the semaphore object instead the variable condition to synchronize the msg processes during a simulation.
The xbt_os_sem_t type represents a semaphore and you' ll find its declaration in the header xbt_os_thread.h and its implementation in the file xbt_os_thread.c.
The file portable.h is modified to declare the function gettimeofday() used by many several other functions such the function xbt_os_sem_timedwait() declared in
the header xbt_os_thread.h. The context structure declared in the header context_private.h is modified to use the semaphore instead the condition variable.
cherierm [Mon, 22 Oct 2007 08:37:06 +0000 (08:37 +0000)]
This, modify the declaration of type of function pointer. It also clear the warnings throws by the compiler Visual C++ when occurs a comparison between an unsigned with and a signed integer.
mquinson [Sun, 21 Oct 2007 07:46:30 +0000 (07:46 +0000)]
Kill a rather outdated section.
Most parts are now in the History document, for the curious.
The rest, such as "we want to make everything as clean as possible
before releasing SimGrid v.3" can certainly be removed now that
SimGrid v3 is released since two years.
mquinson [Thu, 11 Oct 2007 07:41:42 +0000 (07:41 +0000)]
Move string buffers from 'private to tesh' to 'public in xbt' (I'm gonna use them in logs for messages too long to fit into the statically sized string buffer)
mquinson [Wed, 10 Oct 2007 22:44:47 +0000 (22:44 +0000)]
Let's play safe here and don't loose the first char if the socket was already tested alive in hte last select, but not read from by caller (which would be such a weirdo)
mquinson [Wed, 10 Oct 2007 22:41:46 +0000 (22:41 +0000)]
Change completely the test to use messages instead of mucking directly with the transport layer: the listener thread won't let us play in his garden so easily
mquinson [Wed, 10 Oct 2007 15:54:23 +0000 (15:54 +0000)]
Do not use recv() but read() to check whether a socket returned by select() is valid to use or good to close. That way, it works not only for real sockets but also for file ones. This implies having a 1-byte-long buffer in the socket for the data we got during this check, and using this micro buffer before the rest of the content in the gras_*_recv()
mquinson [Wed, 10 Oct 2007 12:26:22 +0000 (12:26 +0000)]
Some more debugging, plus killing a stupid bug: when searching in a tree, exploring the first branch [and raising a not_found exception on the first leave] is not quite enough
mquinson [Tue, 9 Oct 2007 14:45:00 +0000 (14:45 +0000)]
Some comments in the initalization of categories. Once again, remove the misplaced WIN portability cruft. Malek, search for your name in the comments...