大量のプロセスを生成したい。だから私はmaster
という処理をしています。大量のプロセスを生成する
int master(int argc, char* argv[]){
for (int i = 0; i < 50000; ++i) {
std::string name = std::to_string(i);
MSG_process_create(name.c_str(), slave, NULL, MSG_host_self());
}
return 0;
}
int slave(int argc, char* argv[]){
XBT_INFO("%s", MSG_process_get_name(MSG_process_self()));
return 0;
}
私は次の出力を持って、このプログラムを起動した後:
....
....
[Master:32734:(32736) 0.000000] [master/INFO] 32734
[Master:32735:(32737) 0.000000] [master/INFO] 32735
[0.000000] /home/ken/Downloads/simgrid-master/src/simix/smx_context.cpp:187: [xbt/CRITICAL] Failed to protect stack: Cannot allocate memory
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
その後
デフォルトでは、前のプログラムが必要なので、私は、スタックサイズを変更するにはcontexts/stack-size
パラメータを使用することをお勧めしました* 8192 50000 KiBの。
私は、このパラメータ--cfg=contexts/stack-size:10
を追加しましたが、私は同じ出力があります。
...
...
[Master:32735:(32737) 0.000000] [master/INFO] 32735
[0.000000] /home/ken/Downloads/simgrid-master/src/simix/smx_context.cpp:187: [xbt/CRITICAL] Failed to protect stack: Cannot allocate memory
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
かを:
...
...
[Master:32734:(32736) 0.000000] [master/INFO] 32734
[0.000000] /home/ken/Downloads/simgrid-master/src/simix/smx_context.cpp:187: [xbt/CRITICAL] Failed to protect stack: Cannot allocate memory
「私のプログラムは、このパラメータを見ていないように見えるかもしれないが、それはにISNスタックパラメータが5
の場合は、私に与えます:
Finally, if nothing of the above applies, this can result from a stack overflow.
Try to increase stack size with --cfg=contexts/stack_size (current size is 1 KiB).
どうしたの?