-
Notifications
You must be signed in to change notification settings - Fork 269
Determine next round time dynamically during round #1249
Description
We have an inter-round execution cycle where the workers compute their minimum next event time. We think we can remove this round, and instead compute the minimum next event time dynamically while executing events during the round instead.
We need two things for this to work:
- During every round, each worker keeps track of the minimum event time that it ever pushes to a different worker (i.e., a host that is not owned by the pushing worker). By event I mean inter-worker events (i.e.,
Packets), but we can ignore same-worker events (i.e.,Tasks). - At the end of every round, each worker computes the time of the event at the head of its min-heap event queue.
At the end of a round, each worker reports both 1. and 2. to the manager and then goes to sleep. The manager tracks the global minimum across all such reports from all workers. The global minimum is the used as the next time in place of the call to scheduler->policy->getNextTime(scheduler->policy); on line 256 above. Then as long as we move shadow_logger_flushRecords(shadow_logger_getDefault(), pthread_self()); to the end of each worker's main round event loop (which I think is _scheduler_runEventsWorkerTaskFn), we could remove this "in between rounds" task.
Might be worth a separate PR.
Originally posted by @robgjansen in #1238 (comment)