The Simics scheduler is responsible for ensuring that models implementing the
execute
interface are scheduled. It is also
responsible for mapping actual threads to the simulation workload and
for keeping distinct CPUs synchronized in virtual time.
The Simics Scheduler compiles a list of simulation tasks that can be
run in parallel. Each task consists of a thread domain with
one or more models implementing the execute
interface.
The number of tasks that can be simulated in parallel depends on the thread domain partitioning, which in turn depends on the selected simulation mode. The simulation mode is configurable with the set-threading-mode command.
The available tasks are mapped to a set of execution threads managed by the scheduler. The number of threads used depends on the host hardware and any limit imposed by the user. The latter is settable with the set-thread-limit command.
A particular simulation task is usually simulated from a specific simulation thread in order to maximize cache locality. However, a task can be migrated to another thread when this is needed for load-balancing reasons. Thus, a model should not make any assumptions about the thread it is simulated from.
The scheduler ensures that all CPUs (and clocks) are kept synchronized in virtual time. More specifically, the virtual time for a pair of CPUs are not allowed to differ more than a fixed amount. A simulation task becomes blocked when it is about to break this invariant.
If a single thread domain contains more than one object implementing the
execute
interface, then the scheduler switches between
them in a round-robin fashion. Each executor is simulated until the
virtual time has advanced one time-quantum. The interval
is settable with the set-time-quantum command.
The time difference for CPUs in the same cell, but in distinct thread domains, is not allowed to exceed the max-time-span limit. The limit is settable with the set-max-time-span command and is usually of the same order of magnitude as the time quantum.
The time difference between CPUs in distinct cells is kept below the min-latency limit. This limit is set with the set-min-latency command. The min-latency is often allowed to be a bit higher than the other limits.