Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This commit concerned the reimplementation of the xbt context switch mechanism.
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Nov 2007 18:06:01 +0000 (18:06 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 15 Nov 2007 18:06:01 +0000 (18:06 +0000)
The gaol of this reimplementation is to separate the context switch mechanism of its implementation
(context switch implementation based ucontext, based native threads or java threads).
To do this, the code introduce a new concept : the context factory. This factory is responsible of
the construction of the context adapted to the desired context implementation. Normally, the context factory
to use is selected during the compilation process. But, for the java implementation of the context switch,
the simgrid library select dynamically the context factory to use (the java context factory to use). This
change also introduce three new concepts : the xbt_ucontext_t, the xbt_jcontext_t and the xbt_thread_context_t
which derived from the concept xbt_context_t. Each of them is specialized to respect an interface contract.
This contract is represented by function pointers such (start, stop, kill, schedule, yield...). For more details
on this function pointers see the source code file xbt_context.c.

The continuation gives the list of the modified, deleted and added files by this change.

Modified files:

src/msg/global.c get_pid is a function pointer
src/msg/private.h use xbt_context.h instead context.h

src/include/simix/simix.h        java process management functions are not needed now

src/java/simgrid/msg/ApplicationHandler.java   remove an useless printed message
src/java/simgrid/msg/msg.java        simgrid for java and simgrid are now the same library so the name of the java library is also simgrid
       add the call of the native function selectContextFactory() for the context switch based on the java threads

src/java/jmsg.c include the xbt_context_private.h which declare the context based java thread (jxbt_context.h  doesn't exist any more)
declare an define a new function native_to_java_process which returns the java process associated with a msg process
define the native function java_simgrid_msg_Msg_selectContextFactory()
use the xbt_context_stop() function to signal the end of the java thread instead the function xbt_context_exit()
src/java/jmsg.h add the declaration of the java_simgrid_msg_Msg_selectContextFactory() function
src/java/jmsg_host.c this file is now inclued from the file src/xbt/xbt_jcontext.c which declare the log category for java, so the macro XBT_LOG_EXTERNAL_CATEGORY is useless
src/java/jmsg_parallel_task.c the same reason of the file src/java/jmsg_host.c
src/java/jmsg_process.c the same reason of the file src/java/jmsg_host.c and this file needs to include src/xbt/xbt_jprocess.h instead the file src/xbt/context_private.h to get
the definition of the java context
src/java/jmsg_process.h include xbt_context.h instead the context.h header
src/java/jxbt_utilities.c the same reason of the file src/java/jmsg_host.c

src/simix/private.h include xbt_context.h instead the header context.h
src/simix/smx_process.c modify the function SIMIX_jprocess_create() : this function doesn't use any more the simix java process management and the jprocess object is now passed as
the fourth parameter of the function xbt_context_new().
src/surf/network.c it's pointers to functions
src/surf/surfxml_parse.c just initialize the variable surf_file_to_parse to NULL
src/surf/workstation_KCCFLN05.c         function pointers usage and ANSI C variable declarations
src/surf/workstation_ptask_L07.c function pointers usage and ANSI C variable declarations
src/surf/surf.c adapt the code to the specific path separator of Windows

src/xbt/xbt_main.c the function xbt_context_init() and xbt_context_exit() are now renamed xbt_context_mod_init() and xbt_context_mod_exit()
src/xbt/xbt_modinter.h declaration of xbt_context_mod_init() and xbt_context_mod_exit() functions
src/xbt/xbt_str.c avoid the warning thrown by the Visual C++ compiler when it meets a comparison between a signed and a unsigned integer

src/gras/rl_stubs.c use xbt_context_mod_init() and xbt_context_mod_exit() instead xbt_context_init() and xbt_context_exit()

src/makefile.am the java library build is now useless
src/makefile.in this is the consequence of the previous change (makefile.am)

Files to add:

src/xbt/xbt_context_private.h this header replace the file context_private.h
src/xbt/xbt_context.c this source file replace the file context.c
include/xbt/xbt_context.h this file replace the file context.h
src/xbt/xbt_context_factory.h this header declares the context factory structure used by xbt to build the adapted context
src/xbt/xbt_thread_context.h this header declares the structure used in the switch context process based on the native threads
src/xbt/xbt_thread_context.c this source file contains the implementation of the thread context
src/xbt/xbt_ucontext.h this header declares the structure used in the switch context process based on the ucontext
src/xbt/xbt_ucontext.c this source code file contains the implementation of the context based on the ucontext
src/xbt/xbt_jcontext.h this header contains the declaration of the structure used in the switch context process based on the java thread
src/xbt/xbt_jcontext.c this source code file contains the implementation of the context based on java thread

Files to delete:
src/xbt/context.c this file is replaced by the file src/xbt/xbt_context.c
src/include/xbt/context.h this file is replaced by the file include/xbt/xbt_context.h
src/xbt/context_private.h this file is replaced by the file src/xbt/xbt_context_private.h
src/java/jxbt_context.h this file is useless (reimplemented in xbt_context.h)
src/java/jxbt_context.c this file is useless (reimplemented in xbt_context.c)

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5040 48e7efb5-ca39-0410-a469-dd3cf9ba447f


No differences found