Re: [click] userlevel multi-threads
jinho hwang <[email protected]> Wed, 14 Aug 2013 11:22:21 -0400
| Newsgroups | gmane.network.routing.click |
|---|---|
| Message-ID | <CAPQGAnGH4QXeoq2T=bp-_vOSn_+s5_cGzgx6aBWcQFyzQohzLQ@mail.gmail.com> |
On Wed, Aug 14, 2013 at 11:02 AM, Beyers Cronje <[email protected]> wrote: > Hi Jinho, > > I'm not too sure, but I dont think so. > > Beyers > > > On Wed, Aug 14, 2013 at 4:38 PM, jinho hwang <[email protected]> wrote: > >> On Wed, Aug 14, 2013 at 7:23 AM, Beyers Cronje <[email protected]> wrote: >> > You need to use either StaticThreadSched or BalancedThreadSched to >> > schedule tasks on different threads. >> > >> > http://read.cs.ucla.edu/click/elements/staticthreadsched >> > http://read.cs.ucla.edu/click/elements/balancedthreadsched >> > >> > An example of how to use StaticThreadSched would be: >> > >> > fd0::FromDevice(eth0) -> Discard; >> > fd1::FromDevice(eth1) -> Discard; >> > StaticThreadSched(fd0 0, fd1 1); >> > >> > Beyers >> > >> > >> > On Wed, Aug 14, 2013 at 5:23 AM, jinho hwang <[email protected]> >> wrote: >> > >> >> Hi All, >> >> >> >> I am new to click. I want to use multi-threading in userlevel. I enabled >> >> and put -j 2 in command line, and am using test.click. However, >> thread_id=0 >> >> always calls run_task and processes the packets, but thread_id=1 >> appears in >> >> RouterThread, but then is not called at all from run_task in >> >> infinitesource. thread_id=1 even disappeared after calling twice. This >> is >> >> consistent. I could not figure out why thread_id=1 disappeared. There >> is no >> >> signal delivered to the thread (checked), it seems naturally gone. >> >> >> >> Can anybody help? >> >> >> >> Thank you, >> >> >> >> Jinho >> >> Hi Beyers, >> >> Thank you. It works like charm, and fits to my goal. One more question >> is whether it uses cpu affinity? From my analysis, there is no such >> thing. I have to fix each thread to each core. Does Click have CPU >> affinity option somewhere? Otherwise, I will add that for my purpose. >> >> Thanks, >> >> Jinho >> I thought the section written on the website applies only to kernel-mode, but it seems outdated. The following also applies to the userlevel multi-threads from http://www.read.cs.ucla.edu/click/clickunderhood#multi-threaded-click. ----- Lastly, we haven't talked about setting CPU affinities, i.e., how threads are assigned to CPU cores. Click largely leaves this up to the OS. Under Linux, users can install a Click configuration and then set affinities afterwards, either through command-line tools like taskset or by calling the sched_setaffinity and sched_getaffinity functions. If no affinities are set, the OS will decide the assignment. Another way would be to write a new Click element to configure this; no such element exists yet. ---- Thanks, Jinho