[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scheduler.cc - negative time-travel ?



On Thu, 23 Jul 1998 14:38:51 PDT, Nitin Vaidya wrote: 
>
>Unless I am mistaken, it seems that
>scheduler.cc allows events to be scheduled
>in the "past". That is  s.schedule( x, y, t) can be called with t
>being negative. When this event gets scheduled, the simulation time
>travels backwards (as t was negative).
>
>Is this feature deliberate or just an oversight ?

In emulation mode (where the simulator tracks real world time and
packets) the simulator could get out-of-sync.

>I discovered this while trying to debug ns-2/ll.cc.
>It was scheduling an &intr after a negative interval - the scheduler
>does not complain. However, one side-effect of this is that
>the event times in the trace files are no more  non-decreasing.
>This is, to say the least, very annoying, and can perhaps yield
>erroneous results (by re-ordering events in a non-causal order).
>
>I would suggest adding a check (and warning) for (clock_ <= t) in
>Scheduler::dispatch(p,t) -- may be assert(clock_<=t).
>This would help in catching some bugs.

For regular schedulers this seems like a good idea;
I've added it (as a warning, not an assert) for the next release.

   -John Heidemann