在平臺文件I只有一個主機:主機上正在運行的進程數是否有限制?
<host id="Worker1" speed="100Mf" core="101"/>
然後在worker.c我創建101(或> 100)處理期望,每個在每個核上一個進程將被啓動。但我注意到,只有第一進程能夠執行任務或XBT_INFO
寫:
int worker(int argc, char *argv[])
{
for (int i = 0; i < 101; ++i) {
MSG_process_create("x", slave, NULL, MSG_host_self());
}
return 0;
}
int slave(){
MSG_task_execute(MSG_task_create("kotok", 1e6, 0, NULL));
MSG_process_kill(MSG_process_self());
return 0;
}
其他進程超過100首的人都無法管理和殺:
[ 1.000000] (0:[email protected]) Oops ! Deadlock or code not perfectly clean.
[ 1.000000] (0:[email protected]) 1 processes are still running, waiting for something.
[ 1.000000] (0:[email protected]) Legend of the following listing: "Process <pid> (<name>@<host>): <status>"
[ 1.000000] (0:[email protected]) Process 102 ([email protected]): waiting for execution synchro 0x26484d0 (kotok) in state 2 to finish
UPDATE 這裏的一些代碼功能是:
main
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
MSG_create_environment(argv[1]); /** - Load the platform description */
MSG_function_register("worker", worker);
MSG_launch_application(argv[2]); /** - Deploy the application */
msg_error_t res = MSG_main(); /** - Run the simulation */
XBT_INFO("Simulation time %g", MSG_get_clock());
return res != MSG_OK;
}
deployment.xml中
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
<platform version="4">
<process host="Worker1" function="worker">
<argument value="0"/>
</process>
</platform>