Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

To be is to program.


devel / comp.lang.c++ / I need a CPU core exclusively for one thread

SubjectAuthor
* I need a CPU core exclusively for one threadFrederick Virchanza Gotham
+* Re: I need a CPU core exclusively for one threadDavid Brown
|`* Re: I need a CPU core exclusively for one threadV
| `* Re: I need a CPU core exclusively for one threadKeith Thompson
|  `- Re: I need a CPU core exclusively for one threadRichard Harnden
+- Re: I need a CPU core exclusively for one threadScott Lurndal
+* Re: I need a CPU core exclusively for one threadChris M. Thomasson
|`* Re: I need a CPU core exclusively for one threadScott Lurndal
| `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
|  `- Re: I need a CPU core exclusively for one threadChris M. Thomasson
`* Re: I need a CPU core exclusively for one threadBonita Montero
 +* Re: I need a CPU core exclusively for one threadScott Lurndal
 |`* Re: I need a CPU core exclusively for one threadBonita Montero
 | `* Re: I need a CPU core exclusively for one threadScott Lurndal
 |  `* Re: I need a CPU core exclusively for one threadBonita Montero
 |   `* Re: I need a CPU core exclusively for one threadScott Lurndal
 |    `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     +* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |`* Re: I need a CPU core exclusively for one threadBonita Montero
 |     | `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |  +* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |  |`- Re: I need a CPU core exclusively for one threadDavid Brown
 |     |  `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |   `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    +* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |`* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    | `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  +* Re: I need a CPU core exclusively for one threadKalevi Kolttonen
 |     |    |  |`* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  | `* Re: I need a CPU core exclusively for one threadKalevi Kolttonen
 |     |    |  |  +- Re: I need a CPU core exclusively for one threadJames Kuyper
 |     |    |  |  +* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |  |  |+* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  ||`* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |  |  || +* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || |+* Re: I need a CPU core exclusively for one threadKalevi Kolttonen
 |     |    |  |  || ||`* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || || +* Re: I need a CPU core exclusively for one threadKalevi Kolttonen
 |     |    |  |  || || |`- Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || || `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |  |  || ||  `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || ||   +* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |  |  || ||   |`* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || ||   | `- Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |  |  || ||   +* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |  |  || ||   |`- Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |  |  || ||   `* Re: I need a CPU core exclusively for one threadVir Campestris
 |     |    |  |  || ||    `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || ||     `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |  |  || ||      +* Re: I need a CPU core exclusively for one threadKeith Thompson
 |     |    |  |  || ||      |`- Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |  |  || ||      `- Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |  || |`- Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |  |  || `- Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |  |  |`* Re: I need a CPU core exclusively for one threadKalevi Kolttonen
 |     |    |  |  | +- Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |  |  | `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |  |  |  `* Re: I need a CPU core exclusively for one threadKeith Thompson
 |     |    |  |  |   `- Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |  |  `- Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  +* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |  |+- Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |  |`- Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |  `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |   `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |    `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |     `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      +* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |+* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      ||`* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      || `- Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      |`* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |      | `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |      |  `* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |      |   +* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   |+* Re: I need a CPU core exclusively for one threadFred. Zwarts
 |     |    |      |   ||+* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   |||`* Re: I need a CPU core exclusively for one threadFred. Zwarts
 |     |    |      |   ||| `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   |||  `- Re: I need a CPU core exclusively for one threadFred. Zwarts
 |     |    |      |   ||`- Re: I need a CPU core exclusively for one threadVir Campestris
 |     |    |      |   |`* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |      |   | +* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      |   | |`* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   | | `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      |   | |  `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   | |   `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      |   | |    +- Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |      |   | |    `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   | |     `* Re: I need a CPU core exclusively for one threadBonita Montero
 |     |    |      |   | |      `- Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   | `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   |  `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |      |   |   `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   |    `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |      |   |     +* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |      |   |     |+* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |      |   |     ||`* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |      |   |     || `* Re: I need a CPU core exclusively for one threadDavid Brown
 |     |    |      |   |     ||  `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |      |   |     ||   +- Re: I need a CPU core exclusively for one threadKalevi Kolttonen
 |     |    |      |   |     ||   `* Re: I need a CPU core exclusively for one threadScott Lurndal
 |     |    |      |   |     |+* Re: I need a CPU core exclusively for one threadFred. Zwarts
 |     |    |      |   |     |`* Re: I need a CPU core exclusively for one threadMichael S
 |     |    |      |   |     `* Re: I need a CPU core exclusively for one threadMuttley
 |     |    |      |   `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    |      `* Re: I need a CPU core exclusively for one threadChris M. Thomasson
 |     |    `- Re: I need a CPU core exclusively for one threadBonita Montero
 |     `* Re: I need a CPU core exclusively for one threadScott Lurndal
 `* Re: I need a CPU core exclusively for one threadFrederick Virchanza Gotham

Pages:12345678
I need a CPU core exclusively for one thread

<d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=588&group=comp.lang.c%2B%2B#588

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:620a:190f:b0:765:a4f2:51ec with SMTP id bj15-20020a05620a190f00b00765a4f251ecmr51951qkb.4.1688380922706;
Mon, 03 Jul 2023 03:42:02 -0700 (PDT)
X-Received: by 2002:a17:902:7b86:b0:1b1:e9c0:4625 with SMTP id
w6-20020a1709027b8600b001b1e9c04625mr7391955pll.10.1688380922102; Mon, 03 Jul
2023 03:42:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Mon, 3 Jul 2023 03:42:01 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=194.168.183.164; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 194.168.183.164
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
Subject: I need a CPU core exclusively for one thread
From: cauldwel...@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Mon, 03 Jul 2023 10:42:02 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Frederick Virchanza - Mon, 3 Jul 2023 10:42 UTC

I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.

Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.

I'm looking at the following two functions:
sched_setaffinity
pthread_setaffinity_np

And I note the following in the Linux manual:
"For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process"

I can find lots and lots of code examples to set the affinity for one thread or for one process -- however I cannot find one code example showing me how to exclude all other threads.

