time-based simulation with actors model

后端 未结 1 953
借酒劲吻你
借酒劲吻你 2021-02-06 12:37

we have a single threaded application that simulates the interaction of a hundred of thousands of objects over time with the shared memory model.
obviously, it suffers from

相关标签:
1条回答
  • 2021-02-06 13:18

    Your approach of using message passing to parallelize a (discrete-event?) simulation is well-known and does not require a functional style per se (although, of course, this does not prevent you to implement it like that).

    The basic problem you describe w.r.t. to the timing of events is also known as the local causality constraint (see, for example, this textbook). Basically, you need to use a synchronization protocol to ensure that each object (or agent) processes its messages in the right order. In the domain of parallel discrete-event simulation, such objects are called logical processes, and they communicate via events (i.e. time-stamped messages).

    Correctly implementing a synchronization protocol for these events is challenging and the right choice of protocol is highly application-specific. For example, one important factor is the average amount of computation required per event: if there is little computation required, the communication costs dominate the overall execution time and it will be hard to scale the simulation.

    I would therefore recommend to look for existing solutions/libraries on top of the actors framework you intend to use before starting from scratch.

    0 讨论(0)
提交回复
热议问题