在 SimGrid 中如何计算延迟

How latency is calculated in SimGrid

我有一个简单的系统配置,其中存在两个主机并且 link 它们之间存在。

<link id="1" bandwidth="1Bps" latency="0"/>

任务从一台主机发送到另一台主机:

msg_task_t task = MSG_task_create("name", 1, 1, NULL);
MSG_task_send(task, "worker");

后宿主在接收任务时计算时间:

XBT_INFO("time %g", MSG_get_clock());
MSG_task_receive(&task, "worker");
XBT_INFO("time %g", MSG_get_clock());

我预计发送任务会持续 1 秒,但我有 1.08247:

[worker:worker:(2) 0.000000] [example/INFO] time 0
[worker:worker:(2) 1.082474] [example/INFO] time 1.08247

为什么会这样?

这是因为默认网络模型考虑了通过欺骗用户提供的 BW 和延迟值在现实中观察到的东西。

检查 http://hal.inria.fr/hal-00646896/PDF/rr-validity.pdf 的合理性(也发表在 TOMACS)。

在代码中,您想阅读 https://github.com/simgrid/simgrid/blob/master/src/surf/network_cm02.cpp#L23 您会发现,如果您想要一个可能不代表大型系统但更易于理解的模型,您应该通过添加 - 切换到 CM02 -cfg=network/model:CM02 在命令行上。