There's absolutely no point in me restricting my thread to the 1st CPU core if other threads can run on that core too -- in fact that will make my program _slower_ because my thread can't be scheduled on the other cores. Every code sample I can find online seems to just restrict the thread in question without placing any restriction on other threads.

Anyone know how this is supposed to work?

Re: I need a CPU core exclusively for one thread

<u7uhaa$3n1sa$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=591&group=comp.lang.c%2B%2B#591

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Mon, 3 Jul 2023 15:09:30 +0200
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <u7uhaa$3n1sa$2@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 3 Jul 2023 13:09:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="eb2fb2ebdb075a8982dcb162f067236a";
logging-data="3901322"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WDCr7fS8kbtYmIF9JTZjuQRzATzgHC0E="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:eMf//A+CSv5es8w4dbGP4xjUJEA=
Content-Language: en-GB
In-Reply-To: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
 by: David Brown - Mon, 3 Jul 2023 13:09 UTC

On 03/07/2023 12:42, Frederick Virchanza Gotham wrote:
>
> I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.
>
> Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.
>
> I'm looking at the following two functions:
> sched_setaffinity
> pthread_setaffinity_np
>
> And I note the following in the Linux manual:
> "For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process"
>
> I can find lots and lots of code examples to set the affinity for one thread or for one process -- however I cannot find one code example showing me how to exclude all other threads.
>
> There's absolutely no point in me restricting my thread to the 1st CPU core if other threads can run on that core too -- in fact that will make my program _slower_ because my thread can't be scheduled on the other cores. Every code sample I can find online seems to just restrict the thread in question without placing any restriction on other threads.
>
> Anyone know how this is supposed to work?

"cpu isolation" is, I believe, the term you want to look for on Google.
I don't know if this can only be set from boot parameters or configured
at run-time. You could also search for real-time linux, as that is
where these features are often used.

You will probably also want to disable some or all power-down modes and
clock speed switching, as these can give significant variations in
latencies. And you may need to pin the network card interrupts to a
processor core too.

Re: I need a CPU core exclusively for one thread

<jbAoM.9950$fNr5.1443@fx16.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=595&group=comp.lang.c%2B%2B#595

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx16.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: I need a CPU core exclusively for one thread
Newsgroups: comp.lang.c++
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
Lines: 15
Message-ID: <jbAoM.9950$fNr5.1443@fx16.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 03 Jul 2023 13:38:23 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 03 Jul 2023 13:38:23 GMT
X-Received-Bytes: 1169
 by: Scott Lurndal - Mon, 3 Jul 2023 13:38 UTC

Frederick Virchanza Gotham <cauldwell.thomas@gmail.com> writes:
>
>I'm writing a network analysis program, and just today I've found out that =
>it's too slow and missing packets.
>
>Ideally, I want the thread that reads from the network card to have exclusi=
>ve use of one of the CPU cores.
>
>I'm looking at the following two functions:
> sched_setaffinity
> pthread_setaffinity_np

This is A C++ group. A simple google search should be more productive,
and the answer will be dependent upon which operating system you are
targetting.

Re: I need a CPU core exclusively for one thread

<u7v56c$3p31n$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=603&group=comp.lang.c%2B%2B#603

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Mon, 3 Jul 2023 11:48:43 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <u7v56c$3p31n$2@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 3 Jul 2023 18:48:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="760041c933d735c690275256230bd71d";
logging-data="3968055"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Crc+FE9QcrJ5+5nJFUgZONoVeXi3Zppk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:4YdT+WlH0zOiu2RlPSmDJzOnIFw=
Content-Language: en-US
In-Reply-To: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
 by: Chris M. Thomasson - Mon, 3 Jul 2023 18:48 UTC

On 7/3/2023 3:42 AM, Frederick Virchanza Gotham wrote:
>
> I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.
>
> Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.
>
> I'm looking at the following two functions:
> sched_setaffinity
> pthread_setaffinity_np
>
> And I note the following in the Linux manual:
> "For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process"
>
> I can find lots and lots of code examples to set the affinity for one thread or for one process -- however I cannot find one code example showing me how to exclude all other threads.

Not sure you can do that. The OS can do whatever it wants. It can pin
your thread to a CPU, but that does not mean it cannot use said CPU for
other programs threads...

> There's absolutely no point in me restricting my thread to the 1st CPU core if other threads can run on that core too -- in fact that will make my program _slower_ because my thread can't be scheduled on the other cores. Every code sample I can find online seems to just restrict the thread in question without placing any restriction on other threads.
>
> Anyone know how this is supposed to work?

Re: I need a CPU core exclusively for one thread

<RWGoM.17029$N3_4.10956@fx10.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=609&group=comp.lang.c%2B%2B#609

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx10.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: I need a CPU core exclusively for one thread
Newsgroups: comp.lang.c++
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com> <u7v56c$3p31n$2@dont-email.me>
Lines: 26
Message-ID: <RWGoM.17029$N3_4.10956@fx10.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Mon, 03 Jul 2023 21:18:41 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Mon, 03 Jul 2023 21:18:41 GMT
X-Received-Bytes: 2119
 by: Scott Lurndal - Mon, 3 Jul 2023 21:18 UTC

"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>On 7/3/2023 3:42 AM, Frederick Virchanza Gotham wrote:
>>
>> I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.
>>
>> Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.
>>
>> I'm looking at the following two functions:
>> sched_setaffinity
>> pthread_setaffinity_np
>>
>> And I note the following in the Linux manual:
>> "For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process"
>>
>> I can find lots and lots of code examples to set the affinity for one thread or for one process -- however I cannot find one code example showing me how to exclude all other threads.
>
>Not sure you can do that. The OS can do whatever it wants. It can pin
>your thread to a CPU, but that does not mean it cannot use said CPU for
>other programs threads...

Linux provides mechanisms that allow dedication of compute resources
(e.g. hardware thread/core) to a specific set of processes. So do
most other legacy Unix operating systems.

The mechanisms vary based on the host operating system. cgroups is
the current favored mechanism on linux.

Re: I need a CPU core exclusively for one thread

