Skip to first unread message

Musti Aref

unread,
Jun 15, 2017, 1:26:52 PM6/15/17
to ns-3-users
Hello friends,
 
i have question about the event dropping in the realtime implementation. 
In the code snippet below (from realtime-simulator-impl.cc) after the synchronization, sleep- and busy-wait is done, the simulation proceed with the execution of the next event. 

- What i couldn't understand is the yellow highlighted comment below. How could it be that the event we are trying to execute could be other than the one we are waiting for !?!? 
This maens that events could be dropped during the synchronization/waiting period, right? Which is not clear where this happen in the code !!??

- If this is true, where/how can i find information about those dropped events ?

RealtimeSimulatorImpl::ProcessOneEvent (void){
  ...
  ...
  if (m_synchronizer->Synchronize (tsNow, tsDelay)){
      NS_LOG_LOGIC ("Interrupted ...");
      break;
  }
  ...
  ...
  Scheduler::Event next;
  { 
    CriticalSection cs (m_mutex);
    // We do know we're waiting for an event, so there had better be an event on the 
    // event queue.  Let's pull it off.  When we release the critical section, the
    // event we're working on won't be on the list and so subsequent operations won't
    // mess with us.
 
    NS_ASSERT_MSG (m_events->IsEmpty () == false, 
                   "RealtimeSimulatorImpl::ProcessOneEvent(): event queue is empty");
    next = m_events->RemoveNext ();
    m_unscheduledEvents--;

    // We cannot make any assumption that "next" is the same event we originally waited for.
    // We can only assume that only that it must be due and cannot cause time 
    // to move backward.


 
Many thanks in advance
Musti

Tommaso Pecorella

unread,
Jul 10, 2017, 7:25:39 PM7/10/17
to ns-3-users
Hi,

don't forget that there could be a new event. When you execute an event you know what the current event is and what the next one should be if no other event is inserted in between.

T.

Musti Aref

unread,
Jul 11, 2017, 6:57:02 AM7/11/17
to ns-3-users
Thank you, 

I didn't consider that in my thoughts :)
Reply all
Reply to author
Forward
0 new messages