在平台文件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>