<u814i7$3nvo$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=615&group=comp.lang.c%2B%2B#615

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Tue, 4 Jul 2023 14:50:19 +0200
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <u814i7$3nvo$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 4 Jul 2023 12:50:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2ec938a5373eec2ad5c52292b4ab9d7c";
logging-data="122872"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fCUcz3Y76pAwZzTLJ+2WCjmKS/4elxyU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:jHWnUjLDtMdBUzIEjmynsNHu2uo=
Content-Language: de-DE
In-Reply-To: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
 by: Bonita Montero - Tue, 4 Jul 2023 12:50 UTC

Am 03.07.2023 um 12:42 schrieb Frederick Virchanza Gotham:
>
> I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.
>
> Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.
>
> I'm looking at the following two functions:
> sched_setaffinity
> pthread_setaffinity_np

I think the packets are likely to be processed at the core where the
interrupt of the NIC hits if the core isn't currently running another
thread. The interrupt runs at an aribtrary core, so I think it's un-
likely that it will hit the core you reserve for the procesing.
And at all I think the system has enough buffering capabilities for
the packets which aren't delivered to your thread yet. So there must
sth. different that you're missing packets.
If you like you could try io_uring, which has the shortest path from
kernel to userspace if the frequency of packets is high. If you have
one packet in the receive queue the processing is as usual with a
kernel notification. If you have further packets in the queue and the
kernel notices that theres an unprocessed packed in the ring it pushes
further packets into the ring without any notifications form kernel-
to user-space.

>
> And I note the following in the Linux manual:
> "For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process"
>
> I can find lots and lots of code examples to set the affinity for one thread or for one process -- however I cannot find one code example showing me how to exclude all other threads.
>
> There's absolutely no point in me restricting my thread to the 1st CPU core if other threads can run on that core too -- in fact that will make my program _slower_ because my thread can't be scheduled on the other cores. Every code sample I can find online seems to just restrict the thread in question without placing any restriction on other threads.
>
> Anyone know how this is supposed to work?

Re: I need a CPU core exclusively for one thread

<UvVoM.17048$N3_4.6371@fx10.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=616&group=comp.lang.c%2B%2B#616

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx10.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: I need a CPU core exclusively for one thread
Newsgroups: comp.lang.c++
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com> <u814i7$3nvo$1@dont-email.me>
Lines: 26
Message-ID: <UvVoM.17048$N3_4.6371@fx10.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 04 Jul 2023 13:53:56 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 04 Jul 2023 13:53:56 GMT
X-Received-Bytes: 1919
 by: Scott Lurndal - Tue, 4 Jul 2023 13:53 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 03.07.2023 um 12:42 schrieb Frederick Virchanza Gotham:
>>
>> I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.
>>
>> Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.
>>
>> I'm looking at the following two functions:
>> sched_setaffinity
>> pthread_setaffinity_np
>
>I think the packets are likely to be processed at the core where the
>interrupt of the NIC hits if the core isn't currently running another
>thread. The interrupt runs at an aribtrary core,

This is not accurate. RSS is used to direct NIC interrupts to specific
cores, often depending on the contents of header fields (e.g. TCP packets
destined for port 80 may be sent to a different core than UDP packets or
RDMA packets). Rules are programmed into the NIC to designate the target
core in the packet parsing logic.

Most modern NICs support some form of RSS (receive side scaling) and the
parsing rules can be arbitrarily complex in advanced networking chips
such as the OcteonTx2 processors (parsing MPLS, various tunnelling
protocols, IPsec, higher-level protocols like TCP et cetera et alia).

Re: I need a CPU core exclusively for one thread

<u81fah$4v4j$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=618&group=comp.lang.c%2B%2B#618

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Tue, 4 Jul 2023 17:53:57 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <u81fah$4v4j$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <UvVoM.17048$N3_4.6371@fx10.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 4 Jul 2023 15:53:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2ec938a5373eec2ad5c52292b4ab9d7c";
logging-data="162963"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kXFu38XX3Q078m2obvu5u5x9EOVF6pqI="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:UvCGzOrVv6QUnn2kQGiCWOeEIzU=
In-Reply-To: <UvVoM.17048$N3_4.6371@fx10.iad>
Content-Language: de-DE
 by: Bonita Montero - Tue, 4 Jul 2023 15:53 UTC

Am 04.07.2023 um 15:53 schrieb Scott Lurndal:

> This is not accurate. RSS is used to direct NIC interrupts to
> specific cores, often depending on the contents of header fields ...

And which NIC supports that ?

> Most modern NICs support some form of RSS ...

I don't believe that and Linux doesn't use task-offloading.

Re: I need a CPU core exclusively for one thread

<QlYoM.1507$eGef.1471@fx47.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=624&group=comp.lang.c%2B%2B#624

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx47.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: I need a CPU core exclusively for one thread
Newsgroups: comp.lang.c++
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com> <u814i7$3nvo$1@dont-email.me> <UvVoM.17048$N3_4.6371@fx10.iad> <u81fah$4v4j$1@dont-email.me>
Lines: 19
Message-ID: <QlYoM.1507$eGef.1471@fx47.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 04 Jul 2023 17:08:00 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 04 Jul 2023 17:08:00 GMT
X-Received-Bytes: 1420
 by: Scott Lurndal - Tue, 4 Jul 2023 17:08 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 04.07.2023 um 15:53 schrieb Scott Lurndal:
>
>> This is not accurate. RSS is used to direct NIC interrupts to
>> specific cores, often depending on the contents of header fields ...
>
>And which NIC supports that ?

Start with the ubiquitous Intel E-1000 and pretty much
every other Intel pro NIC.

https://www.intel.com/content/www/us/en/support/articles/000006703/ethernet-products.html

>
>> Most modern NICs support some form of RSS ...
>

Most modern server NICs support some form of RSS. Cheap-ass consumer
gear (realtek, etc) - you get what you pay for.

Re: I need a CPU core exclusively for one thread

