[ndnSIM] Threading Issue in ndnSIM

Xinyu Ma bitmxy at gmail.com
Sun Jan 13 10:43:48 PST 2019


Hello, Rehman,

I don’t think you could use usleep() in any functions. Time and multithreading functions are forbidden in ndnSIM.
You can use the scheduler to implement this.

 Simulator::Schedule(Time, The function to send data back, Parameters);

Something like that.

Best wishes,
Xinyu Ma.

> On Jan 13, 2019, at 8:16 AM, Atif Rehman via ndnSIM <ndnsim at lists.cs.ucla.edu> wrote:
> 
> Hello everyone,
> 
> I am analyzing the behavior of PIT timer in a ndnSIM by varying the processing time at producer node. For example, when the first request arrives at producer/provider node the processing time is 300 ms which means the producer will reply with data packet after 300 ms. All subsequent requests responded back with random processing time i.e. 300 ms, 749 ms, 1500 ms, 1700 ms, 249 ms etc. The value of a PIT timer is set to 1 second. Moreover, I am using  usleep(microseconds) function in Producer::OnInterest(shared_ptr<const Interest> interest) function after following line  NS_LOG_FUNCTION(this << interest); to create random processing delay on producer node.
> 
> The issue which i am facing is, it seems that usleep() function halt all threads of ndnSIM and PIT timer did not expire after 1 second even when the processing time is 1500, 1700 ms (greater than 1 second). I am using usleep() function because my understanding is (I might be wrong here) when we install NDN stack on any node, it runs in a separate thread. Therefore, if each node is running in separate thread then usleep() should not halt whole ndnSIM rather it should only halt the processing of producer node. 
> 
> I shall be grateful if someone help me in this regard or suggest some alternative solution. 
> 
> 
> Regards 
> 
> Atif Ur Rehman (Ph.D. Student)
>  
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim



More information about the ndnSIM mailing list