Service Time Duration

39 views
Skip to first unread message

maede zolanvar

unread,
Oct 22, 2017, 1:44:00 PM10/22/17
to ns-3-users
I've been struggling with this problem for a long time.
My goal is to simulate a network of CPUs, with a queue (infinite buffer) of arrival packets, waiting to be processed in the CPUs.
Each CPU has a "service duration", and after done with that packet, starts working on a new packet from the queue.
All I searched, I couldn't find any method to simulate the "service duration", (something like holding the packets in the node).
Any help is greatly appreciated!

pdbarnes

unread,
Oct 22, 2017, 8:18:19 PM10/22/17
to ns-3-users
You can approximate this by putting incoming packets on a work queue. Let's assume you have a function ProcessOne() which processes one packet from the queue, and computes the duration of the processing delay, delta. When it finishes it should schedule itself to process the next packet off the work queue for delta in the future.

ProcessIne(...)
{
// Process the first packet in the queue
...

// Compute processing time
Time delay = ...
// Schedule next packet processing
Schedule(delay, ProcessOne, ...)
}

Peter

Reply all
Reply to author
Forward
0 new messages