<88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=625&group=comp.lang.c%2B%2B#625

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:620a:4691:b0:75e:c6ad:c98 with SMTP id bq17-20020a05620a469100b0075ec6ad0c98mr40509qkb.13.1688491507783;
Tue, 04 Jul 2023 10:25:07 -0700 (PDT)
X-Received: by 2002:a17:902:8482:b0:1b8:5541:9d3e with SMTP id
c2-20020a170902848200b001b855419d3emr11456484plo.6.1688491507429; Tue, 04 Jul
2023 10:25:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Tue, 4 Jul 2023 10:25:06 -0700 (PDT)
In-Reply-To: <u814i7$3nvo$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.182.198; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.182.198
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com> <u814i7$3nvo$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
Subject: Re: I need a CPU core exclusively for one thread
From: cauldwel...@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Tue, 04 Jul 2023 17:25:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2656
 by: Frederick Virchanza - Tue, 4 Jul 2023 17:25 UTC

On Tuesday, July 4, 2023 at 1:50:34 PM UTC+1, Bonita Montero wrote:
>
> So there must sth. different that you're missing packets.

I figured out what's going on.

In my code, when an Ethernet frame is read from the network card, I check the checksum of the IP header, and also the checksum of the TCP segment. If either is wrong, the entire Ethernet frame is discarded.

In my code, I calculate what the checksum should be for the IP header, and I saw that in cases where the frame is discarded, the incoming packet had the 'total packet length' in the IP header as 44, but in my code I was calculating the checksum of 46 bytes. I didn't know where the other 2 bytes were coming from, whether they were 'options' in the TCP header or whatever, but then in Wireshark I saw that the packet had a mysterious "00 00" at the end. I selected those two bytes and Wireshark told me "Ethernet padding bytes".

Turns out that if an Ethernet frame is less than 60 bytes, then it's padded with zeroes to bring it to 60 bytes.

Ethernet header is 14 bytes, and the IP packet was 44 bytes, bringing the incoming frame to 58 bytes. So the operating system / network card tagged two zero bytes on the end.

I was debugging it for approx 8 hours before I figured out what was wrong. Now I'm lost losing any packets.

Still though I just set the 'priority' of my network reading thread to maximum.

Re: I need a CPU core exclusively for one thread

<d917810d-9d68-4a36-ad46-9299174c2ccbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=626&group=comp.lang.c%2B%2B#626

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:ad4:4f13:0:b0:635:e3ae:e0a0 with SMTP id fb19-20020ad44f13000000b00635e3aee0a0mr38023qvb.9.1688491650088;
Tue, 04 Jul 2023 10:27:30 -0700 (PDT)
X-Received: by 2002:a17:902:ed44:b0:1b5:2c0b:fa72 with SMTP id
y4-20020a170902ed4400b001b52c0bfa72mr10935423plb.12.1688491649816; Tue, 04
Jul 2023 10:27:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Tue, 4 Jul 2023 10:27:29 -0700 (PDT)
In-Reply-To: <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.182.196; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.182.196
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d917810d-9d68-4a36-ad46-9299174c2ccbn@googlegroups.com>
Subject: Re: I need a CPU core exclusively for one thread
From: cauldwel...@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Tue, 04 Jul 2023 17:27:30 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1554
 by: Frederick Virchanza - Tue, 4 Jul 2023 17:27 UTC

On Tuesday, July 4, 2023 at 6:25:16 PM UTC+1, Frederick Virchanza Gotham wrote:

> I was debugging it for approx 8 hours before I figured out what was wrong.. Now I'm lost losing any packets.

Typo:

Now I'm ***not*** losing any packets.

Re: I need a CPU core exclusively for one thread

<u81ogr$6006$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=627&group=comp.lang.c%2B%2B#627

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Tue, 4 Jul 2023 11:30:50 -0700
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <u81ogr$6006$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u7v56c$3p31n$2@dont-email.me> <RWGoM.17029$N3_4.10956@fx10.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 4 Jul 2023 18:30:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0b51468646672fc4513194d0d223d9f4";
logging-data="196614"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vHezmvGowldSGJIMS5qe8W9aUXEkaWw4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:CKqLlusKjFmplWEKTcbJXy3Kbco=
Content-Language: en-US
In-Reply-To: <RWGoM.17029$N3_4.10956@fx10.iad>
 by: Chris M. Thomasson - Tue, 4 Jul 2023 18:30 UTC

On 7/3/2023 2:18 PM, Scott Lurndal wrote:
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>> On 7/3/2023 3:42 AM, Frederick Virchanza Gotham wrote:
>>>
>>> I'm writing a network analysis program, and just today I've found out that it's too slow and missing packets.
>>>
>>> Ideally, I want the thread that reads from the network card to have exclusive use of one of the CPU cores.
>>>
>>> I'm looking at the following two functions:
>>> sched_setaffinity
>>> pthread_setaffinity_np
>>>
>>> And I note the following in the Linux manual:
>>> "For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process"
>>>
>>> I can find lots and lots of code examples to set the affinity for one thread or for one process -- however I cannot find one code example showing me how to exclude all other threads.
>>
>> Not sure you can do that. The OS can do whatever it wants. It can pin
>> your thread to a CPU, but that does not mean it cannot use said CPU for
>> other programs threads...
>
> Linux provides mechanisms that allow dedication of compute resources
> (e.g. hardware thread/core) to a specific set of processes. So do
> most other legacy Unix operating systems.
>
> The mechanisms vary based on the host operating system. cgroups is
> the current favored mechanism on linux.

Thanks Scott. Actually, I remember using affinity masks to try to
emulate per-cpu data in user mode as an experiment.

Re: I need a CPU core exclusively for one thread

<u81tch$6gsv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=629&group=comp.lang.c%2B%2B#629

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Tue, 4 Jul 2023 12:53:52 -0700
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <u81tch$6gsv$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u7v56c$3p31n$2@dont-email.me> <RWGoM.17029$N3_4.10956@fx10.iad>
<u81ogr$6006$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 4 Jul 2023 19:53:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0b51468646672fc4513194d0d223d9f4";
logging-data="213919"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zq3K0DHU67uiXPL00LhgUVq6rOPf6DUU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:iCgxPcJPoJAdFnTN0dVL809OAAI=
In-Reply-To: <u81ogr$6006$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Tue, 4 Jul 2023 19:53 UTC

