Skip to content

Determine next round time dynamically during round #1249

@robgjansen

Description

@robgjansen

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:

  1. 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).
  2. 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)

Metadata

Metadata

Assignees

Labels

Component: MainComposing the core Shadow executableTag: PerformanceRelated to improving shadow's run-timeType: EnhancementNew functionality or improved design

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions