[Click] Threading and locks

Giovanni Tusa gtusa at diit.unict.it
Mon Sep 6 05:18:44 EDT 2004


----- Original Message -----
From: <kevin_mitchell at agilent.com>
To: <click at amsterdam.lcs.mit.edu>
Sent: Monday, September 06, 2004 10:45 AM
Subject: [Click] Threading and locks


> I have a simple question about threading.  I've written some Click
elements that are used in a script that is processing packets from two
interfaces, and the elements also use timers.  Multiple elements manipulate
a shared data structure.  All this is running in kernel mode.  Is Click
single-threaded, even in an SMP environment, so I don't need to worry about
adding locks etc when accessing the shared structures.  Or are multiple
threads potentially in use, and so I should assume the code in multiple
elements could be running simultaneously, and therefore I need to use
locking?  I noticed the docs talk about tasks potentially running on
multiple threads, but I wasn't sure what the implications were for
packet-processing and timers.
>
> Kevin
>

According to my knowledge in the use of SMP Click in a multiprocessor
hardware architecture, multiple threads activation is not automatic, also in
an SMP environment.
For example, in a dual processor system, the ""--enable-multithread=2"
option must be added during Click configuration. In addition, to make the
use of multiple threads
effective, the StaticThreadSched element, or the BalancedThreadSched (the
old SortedTaskSched) element, in order to activate the Static or the
Adaptive CPU scheduling,
must be added in the Click configuration script.

I hope this information can be helpful for you.

Giovanni
_______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>




More information about the click mailing list