On 7/4/2023 11:30 AM, Chris M. Thomasson wrote:
> On 7/3/2023 2:18 PM, Scott Lurndal wrote:
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> writes:
>>> On 7/3/2023 3:42 AM, Frederick Virchanza Gotham wrote:
>>>>
>>>> I'm writing a network analysis program, and just today I've found
>>>> out that it's too slow and missing packets.
>>>>
>>>> Ideally, I want the thread that reads from the network card to have
>>>> exclusive use of one of the CPU cores.
>>>>
>>>> I'm looking at the following two functions:
>>>>           sched_setaffinity
>>>>           pthread_setaffinity_np
>>>>
>>>> And I note the following in the Linux manual:
>>>>           "For example, by dedicating one CPU to a particular
>>>> process (i.e., setting the affinity mask of that process to specify
>>>> a single CPU, and setting the affinity mask of all other processes
>>>> to exclude that CPU), it is possible to ensure maximum execution
>>>> speed for that process"
>>>>
>>>> I can find lots and lots of code examples to set the affinity for
>>>> one thread or for one process -- however I cannot find one code
>>>> example showing me how to exclude all other threads.
>>>
>>> Not sure you can do that. The OS can do whatever it wants. It can pin
>>> your thread to a CPU, but that does not mean it cannot use said CPU for
>>> other programs threads...
>>
>> Linux provides mechanisms that allow dedication of compute resources
>> (e.g. hardware thread/core) to a specific set of processes.   So do
>> most other legacy Unix operating systems.
>>
>> The mechanisms vary based on the host operating system.  cgroups is
>> the current favored mechanism on linux.
>
> Thanks Scott. Actually, I remember using affinity masks to try to
> emulate per-cpu data in user mode as an experiment.

Iirc, I think I used the ALOM to check a cpu temperature when I pinned a
hot thread with a high priority to a CPU.

Re: I need a CPU core exclusively for one thread

<u82ntm$d40b$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=635&group=comp.lang.c%2B%2B#635

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Wed, 5 Jul 2023 05:26:50 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <u82ntm$d40b$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <UvVoM.17048$N3_4.6371@fx10.iad>
<u81fah$4v4j$1@dont-email.me> <QlYoM.1507$eGef.1471@fx47.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 5 Jul 2023 03:26:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="84df1c4b68440ca85fd155b837518074";
logging-data="430091"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/fISLKJmx0Rr3pHExJiteC3G79V5LKXk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:bJJPGtTn9qW0GB367lhiA4wlULw=
Content-Language: de-DE
In-Reply-To: <QlYoM.1507$eGef.1471@fx47.iad>
 by: Bonita Montero - Wed, 5 Jul 2023 03:26 UTC

Am 04.07.2023 um 19:08 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 04.07.2023 um 15:53 schrieb Scott Lurndal:
>>
>>> This is not accurate. RSS is used to direct NIC interrupts to
>>> specific cores, often depending on the contents of header fields ...
>>
>> And which NIC supports that ?
>
> Start with the ubiquitous Intel E-1000 and pretty much
> every other Intel pro NIC.

The NICs have Task offloading for IP- and TCP Checksum calculation.
Bu they for sure don't manage streams ! And interrupt routing isn't
done by the NIC.

> Most modern server NICs support some form of RSS.
> Cheap-ass consumer gear (realtek, etc) - you get what you pay for.

Linux doesn't use task offloading according to this:

https://en.wikipedia.org/wiki/TCP_offload_engine

Re: I need a CPU core exclusively for one thread

<u82o07$d40b$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=636&group=comp.lang.c%2B%2B#636

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Wed, 5 Jul 2023 05:28:11 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <u82o07$d40b$2@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me>
<88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 5 Jul 2023 03:28:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="84df1c4b68440ca85fd155b837518074";
logging-data="430091"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HQfdH7Q3LL2zA4OUtxaOWUWfcR/8kbMk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:UZU31X1WIKf9FP0wiFPeTRU2EIQ=
Content-Language: de-DE
In-Reply-To: <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
 by: Bonita Montero - Wed, 5 Jul 2023 03:28 UTC

Am 04.07.2023 um 19:25 schrieb Frederick Virchanza Gotham:
> On Tuesday, July 4, 2023 at 1:50:34 PM UTC+1, Bonita Montero wrote:
>>
>> So there must sth. different that you're missing packets.
>
>
> I figured out what's going on.
>
> In my code, when an Ethernet frame is read from the network card, I check the checksum of the IP header, and also the checksum of the TCP segment. If either is wrong, the entire Ethernet frame is discarded.
>
> In my code, I calculate what the checksum should be for the IP header, and I saw that in cases where the frame is discarded, the incoming packet had the 'total packet length' in the IP header as 44, but in my code I was calculating the checksum of 46 bytes. I didn't know where the other 2 bytes were coming from, whether they were 'options' in the TCP header or whatever, but then in Wireshark I saw that the packet had a mysterious "00 00" at the end. I selected those two bytes and Wireshark told me "Ethernet padding bytes".
>
> Turns out that if an Ethernet frame is less than 60 bytes, then it's padded with zeroes to bring it to 60 bytes.
>
> Ethernet header is 14 bytes, and the IP packet was 44 bytes, bringing the incoming frame to 58 bytes. So the operating system / network card tagged two zero bytes on the end.
>
> I was debugging it for approx 8 hours before I figured out what was wrong. Now I'm lost losing any packets.
>
> Still though I just set the 'priority' of my network reading thread to maximum.

Why do you do the checksum-stuff yourself ?

Re: I need a CPU core exclusively for one thread

