0

I am trying to use MPI Distributed Simulation feature of NS-3. I have implemented an application and a node class in my module. I also have a factory class as a singleton object. Do I have to consider synchronization using monitors and Mutex in my singleton class?

In some of the functions I am changing class variables and therefore it looks like that I should consider thread safety but I am not sure how MPI works and if it actually creates one instance of the object or it creates separate objects in every process.

Thanks

hashtpaa
  • 389
  • 2
  • 11

1 Answers1

0

The ns-3 MPI support distributes ns-3 nodes across mpi computing nodes so, if you have one process-level factory singleton, there will be one instance of this factory on each mpi processing node and it will not share its state with other instances of the factory on other nodes.

In general, it is considered a really bad idea to use global state (i.e., state that is shared between node instances) with MPI-based simulations.

mathieu
  • 2,954
  • 2
  • 20
  • 31