[Click] mutex on click

Eddie Kohler kohler at cs.ucla.edu
Thu May 8 00:26:42 EDT 2008


Hi Giovanni,

Handlers accessed by a user space process are called from the kernel thread 
corresponding to that user space process.  This is NOT the Click kernel 
thread, and normally, the Click kernel thread will simply go about its 
business, possibly running concurrently with the kernel threads that are 
accessing handlers.  However, if you declare a handler as "exclusive" by 
setting the Handler::EXCLUSIVE flag (set_handler_flags() or the extra "flags" 
argument to the various add_handlers methods), then Click will lock out all 
kernel threads before calling the handler.

Normally all internal Click processing -- tasks, timers -- happens in a single 
kernel thread.  In SMP Click multiple kernel threads can run tasks and timers. 
  Handlers are called from kernel threads belonging to other processes (except 
for internal handler calls, such as HandlerCall::call_read()).  And individual 
elements can divide some of their functionality into other threads -- 
FromDevice, for example, has a portion that runs at interrupt time (really 
bottom half time) and a portion that runs in the normal kernel thread.

User level Click has exactly one thread.

Eddie



Giovanni Di Stasi wrote:
> I have some handlers in the router configuration that are called from time to 
> time by an user space process. These calls can modify structures that are 
> used by click elements. Do I have to lock those structures when I modify them 
> or are the handlers executed by the same thread of click elements?
> How many threads does click use (in user space and in kernel mode)?
> 
> Thanks.
> 
> 



More information about the click mailing list