[Click] question on element scheduling
Nikitas Liogkas
nikitas at CS.UCLA.EDU
Sun May 22 13:50:05 EDT 2005
What Beyers is saying is correct, just bear in mind that timers have
coarse granularity; they get processed every 32 (default) scheduling
epochs. So, for example, if you want your code to run at time t, you
should schedule the timer for time t-dt, in order to maximize the
probability that it WILL actually run at time t. If this is confusing,
let me know and I can elaborate more.
Hope this helps!
nikitas
Beyers Cronje wrote:
> Hi IM,
>
> See comments below.
>
> Beyers
>
> On 5/20/05, Indian Mogul <indian_mogul at yahoo.com> wrote:
>
>>Hi,
>> I have a simple question for which I have been
>>laboring for quite some time.
>>In my router config file, I want one of my click
>>element to periodically check for the value of TTL in
>>the table irrespective of whether packets are recvd or
>>not? The name of the element is check_ttl() and the
>>path where it is introduced is:
>>//Fromdevice()->classifier->get_flow_id()
>> ->check_ttl()->//
>>
>>so, inside the element I have code that does:
>>// Check current time.
>>// If (current_time > expiry time)
>>// flush_the _entry
>>// else
>>// do nothing.
>>
>>1. Now, my question is, will the element "check_ttl()"
>>get automatically scheduled at the right time
>>irrespective of whether packets are there or not?
>
>
> The short answer is no.
>
> My understading is only schedulable tasks and timers are processed by
> the scheduler. All schedulable elements such as PollDevice/FromDevice
> implements a task, the scheduler calls the element's run_task method
> when scheduled. Unschedulable elements are called implicitly through
> the push/pull interfaces from the schedulable element.
>
> For your requirements a timer might be the way to go, maybe inside an
> information element, which does not sit in packet flow path, in other
> words it does not implement and push/pull interfaces. Look at the
> existing elements on implementing timers.
>
> Have another look in the programming manual for TASKS and TIMERS.
>
> For your scenarion an informational element
>
>
>>2. Since click is single threaded, how do I schedule
>>the check_ttl() if ans to (1) is false?
>
>
> See above.
>
>
>>Thanks?
>>IM
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam? Yahoo! Mail has the best spam protection around
>>http://mail.yahoo.com
>>_______________________________________________
>>click mailing list
>>click at amsterdam.lcs.mit.edu
>>https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>>
>
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
More information about the click
mailing list