跳转至

Unison复现第一部分: 文件结构分析

Experimental Reproduction of EuroSys'24-Unison

表观可跑程序

Bash
1
./ns3 configure --enable-mtp --enable-examples
Bash
1
2
3
4
./ns3 build dctcp-example dctcp-example-mtp

(time ./ns3 run dctcp-example) &> ./testTime/dctcp-example.txt
(time ./ns3 run dctcp-example-mtp) &> ./testTime/dctcp-example-mtp.txt

dctcp-example: examples/tcp dctcp-example-mtp: examples/mtp

mtp部署原型

位置:Src/mtp/*

  • A parallel simulator implementation multithreaded-simulator-impl,
  • An interface to users mtp-interface,
  • Logical-process to represent LPs in terms of parallel simulation.

mtp-interface:

  • All LPs and threads are stored in the mtp-interface. It controls the simulation progress, schedules LPs to threads and manages the lifecycles of LPs and threads.
  • The interface also provides some methods and options for users to tweak the simulation. (调整模拟)

logical-process:

  • Each LP's logic is implemented in logical-process.
  • It contains most of the methods of the default sequential simulator plus some auxiliary (辅助) methods for parallel simulation.

multithreaded-simulator-impl:

  • The simulator implementation multithreaded-simulator-impl is a derived class (派生类) from the base simulator.
  • It converts calls to the base simulator into calls to logical processes based on the context of the current thread.
  • It also provides a partition method for automatic fine-grained topology partition.

部署要素更改

Core:

Bash
1
2
3
4
5
src/core/CMakeLists.txt                            |    1 +
src/core/model/atomic-counter.h                    |   50 +
src/core/model/hash.h                              |   16 +
src/core/model/object.cc                           |    2 +
src/core/model/simple-ref-count.h                  |   11 +-

Network:

Bash
1
2
3
4
5
6
7
8
9
src/network/model/buffer.cc                        |   15 +-
src/network/model/buffer.h                         |    7 +
src/network/model/byte-tag-list.cc                 |   14 +-
src/network/model/node.cc                          |    7 +
src/network/model/node.h                           |    7 +
src/network/model/packet-metadata.cc               |   26 +-
src/network/model/packet-metadata.h                |   14 +-
src/network/model/packet-tag-list.h                |   11 +-
src/network/model/socket.cc                        |    6 +

Internet:

Bash
1
2
3
4
5
6
src/internet/model/global-route-manager-impl.cc    |    2 +
src/internet/model/ipv4-global-routing.cc          |   32 +-
src/internet/model/ipv4-global-routing.h           |    8 +-
src/internet/model/ipv4-packet-info-tag.cc         |    2 +
src/internet/model/ipv6-packet-info-tag.cc         |    2 +
src/internet/model/tcp-option.cc                   |    2 +-

Flow-Monitor:

Bash
1
2
3
4
5
6
7
8
src/flow-monitor/model/flow-monitor.cc             |   48 +
src/flow-monitor/model/flow-monitor.h              |    4 +
src/flow-monitor/model/ipv4-flow-classifier.cc     |   12 +
src/flow-monitor/model/ipv4-flow-classifier.h      |    5 +
src/flow-monitor/model/ipv4-flow-probe.cc          |    2 +
src/flow-monitor/model/ipv6-flow-classifier.cc     |   12 +
src/flow-monitor/model/ipv6-flow-classifier.h      |    5 +
src/flow-monitor/model/ipv6-flow-probe.cc          |    2 +

Mpi:

Bash
1
2
3
src/mpi/model/granted-time-window-mpi-interface.cc |   25 +
src/mpi/model/granted-time-window-mpi-interface.h  |    7 +
src/mpi/model/mpi-interface.cc                     |    3 +-

分析自动划分

The reason behind Unison's fast speed is that it divides the network into multiple logical processes (LPs) with fine granularity and schedules them dynamically.

To get to know more details of such workflow, you can enable the following log component:

Bash
1
2
LogComponentEnable("LogicalProcess", LOG_LEVEL_INFO);
LogComponentEnable("MultithreadedSimulatorImpl", LOG_LEVEL_INFO);