<66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=638&group=comp.lang.c%2B%2B#638

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:6214:a04:b0:635:dabe:94 with SMTP id dw4-20020a0562140a0400b00635dabe0094mr53852qvb.11.1688547243101;
Wed, 05 Jul 2023 01:54:03 -0700 (PDT)
X-Received: by 2002:a17:902:a702:b0:1b8:a09b:38c8 with SMTP id
w2-20020a170902a70200b001b8a09b38c8mr4959846plq.8.1688547242740; Wed, 05 Jul
2023 01:54:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!glou.org!news.glou.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Wed, 5 Jul 2023 01:54:02 -0700 (PDT)
In-Reply-To: <u82o07$d40b$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.182.119; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.182.119
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
<u82o07$d40b$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
Subject: Re: I need a CPU core exclusively for one thread
From: cauldwel...@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Wed, 05 Jul 2023 08:54:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Frederick Virchanza - Wed, 5 Jul 2023 08:54 UTC

On Wednesday, July 5, 2023 at 4:28:22 AM UTC+1, Bonita Montero wrote:
>
> Why do you do the checksum-stuff yourself ?

My program opens a raw socket and does port scanning. I last released a version about 14 years ago: ( http://www.virjacode.com/projects/dynamo/ ), and I hope to release a new version with way more features this year.

Re: I need a CPU core exclusively for one thread

<u83j97$gdfp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=639&group=comp.lang.c%2B%2B#639

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: vir.camp...@invalid.invalid (Vir Campestris)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Wed, 5 Jul 2023 12:13:43 +0100
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <u83j97$gdfp$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me>
<88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 5 Jul 2023 11:13:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="02f45172f1cfbc00349309def77bdf92";
logging-data="538105"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZT0vjO8Ty0V4mvhgM8QrHfBG3evwOx4M="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:KYnu0vzefGDIwIr92hPUVRaVRH4=
In-Reply-To: <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
Content-Language: en-GB
 by: Vir Campestris - Wed, 5 Jul 2023 11:13 UTC

On 04/07/2023 18:25, Frederick Virchanza Gotham wrote:
> On Tuesday, July 4, 2023 at 1:50:34 PM UTC+1, Bonita Montero wrote:
>>
>> So there must sth. different that you're missing packets.
>
>
> I figured out what's going on.
>
> In my code, when an Ethernet frame is read from the network card, I check the checksum of the IP header, and also the checksum of the TCP segment. If either is wrong, the entire Ethernet frame is discarded.
>
> In my code, I calculate what the checksum should be for the IP header, and I saw that in cases where the frame is discarded, the incoming packet had the 'total packet length' in the IP header as 44, but in my code I was calculating the checksum of 46 bytes. I didn't know where the other 2 bytes were coming from, whether they were 'options' in the TCP header or whatever, but then in Wireshark I saw that the packet had a mysterious "00 00" at the end. I selected those two bytes and Wireshark told me "Ethernet padding bytes".
>
> Turns out that if an Ethernet frame is less than 60 bytes, then it's padded with zeroes to bring it to 60 bytes.
>
> Ethernet header is 14 bytes, and the IP packet was 44 bytes, bringing the incoming frame to 58 bytes. So the operating system / network card tagged two zero bytes on the end.
>
> I was debugging it for approx 8 hours before I figured out what was wrong. Now I'm lost losing any packets.
>
> Still though I just set the 'priority' of my network reading thread to maximum.

Thanks for letting us know. You've also just shown me how out of date I
am in HW knowledge - last time I looked a device only had one interrupt
line :(

So in fact you never were losing packets at the HW level, you were
throwing them away because you thought they were bad!

Andy

Re: I need a CPU core exclusively for one thread

<u83l04$gmkq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=640&group=comp.lang.c%2B%2B#640

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Wed, 5 Jul 2023 13:43:05 +0200
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <u83l04$gmkq$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me>
<88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
<u82o07$d40b$2@dont-email.me>
<66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 5 Jul 2023 11:43:00 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="84df1c4b68440ca85fd155b837518074";
logging-data="547482"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hf72N0KpGDUdlV9OSBfOJebkcc7Ocu+4="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:00s7PJakT6UyBtweddxpJVwemyc=
In-Reply-To: <66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Wed, 5 Jul 2023 11:43 UTC

Am 05.07.2023 um 10:54 schrieb Frederick Virchanza Gotham:

> My program opens a raw socket and does port scanning. I last released a version about 14 years ago: ( http://www.virjacode.com/projects/dynamo/ ), and I hope to release a new version with way more features this year.

I don't see much sense in that. If you scan a external
port range you need your own IP as the sender's address
to get replies. And if you do it that way you could use
normal sockets.

Re: I need a CPU core exclusively for one thread

<2307e176-b553-4959-be49-2b0504b82e75n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=641&group=comp.lang.c%2B%2B#641

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:622a:144c:b0:3ff:2517:172 with SMTP id v12-20020a05622a144c00b003ff25170172mr12749qtx.0.1688563713397;
Wed, 05 Jul 2023 06:28:33 -0700 (PDT)
X-Received: by 2002:a17:90a:e543:b0:262:e5e2:e5af with SMTP id
ei3-20020a17090ae54300b00262e5e2e5afmr11087588pjb.5.1688563712767; Wed, 05
Jul 2023 06:28:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Wed, 5 Jul 2023 06:28:32 -0700 (PDT)
In-Reply-To: <u83l04$gmkq$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.182.119; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.182.119
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
<u82o07$d40b$2@dont-email.me> <66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
<u83l04$gmkq$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2307e176-b553-4959-be49-2b0504b82e75n@googlegroups.com>
Subject: Re: I need a CPU core exclusively for one thread
From: cauldwel...@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Wed, 05 Jul 2023 13:28:33 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2343
 by: Frederick Virchanza - Wed, 5 Jul 2023 13:28 UTC

On Wednesday, July 5, 2023 at 12:43:19 PM UTC+1, Bonita Montero wrote:
> Am 05.07.2023 um 10:54 schrieb Frederick Virchanza Gotham:
>
> > My program opens a raw socket and does port scanning. I last released a version about 14 years ago: ( http://www.virjacode.com/projects/dynamo/ ), and I hope to release a new version with way more features this year.
> I don't see much sense in that. If you scan a external
> port range you need your own IP as the sender's address
> to get replies. And if you do it that way you could use
> normal sockets.

I suppose I could use normal sockets but I don't want the overhead of the operating system managing tens of thousands (yes, tens of thousands) of sockets and managing the 3-way handshakes for all those sockets. It's a lot more efficient to use a raw socket to send a byte-by-byte hand-crafted TCP SYN packet to each host, from port numbers 1 through 49151.

Re: I need a CPU core exclusively for one thread

<txepM.33222$t9v6.8891@fx15.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=642&group=comp.lang.c%2B%2B#642

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: I need a CPU core exclusively for one thread
Newsgroups: comp.lang.c++
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com> <u814i7$3nvo$1@dont-email.me> <UvVoM.17048$N3_4.6371@fx10.iad> <u81fah$4v4j$1@dont-email.me> <QlYoM.1507$eGef.1471@fx47.iad> <u82ntm$d40b$1@dont-email.me>
Lines: 41
Message-ID: <txepM.33222$t9v6.8891@fx15.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 05 Jul 2023 13:49:13 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 05 Jul 2023 13:49:13 GMT
X-Received-Bytes: 2351
 by: Scott Lurndal - Wed, 5 Jul 2023 13:49 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 04.07.2023 um 19:08 schrieb Scott Lurndal:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>> Am 04.07.2023 um 15:53 schrieb Scott Lurndal:
>>>
>>>> This is not accurate. RSS is used to direct NIC interrupts to
>>>> specific cores, often depending on the contents of header fields ...
>>>
>>> And which NIC supports that ?
>>
>> Start with the ubiquitous Intel E-1000 and pretty much
>> every other Intel pro NIC.
>
>The NICs have Task offloading for IP- and TCP Checksum calculation.
>Bu they for sure don't manage streams ! And interrupt routing isn't
>done by the NIC.

Your ignorance is showing. My company makes NICs. Very powerful
NICs. Which manage streams (the programmable TCAMs allow software
to select the packet fields that get CAMd when selecting the target CPU
for the interrupt).

Most use PCI/PCIe MSI-X interrupts, which have a 32-bit payload field
allowing (depending on the host interrupt controller) up to
2^32 different interrupt vectors. Our system support 21 bit
payloads, supporting 2^21 physical interrupts _per_ virtual device
using the ARM GIC-700 interrupt controller.

Using SR-IOV allows direct shared, but mediated, access to the NIC
from guest operating systems.

>
>> Most modern server NICs support some form of RSS.
>> Cheap-ass consumer gear (realtek, etc) - you get what you pay for.
>
>Linux doesn't use task offloading according to this:
>
>https://en.wikipedia.org/wiki/TCP_offload_engine

That's also incorrect. Take a look at DPDK or ODP.

Re: I need a CPU core exclusively for one thread

<7DepM.33223$t9v6.8281@fx15.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=643&group=comp.lang.c%2B%2B#643

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx15.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: I need a CPU core exclusively for one thread
Newsgroups: comp.lang.c++
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com> <u814i7$3nvo$1@dont-email.me> <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com> <u83j97$gdfp$1@dont-email.me>
Lines: 39
Message-ID: <7DepM.33223$t9v6.8281@fx15.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 05 Jul 2023 13:55:15 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 05 Jul 2023 13:55:15 GMT
X-Received-Bytes: 3181
 by: Scott Lurndal - Wed, 5 Jul 2023 13:55 UTC

Vir Campestris <vir.campestris@invalid.invalid> writes:
>On 04/07/2023 18:25, Frederick Virchanza Gotham wrote:
>> On Tuesday, July 4, 2023 at 1:50:34 PM UTC+1, Bonita Montero wrote:
>>>
>>> So there must sth. different that you're missing packets.
>>
>>
>> I figured out what's going on.
>>
>> In my code, when an Ethernet frame is read from the network card, I check the checksum of the IP header, and also the checksum of the TCP segment. If either is wrong, the entire Ethernet frame is discarded.
>>
>> In my code, I calculate what the checksum should be for the IP header, and I saw that in cases where the frame is discarded, the incoming packet had the 'total packet length' in the IP header as 44, but in my code I was calculating the checksum of 46 bytes. I didn't know where the other 2 bytes were coming from, whether they were 'options' in the TCP header or whatever, but then in Wireshark I saw that the packet had a mysterious "00 00" at the end. I selected those two bytes and Wireshark told me "Ethernet padding bytes".
>>
>> Turns out that if an Ethernet frame is less than 60 bytes, then it's padded with zeroes to bring it to 60 bytes.
>>
>> Ethernet header is 14 bytes, and the IP packet was 44 bytes, bringing the incoming frame to 58 bytes. So the operating system / network card tagged two zero bytes on the end.
>>
>> I was debugging it for approx 8 hours before I figured out what was wrong. Now I'm lost losing any packets.
>>
>> Still though I just set the 'priority' of my network reading thread to maximum.
>
>Thanks for letting us know. You've also just shown me how out of date I
>am in HW knowledge - last time I looked a device only had one interrupt
>line :(

Most modern high throughput devices use message signaled interrupts (MSI or MSI-X); MSI-X
has a 32-bit payload field, allowing up to four billion distinct interrupt
"lines". With interrupt virtualization, each guest operating system has
its own 32-bit interrupt namespace, allowing an infinite number of interrupt
"lines". The days of sharing level sensitive interrupts are long gone,
except for supporting legacy hardware.

>
>So in fact you never were losing packets at the HW level, you were
>throwing them away because you thought they were bad!

Or RED kicked in.

https://en.wikipedia.org/wiki/Random_early_detection

Re: I need a CPU core exclusively for one thread

<u840r3$i3fp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=647&group=comp.lang.c%2B%2B#647

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Wed, 5 Jul 2023 17:05:11 +0200
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <u840r3$i3fp$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me>
<88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
<u82o07$d40b$2@dont-email.me>
<66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
<u83l04$gmkq$1@dont-email.me>
<2307e176-b553-4959-be49-2b0504b82e75n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 5 Jul 2023 15:05:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="84df1c4b68440ca85fd155b837518074";
logging-data="593401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qBE4cvu2XnTNyN7s5bJ7bBymV3Ef6P0w="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:ZMMl276Uu10gYNUd/iEgQVtOpMg=
In-Reply-To: <2307e176-b553-4959-be49-2b0504b82e75n@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Wed, 5 Jul 2023 15:05 UTC

Am 05.07.2023 um 15:28 schrieb Frederick Virchanza Gotham:

> I suppose I could use normal sockets but I don't want the overhead of the operating system managing tens of thousands (yes, tens of thousands) of sockets and managing the 3-way handshakes for all those sockets. ...

These information is hashed and the time for the lookup is O(1).

Re: I need a CPU core exclusively for one thread

<9165c4fb-c1a7-44f3-b844-58cba3ebb916n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=651&group=comp.lang.c%2B%2B#651

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:a05:622a:18a3:b0:3fd:e74b:3194 with SMTP id v35-20020a05622a18a300b003fde74b3194mr548qtc.2.1688594667461;
Wed, 05 Jul 2023 15:04:27 -0700 (PDT)
X-Received: by 2002:a05:6a00:9a8:b0:682:24c1:2951 with SMTP id
u40-20020a056a0009a800b0068224c12951mr261220pfg.0.1688594667152; Wed, 05 Jul
2023 15:04:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Wed, 5 Jul 2023 15:04:26 -0700 (PDT)
In-Reply-To: <u840r3$i3fp$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.40.182.79; posting-account=w4UqJAoAAAAYC-PItfDbDoVGcg0yISyA
NNTP-Posting-Host: 92.40.182.79
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
<u82o07$d40b$2@dont-email.me> <66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
<u83l04$gmkq$1@dont-email.me> <2307e176-b553-4959-be49-2b0504b82e75n@googlegroups.com>
<u840r3$i3fp$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9165c4fb-c1a7-44f3-b844-58cba3ebb916n@googlegroups.com>
Subject: Re: I need a CPU core exclusively for one thread
From: cauldwel...@gmail.com (Frederick Virchanza Gotham)
Injection-Date: Wed, 05 Jul 2023 22:04:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Frederick Virchanza - Wed, 5 Jul 2023 22:04 UTC

On Wednesday, July 5, 2023 at 4:05:24 PM UTC+1, Bonita Montero wrote:
> Am 05.07.2023 um 15:28 schrieb Frederick Virchanza Gotham:
>
> > I suppose I could use normal sockets but I don't want the overhead of the operating system managing tens of thousands (yes, tens of thousands) of sockets and managing the 3-way handshakes for all those sockets. ...
>
> These information is hashed and the time for the lookup is O(1).

Yeah but we're talking 40,000 file descriptors for one process.

Re: I need a CPU core exclusively for one thread

<u85cvk$qfuk$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=655&group=comp.lang.c%2B%2B#655

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Thu, 6 Jul 2023 05:38:31 +0200
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <u85cvk$qfuk$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me> <UvVoM.17048$N3_4.6371@fx10.iad>
<u81fah$4v4j$1@dont-email.me> <QlYoM.1507$eGef.1471@fx47.iad>
<u82ntm$d40b$1@dont-email.me> <txepM.33222$t9v6.8891@fx15.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 6 Jul 2023 03:38:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="17c1d5ac7d9972daacabfa78c0a0e58c";
logging-data="868308"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+e0CUycrt71fNhw6EFkNDAc2tQW0LnwOM="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:WkMDbBzo8LKtrua7724ALDfuSXI=
Content-Language: de-DE
In-Reply-To: <txepM.33222$t9v6.8891@fx15.iad>
 by: Bonita Montero - Thu, 6 Jul 2023 03:38 UTC

Am 05.07.2023 um 15:49 schrieb Scott Lurndal:

> Your ignorance is showing. My company makes NICs. Very powerful
> NICs. Which manage streams (the programmable TCAMs allow software
> to select the packet fields that get CAMd when selecting the target
> CPU for the interrupt).

Show me the documentation.

Re: I need a CPU core exclusively for one thread

<u85q9b$rujd$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=657&group=comp.lang.c%2B%2B#657

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: I need a CPU core exclusively for one thread
Date: Thu, 6 Jul 2023 09:25:36 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <u85q9b$rujd$1@dont-email.me>
References: <d1a220ed-4ae3-42ce-8fb9-8aa408004dffn@googlegroups.com>
<u814i7$3nvo$1@dont-email.me>
<88e32ccc-7cad-4385-89dc-c11c66c14349n@googlegroups.com>
<u82o07$d40b$2@dont-email.me>
<66055871-b83b-4eb1-abc2-c29ec44a1e9en@googlegroups.com>
<u83l04$gmkq$1@dont-email.me>
<2307e176-b553-4959-be49-2b0504b82e75n@googlegroups.com>
<u840r3$i3fp$1@dont-email.me>
<9165c4fb-c1a7-44f3-b844-58cba3ebb916n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 6 Jul 2023 07:25:31 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="17c1d5ac7d9972daacabfa78c0a0e58c";
logging-data="916077"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/WP/SZhGngGVv+jREg/8+qDQmEg+dKbFg="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:uNY6tG/wdm1c6+/7xWzVwHoPMdw=
In-Reply-To: <9165c4fb-c1a7-44f3-b844-58cba3ebb916n@googlegroups.com>
Content-Language: de-DE
 by: Bonita Montero - Thu, 6 Jul 2023 07:25 UTC

Am 06.07.2023 um 00:04 schrieb Frederick Virchanza Gotham:
> On Wednesday, July 5, 2023 at 4:05:24 PM UTC+1, Bonita Montero wrote:
>> Am 05.07.2023 um 15:28 schrieb Frederick Virchanza Gotham:
>>
>>> I suppose I could use normal sockets but I don't want the overhead of the operating system managing tens of thousands (yes, tens of thousands) of sockets and managing the 3-way handshakes for all those sockets. ...
>>
>> These information is hashed and the time for the lookup is O(1).
>
>
> Yeah but we're talking 40,000 file descriptors for one process.

Even with a billion file descriptors the access time would
be the same, i.e. O(1).


devel / comp.lang.c++ / I need a CPU core exclusively for one thread

Pages:12345678
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor