[Click] SMP Click and Timers

Eddie Kohler kohler at cs.ucla.edu
Thu Aug 24 12:29:08 EDT 2006


Hi Beyers, sorry for the delay,

On current Click, timers run on any CPU, so synchronization would be required 
here.  The simplest change that would avoid synchronization is this: Add 
another task to your SomeElement, and have the timer *schedule the task*.

class SomeElement { ...
    bool run_task();
...
    Task _task;
    Timer _timer;
};

SomeElement::SomeElement() ...
   : _task(this), _timer(&_task)
{
}

bool SomeElement::run_task()
{
    ... code that used to be in run_timer() ...
}

...

StaticThreadSched(fd 0, deq 1, the_SomeElement 1);

Make sense?

Alternately I could imagine allowing StaticTHreadSched to specify the CPU on 
which ALL timers would always run.

Eddie


Beyers Cronje wrote:
> Hi guys,
> 
> When using multithreaded click with StaticThreadSched can one be guaranteed
> on what cpu a timer will be run?
> 
> As a simple example, would it be required to provide synchronization for
> element SomeElement that has a Timer that modifies mutable data inside
> SomeElement given the following click configuration:
> 
> fd::FromDevice(eth0) -> q::Queue;
> q -> deq::UnQueue -> SomeElement -> Discard;
> StaticThreadSched(fd 0, deq 1);
> 
> Thanks
> 
> Beyers
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


More information about the click mailing list