[Click] Threading and locks

Nikitas Liogkas nikitas at CS.UCLA.EDU
Sat Sep 11 21:04:28 EDT 2004


Basically everything will run on one thread, even with SMP enabled, unless:
1. you use "--threads=2" (or however many processors you have) when running
click-install, AND

2. you include a StaticThreadSched/BalancedThreadSched in your
configuration; these will assign tasks to run on different processors: the
former sets a static assignment, while the latter moves tasks at runtime
from one processor to the other as needed to maintain a reasonable load on
each processor. If you don't include any of these elements in your
configuration, there will be 2 threads, but nothing will ever be run on the
second one, since all tasks are by default assigned to the first thread.

Hope this helps...

nikitas


----- Original Message -----
From: "Giovanni Tusa" <gtusa at diit.unict.it>
To: <click at amsterdam.lcs.mit.edu>; <kevin_mitchell at agilent.com>
Sent: Monday, September 06, 2004 2:18 AM
Subject: Re: [Click] Threading and locks


>
> ----- 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
> >
>
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>



More information about the click mailing list