<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello Xinyu Ma and Alex,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you so much for the response. My problem was solved using your provided solutions.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I used "Simulator::Schedule(...)" to delay processing of data packet on producer node and manged PIT timer expiry using InterestLifeTime (I am controlling its value based on my own requirements).</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div><span style="font-style:normal; font-weight:400; font-size:small; line-height:21.3px; font-family:Verdana; color:rgb(0,0,0)"><b><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont">Regards </span></b></span></div>
<div id="geom_inter_1528795240697_70_17"><span style="font-style:normal; font-weight:400; font-size:small; line-height:21.3px; font-family:Verdana; color:rgb(0,0,0)"><b><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont"><br>
</span></b></span></div>
<b style="font-family:Calibri,Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)"></b><span style="font-style:normal; font-weight:400; font-size:small; line-height:21.3px; font-family:Verdana; color:rgb(0,0,0)"><b><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont">Atif
 Ur Rehman</span></b><span style="font-size:12pt; font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont"> </span></span><span style="font-style:normal; font-weight:400; font-size:12pt; line-height:21.3px; font-family:"Malgun Gothic","맑은 고딕",AppleGothic,sans-serif,serif,EmojiFont; color:rgb(0,0,0)"><b><span style="font-family:Calibri,Helvetica,sans-serif,serif,EmojiFont">(Ph.D.
 Student)</span></b></span>
<div id="geom_inter_1528795240701_98_20"><span style="font-style:normal; font-weight:400; font-size:small; line-height:21.3px; font-family:Verdana; color:rgb(0,0,0)"><span style="font-family:"Malgun Gothic","맑은 고딕",AppleGothic,sans-serif,serif,EmojiFont"><b> </b></span></span></div>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt">
<div style="margin: 0px; height: 939px; overflow: hidden">
<div style="margin: 0px; font-size: 14px; font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; color: var(--neutralPrimary); height: 939px; flex-direction: column; z-index: 0; overflow: hidden; display: flex">
<div style="margin: 0px; overflow: hidden; display: flex; height: auto; min-height: 0px; flex: 1 1 0%; flex-flow: row nowrap; align-items: stretch">
<div style="margin: 0px; flex-flow: column; flex: 1 1 0%; overflow: hidden; display: flex">
<div style="margin: 0px; display: flex; overflow: hidden; flex: 1 1 0%; min-height: 0px">
<div style="margin: 0px; flex: 1 1 auto; overflow: hidden; display: flex; flex-flow: column">
<div style="margin: 0px; flex: 1 1 auto; overflow: hidden; display: flex; flex-flow: column">
<div style="margin: 0px; flex: 1 1 auto; display: flex; align-items: stretch; height: calc(100% - 44px); flex-flow: row nowrap; background-color: var(--white)">
<div style="margin: 0px; flex-direction: column; flex: 1 1 auto; overflow: hidden; display: flex">
<div style="margin: 0px; flex: 1 1 auto">
<div style="margin: 0px">
<div style="margin: 0px; top: 0px; bottom: 0px; overflow: hidden; background-color: var(--neutralLighterAlt); left: 0px; right: 0px">
<div tabindex="-1" style="margin: 0px; display: flex; flex-flow: column; height: 846px; background-color: var(--neutralLighterAlt)">
<div style="margin: 0px; display: flex; flex-flow: column; overflow: hidden">
<div tabindex="-1" style="margin: 0px; overflow-wrap: break-word; box-sizing: border-box; overflow: auto overlay">
<div style="margin: 0px">
<div style="margin: 0px">
<div style="margin: 0px"><span>From: Alex Afanasyev <cawka1@gmail.com><br>
</span>
<div>Sent: Monday, January 14, 2019 12:13 AM<br>
</div>
<div>To: Atif Rehman<br>
</div>
<div>Subject: Re: [ndnSIM] Threading Issue in ndnSIM<br>
</div>
<div> <br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>On Jan 13, 2019, at 1:11 PM, Atif Rehman <atif_r@outlook.com> wrote:<br>
</div>
<div><br>
</div>
<div>Alex,<br>
</div>
<div><br>
</div>
<div>Thank you so much for your prompt response and clarification. From your reply i understand that, I need to schedule an event and trigger it whenever the the processing time (random number) is greater than 1 second on producer node.  And In the event handler
 i need to write a code that expires the PIT timer which is associated with that particular Interest.
<br>
</div>
<div><br>
</div>
<div>Not fully following this. To simulate processing time, you need to schedule creation of data packet the desired amount of time ahead, instead of directly creating it inside OnInterest method.  You can use what Xinyu suggested in the other reply to your
 question.<br>
</div>
<div><br>
</div>
<div>PIT timer is inside Forwarder and you should be able to control it via setting proper InterestLifetime in the interests you send. You shouldn't be doing any "manual" expiration of PIT entry.<br>
</div>
<div><br>
</div>
<div>-<br>
</div>
<div>Alex<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> In case if i am wrong, then it would be great if you could please share some links that help me to understand better.<br>
</div>
<div> <br>
</div>
<div>Thank you, <br>
</div>
<div><br>
</div>
<div>Regards <br>
</div>
<div><br>
</div>
<div>Atif Ur Rehman (Ph.D. Student) <br>
</div>
<div>From: Alex Afanasyev <cawka1@gmail.com><br>
</div>
<div>Sent: Sunday, January 13, 2019 9:33 PM<br>
</div>
<div>To: Atif Rehman<br>
</div>
<div>Subject: Re: [ndnSIM] Threading Issue in ndnSIM<br>
</div>
<div> <br>
</div>
<div>You cannot use threading primitives in NS-3 in general, as it is simulating time, not running code in real time. If you want to simulate delays, you need to schedule events.  You should see many examples of how to do it in the code.<br>
</div>
<div><br>
</div>
<div>---<br>
</div>
<div>Alex<br>
</div>
<div><br>
</div>
<div>On Jan 13, 2019, at 11:16 AM, Atif Rehman via ndnSIM <ndnsim@lists.cs.ucla.edu> wrote:<br>
</div>
<div><br>
</div>
<div>Hello everyone,<br>
</div>
<div><br>
</div>
<div>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.<br>
</div>
<div><br>
</div>
<div>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.
<br>
</div>
<div><br>
</div>
<div>I shall be grateful if someone help me in this regard or suggest some alternative solution.
<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Regards <br>
</div>
<div><br>
</div>
<div>Atif Ur Rehman (Ph.D. Student)<br>
</div>
<div> <br>
</div>
<div>_______________________________________________<br>
</div>
<div>ndnSIM mailing list<br>
</div>
<div>ndnSIM@lists.cs.ucla.edu<br>
</div>
<div>http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim<br>
</div>
<span></span><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</font></div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText"><br>
</div>
</span></font></div>
</body>
</html>