Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

If I have not seen so far it is because I stood in giant's footsteps.


devel / comp.lang.c++ / Re: Threads across programming languages

SubjectAuthor
* Threads across programming languagesStefan Ram
+* Re: Threads across programming languagesPaavo Helde
|+* Re: Threads across programming languagesLawrence D'Oliveiro
||+* Re: Threads across programming languagesChris M. Thomasson
|||+* Re: Threads across programming languagesLawrence D'Oliveiro
||||`* Re: Threads across programming languagesChris M. Thomasson
|||| `- Re: Threads across programming languagesLawrence D'Oliveiro
|||`* Re: Threads across programming languagesBonita Montero
||| +* Re: Threads across programming languagesLawrence D'Oliveiro
||| |`* Re: Threads across programming languagesBonita Montero
||| | `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  +* Re: Threads across programming languagesBonita Montero
||| |  |`* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | +* Re: Threads across programming languagesBonita Montero
||| |  | |+* Re: Threads across programming languagesDavid Brown
||| |  | ||`* Re: Threads across programming languagesBonita Montero
||| |  | || +- Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | || `* Re: Threads across programming languagesDavid Brown
||| |  | ||  `* Re: Threads across programming languagesBonita Montero
||| |  | ||   `* Re: Threads across programming languagesDavid Brown
||| |  | ||    `* Re: Threads across programming languagesBonita Montero
||| |  | ||     `* Re: Threads across programming languagesMichael S
||| |  | ||      +- Re: Threads across programming languagesBonita Montero
||| |  | ||      `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | ||       `* Re: Threads across programming languagesPaavo Helde
||| |  | ||        +* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | ||        |+- Re: Threads across programming languagesPaavo Helde
||| |  | ||        |`* Re: Threads across programming languagesMichael S
||| |  | ||        | +- Re: Threads across programming languagesBonita Montero
||| |  | ||        | `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | ||        |  `* Re: Threads across programming languagesMichael S
||| |  | ||        |   +* Re: Threads across programming languagesBonita Montero
||| |  | ||        |   |`- Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | ||        |   `- Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | ||        `* Re: Threads across programming languagesTim Rentsch
||| |  | ||         `* Re: Threads across programming languagesPaavo Helde
||| |  | ||          +- Re: Threads across programming languagesBonita Montero
||| |  | ||          `* Re: Threads across programming languagesTim Rentsch
||| |  | ||           +- Re: Threads across programming languagesBonita Montero
||| |  | ||           `* Re: Threads across programming languagesPaavo Helde
||| |  | ||            +* Re: Threads across programming languagesBonita Montero
||| |  | ||            |`* Re: Threads across programming languageswij
||| |  | ||            | `* Re: Threads across programming languagesBonita Montero
||| |  | ||            |  `- Re: Threads across programming languagesChris M. Thomasson
||| |  | ||            +* Re: Threads across programming languageswij
||| |  | ||            |+* Re: Threads across programming languagesBonita Montero
||| |  | ||            ||`- Re: Threads across programming languageswij
||| |  | ||            |`* Re: Threads across programming languagesDavid Brown
||| |  | ||            | `* Re: Threads across programming languageswij
||| |  | ||            |  +* Re: Threads across programming languagesPaavo Helde
||| |  | ||            |  |+* Re: Threads across programming languageswij
||| |  | ||            |  ||+- Re: Threads across programming languagesRoss Finlayson
||| |  | ||            |  ||+- Re: Threads across programming languagesBonita Montero
||| |  | ||            |  ||`- Re: Threads across programming languagesPaavo Helde
||| |  | ||            |  |`* Re: Threads across programming languagesBonita Montero
||| |  | ||            |  | `- Re: Threads across programming languagesPaavo Helde
||| |  | ||            |  +* Re: Threads across programming languagesBonita Montero
||| |  | ||            |  |+- Re: Threads across programming languagesChris M. Thomasson
||| |  | ||            |  |`* Re: Threads across programming languageswij
||| |  | ||            |  | `* Re: Threads across programming languagesBonita Montero
||| |  | ||            |  |  `* Re: Threads across programming languagesChris M. Thomasson
||| |  | ||            |  |   `* Re: Threads across programming languagesBonita Montero
||| |  | ||            |  |    `- Re: Threads across programming languagesChris M. Thomasson
||| |  | ||            |  `* Re: Threads across programming languagesDavid Brown
||| |  | ||            |   `* Re: Threads across programming languageswij
||| |  | ||            |    `* Re: Threads across programming languagesPaavo Helde
||| |  | ||            |     `- Re: Threads across programming languagesBonita Montero
||| |  | ||            `- Re: Threads across programming languagesMichael S
||| |  | |`* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | | `* Re: Threads across programming languagesBonita Montero
||| |  | |  +* Re: Threads across programming languagesBonita Montero
||| |  | |  |`- Re: Threads across programming languagesBonita Montero
||| |  | |  +* Re: Threads across programming languagesChris M. Thomasson
||| |  | |  |`* Re: Threads across programming languagesChris M. Thomasson
||| |  | |  | `- Re: Threads across programming languagesChris M. Thomasson
||| |  | |  +* Re: Threads across programming languagesBonita Montero
||| |  | |  |+- Re: Threads across programming languagesChris M. Thomasson
||| |  | |  |`* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | |  | `- Re: Threads across programming languagesChris M. Thomasson
||| |  | |  `- Re: Threads across programming languagesLawrence D'Oliveiro
||| |  | `* Re: Threads across programming languagesChris M. Thomasson
||| |  |  +- Re: Threads across programming languagesChris M. Thomasson
||| |  |  `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  |   +* Re: Threads across programming languagesBonita Montero
||| |  |   |`* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  |   | `* Re: Threads across programming languagesBonita Montero
||| |  |   |  +* Re: Threads across programming languagesBonita Montero
||| |  |   |  |`- Re: Threads across programming languagesChris M. Thomasson
||| |  |   |  `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  |   |   `* Re: Threads across programming languagesChris M. Thomasson
||| |  |   |    `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  |   |     `- Re: Threads across programming languagesChris M. Thomasson
||| |  |   `* Re: Threads across programming languagesChris M. Thomasson
||| |  |    `* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  |     `* Re: Threads across programming languagesChris M. Thomasson
||| |  |      +* Re: Threads across programming languagesKaz Kylheku
||| |  |      |`* Re: Threads across programming languagesChris M. Thomasson
||| |  |      | `- Re: Threads across programming languagesChris M. Thomasson
||| |  |      +* Re: Threads across programming languagesLawrence D'Oliveiro
||| |  |      |`* Re: Threads across programming languagesRoss Finlayson
||| |  |      | `- Re: Threads across programming languagesRoss Finlayson
||| |  |      `* Re: Threads across programming languagesDavid Brown
||| |  `- Re: Threads across programming languagesChris M. Thomasson
||| `- Re: Threads across programming languagesChris M. Thomasson
||`* Re: Threads across programming languagesBonita Montero
|`- Re: Threads across programming languagesScott Lurndal
+* Re: Threads across programming languagesBonita Montero
+* Re: Threads across programming languagesRoss Finlayson
+- Re: Threads across programming languagesChris M. Thomasson
+- Re: Threads across programming languagesLawrence D'Oliveiro
`* Re: Threads across programming languagesStefan Ram

Pages:1234567
Threads across programming languages

<GIL-20240429161553@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Threads across programming languages
Date: 29 Apr 2024 15:19:19 GMT
Organization: Stefan Ram
Lines: 46
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <GIL-20240429161553@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de kdNvl5nF6zF8DmBi02H4aggNAdqfup4ILd/e1LEZpMb7+x
Cancel-Lock: sha1:zDUIv81SWBYBWs9/mTGbTkQA9/k= sha256:+5HVd02oA4hgHbUCCuUkJiQ1KATTiW38xnufcHjiNuI=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
 by: Stefan Ram - Mon, 29 Apr 2024 15:19 UTC

paavo512 <paavo@osa.pri.ee> wrote or quoted:
|Anyway, multithreading performance is a non-issue for Python so far as
|the Python interpreter runs in a single-threaded regime anyway, under a
|global GIL lock. They are planning to get rid of GIL, but this work is
|still in development AFAIK. I'm sure it will take years to stabilize the
|whole Python zoo without GIL.

The GIL only prevents multiple Python statements from being
interpreted simultaneously, but if you're waiting on inputs (like
sockets), it's not active, so that could be distributed across
multiple cores.

With asyncio, however, you can easily handle the application
for threads to "wait in parallel" for thousands of sockets in a
single thread, and there are fewer opportunities for errors than
with multithreading.

Additionally, there are libraries like numpy that use true
multithreading internally to distribute computational tasks
across multiple cores. By using such libraries, you can take
advantage of that. (Not to mention the AI libraries that have their
work done in highly parallel fashion by graphics cards.)

If you want real threads, you could probably work with Cython
sometimes.

Other languages like JavaScript seem to have an advantage there
because they don't know a GIL, but with JavaScript, for example,
it's because it always runs in a single thread overall. And in
the languages where there are threads without a GIL, you quickly
realize that programming correct non-trivial programs with
parallel processing is error-prone.

Often in Python you can use "ThreadPoolExecutor" to start
multiple threads. If the GIL then becomes a problem (which is
not the case if you're waiting on I/O), you can easily swap it
out for "ProcessPoolExecutor": Then processes are used instead
of threads, and there is no GIL for those.

If four cores are available, by dividing up compute-intensive tasks
using "ProcessPoolExecutor", you can expect a speedup factor of two
to eight.

With the Celery library, tasks can be distributed across multiple
processes that can also run on different computers. See, for
example, "Parallel Programming with Python" by Jan Palach.

Re: Threads across programming languages

<v0ogum$1rc5n$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: eesn...@osa.pri.ee (Paavo Helde)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 19:13:09 +0300
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <v0ogum$1rc5n$1@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 Apr 2024 18:13:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="cd9ed2ea4969c9168b428e0884723280";
logging-data="1945783"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19L27uuTw6BY+reD/v1nM88qIoaUs8ljf0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:aGvWKiOXsvC1SiqINzM7N9NfPa8=
In-Reply-To: <GIL-20240429161553@ram.dialup.fu-berlin.de>
Content-Language: en-US
 by: Paavo Helde - Mon, 29 Apr 2024 16:13 UTC

On 29.04.2024 18:19, Stefan Ram wrote:
> paavo512 <paavo@osa.pri.ee> wrote or quoted:
> |Anyway, multithreading performance is a non-issue for Python so far as
> |the Python interpreter runs in a single-threaded regime anyway, under a
> |global GIL lock. They are planning to get rid of GIL, but this work is
> |still in development AFAIK. I'm sure it will take years to stabilize the
> |whole Python zoo without GIL.
>
> The GIL only prevents multiple Python statements from being
> interpreted simultaneously, but if you're waiting on inputs (like
> sockets), it's not active, so that could be distributed across
> multiple cores.
>
> With asyncio, however, you can easily handle the application
> for threads to "wait in parallel" for thousands of sockets in a
> single thread, and there are fewer opportunities for errors than
> with multithreading.

In C++, async io is provided e.g. by the asio library.

Just for waiting on thousands on sockets I believe a single select()
call would be sufficient, no threads or asio is needed. But you probably
meant something more.

>
> Additionally, there are libraries like numpy that use true
> multithreading internally to distribute computational tasks
> across multiple cores. By using such libraries, you can take
> advantage of that. (Not to mention the AI libraries that have their
> work done in highly parallel fashion by graphics cards.)
>
> If you want real threads, you could probably work with Cython
> sometimes.

Huh, my goal is to avoid Python, not to work with it. Unfortunately this
(avoiding Python) becomes harder all the time.

>
> Other languages like JavaScript seem to have an advantage there
> because they don't know a GIL, but with JavaScript, for example,
> it's because it always runs in a single thread overall. And in
> the languages where there are threads without a GIL, you quickly
> realize that programming correct non-trivial programs with
> parallel processing is error-prone.

Been there, done that, worked through it ... 15 years ago. Nowadays
non-trivial multi-threaded parallel processing in C++ seems pretty easy
for me, one just needs to follow some principles and take care to get
the details correct. I guess it's about the same as memory management in
C, one can get it correct with taking some care. In C++ I can forget
about memory management as it is largely automatic, but for
multithreading I still need to take care.

Re: Threads across programming languages

<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 18:18:57 +0200
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 Apr 2024 18:18:55 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="b3e0222ff44d0afec582eb4b43563aba";
logging-data="1947119"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kTLJl5oBW89742UvMOOX179zB0GCYO/g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:ZHozGl2yWv0O0B1koAQnfHSUNks=
Content-Language: de-DE
In-Reply-To: <GIL-20240429161553@ram.dialup.fu-berlin.de>
 by: Bonita Montero - Mon, 29 Apr 2024 16:18 UTC

Am 29.04.2024 um 17:19 schrieb Stefan Ram:

> With asyncio, however, you can easily handle the application
> for threads to "wait in parallel" for thousands of sockets in a
> single thread, and there are fewer opportunities for errors than
> with multithreading.
>

But you need multithreading to have maximum throughput since you often
process the data while other data is available.

Re: Threads across programming languages

<RPidnQT6TOLEU7L7nZ2dnZfqnPWdnZ2d@giganews.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder9.news.weretis.net!border-3.nntp.ord.giganews.com!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 29 Apr 2024 16:44:09 +0000
Subject: Re: Threads across programming languages
Newsgroups: comp.lang.c++,comp.lang.c
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
From: ross.a.f...@gmail.com (Ross Finlayson)
Date: Mon, 29 Apr 2024 09:44:16 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <GIL-20240429161553@ram.dialup.fu-berlin.de>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <RPidnQT6TOLEU7L7nZ2dnZfqnPWdnZ2d@giganews.com>
Lines: 236
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-4OKVpaZmJrhjPp6a+HPPHHqXT/qzPqiJvxkfXGgf8IAThvcKGiM14qXC9kp8kXSyTI7sSdGqEYrXm8A!tqDeVEWLCKteit5liWLdxy0FxQOt/wU/iopkGyjsusKu4cz1z8WiGDgj+ST2nXG8Y73B9EljAY3+!NQ==
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Ross Finlayson - Mon, 29 Apr 2024 16:44 UTC

On 04/29/2024 08:19 AM, Stefan Ram wrote:
> paavo512 <paavo@osa.pri.ee> wrote or quoted:
> |Anyway, multithreading performance is a non-issue for Python so far as
> |the Python interpreter runs in a single-threaded regime anyway, under a
> |global GIL lock. They are planning to get rid of GIL, but this work is
> |still in development AFAIK. I'm sure it will take years to stabilize the
> |whole Python zoo without GIL.
>
> The GIL only prevents multiple Python statements from being
> interpreted simultaneously, but if you're waiting on inputs (like
> sockets), it's not active, so that could be distributed across
> multiple cores.
>
> With asyncio, however, you can easily handle the application
> for threads to "wait in parallel" for thousands of sockets in a
> single thread, and there are fewer opportunities for errors than
> with multithreading.
>
> Additionally, there are libraries like numpy that use true
> multithreading internally to distribute computational tasks
> across multiple cores. By using such libraries, you can take
> advantage of that. (Not to mention the AI libraries that have their
> work done in highly parallel fashion by graphics cards.)
>
> If you want real threads, you could probably work with Cython
> sometimes.
>
> Other languages like JavaScript seem to have an advantage there
> because they don't know a GIL, but with JavaScript, for example,
> it's because it always runs in a single thread overall. And in
> the languages where there are threads without a GIL, you quickly
> realize that programming correct non-trivial programs with
> parallel processing is error-prone.
>
> Often in Python you can use "ThreadPoolExecutor" to start
> multiple threads. If the GIL then becomes a problem (which is
> not the case if you're waiting on I/O), you can easily swap it
> out for "ProcessPoolExecutor": Then processes are used instead
> of threads, and there is no GIL for those.
>
> If four cores are available, by dividing up compute-intensive tasks
> using "ProcessPoolExecutor", you can expect a speedup factor of two
> to eight.
>
> With the Celery library, tasks can be distributed across multiple
> processes that can also run on different computers. See, for
> example, "Parallel Programming with Python" by Jan Palach.
>

It sort of seems there are two approaches to
the parallel, and the asynchronous.

There's, "divide-and-conquer", and "information-cooperation".

The linear-speedup of the embarrassingly parallel
in the divide-and-conquer, or single-instruction-multiple-data,
is a pretty great thing.

Notions like map-reduce when the count of values
per key is about same and thusly the computing
the aggregates (summaries, digests, aggregate
and analytic functions) can be accomplished by
horizontal scaling (more boxes with same resources),
is another usual divide-and-conquer approach
(horizontal scaling).

Once upon a time there was this great idea called
"Aglets" or "mobile agents" or "mobile code". This
is basically that a functional program is distributed
to nodes, to run on the facilities of the nodes with
some resources, then to return to the "aglet-hive"
what results can be composed. This is also usually
called anything the "agent" or "instrumentation"
on the box. (The box, a process model, its processes,
their threads, their "inter-thread calls", their "inter-process
calls", their network, a node, a box. Aglets are the
little caps or tape at the end of shoe-laces, here
with regards to notions like "aggregate functions"
and "analytic functions".)

The cooperation is basically any notion of a callback.
The callback is one of the fundamental notions of
flow-of-control, and about the most elementary
notion of the functional paradigm in otherwise
the procedural or the imperative paradigm.

Otherwise for threads to fork, to divide, then
whether they join, is a callback.

So, first learning the idea of a callback is like,
"you mean I need to provide a different entry
point for this code to return and then where
I'm at is exiting forever as if in a shell process
model exec'ing another process and resulting
that this process becomes that one", and it's
like "yeah, you just give it a callback address
and what results is that's where it goes".
It's functional.

(Functional/event-driven, procedural/imperative.)

Some people learn functional first, and others
procedural first. It's hard to say how people
think, in their mental models of the things,
which is pretty much always flow-machines.
The chip, or the old planar integrated-circuit
the usually standard logic the chip, is systolic,
the systolic flow driven by the systolic clock,
that most people have a flow-model of code.

So, there's callbacks, and then there's funnels
and distributors, say, then as with regards to
something like a "Clos network", any kind of
usual model of data-flow, it's a flow-machine.

Funnels/sprinklers: Venturi effect.

In flow machines, there's basically something
like "Ford-Fulkerson flow algorithm", which is
a hypothetical sort of algorithm that formalizes
and optimizes flow.

Threads fork, and they also join.

The only hardware threads are independent cores,
and, their semantics of memory barriers,
according to their clocks. The rest is organization
of context and routine and state and stack,
and for the general purpose usually pre-emptive,
or, "time-sharing".

Or, you know, "nodes".

It's a time-sharing system.

So, there's processes and a process model,
there's the inter-process, then there's threading
models, and the re-entrant and shared and
the mutex, according to ordering and serial
guarantees or "delivery", it's message-passing
of course, vis-a-vis "the core" or memory,
a monad or a purely functional state,
it's a distributed system of nodes.

Once there was an initiative called "Parallel C",
language and compiler extensions to support
language constructs embodying the notions of
the parallel.

Somebody came up with pi calculus, process
calculus, communicating sequential processes
and the like. I've heard of Djikstra's law yet I
forget it, and any entry point is a "goto".

In clusters, there's a usual notion of message-passing,
often organized about the process model among nodes
of the cluster. There's MPI and old Silicon Grid Engine.
Once there was Wolfpack cluster. The clusters are
often mounted in a rack together and about things
like Infiniband networking and NUMA memory.

"HPC" they call it, though that includes both
clusters the horizontally scale-able, and also
computers of the super-scalar word variety.

The process model, is the usual way of the old
control-plane way to organize processes with
shared resources and separate quotas, and
to support independent process spaces,
making for fork as spawn and otherwise
though pipes and message-slots what make
for join. Then there are thread, OS threads,
and in some cases fibers, OS threads, as
about processes, OS threads.

Some usual virtual machines or runtimes like
ye olde Java, have threads and synchronization
for barriers and monitors and mutexes and what,
about system calls and barriers and monitors and
mutexes, in the process model.

The interpreted runtimes are usually "single-threaded",
about though the notions of event loops and responsiveness.
That follows from "a Win32 app the message pump", then
mostly these days since "a JavaScript binding for the script
element binding of an HTML with HTTP user-agent, for
UI-Events according to old W3C now whatwg, and maybe
it's ECMAScript and with modules or something, and then
also there's new-fangled web workers which are threads for
ECMAScript or JavaScript which are about the same".

Writing algorithms in event loops is a sort of
exercise in frustration, in a sense. Yet, when
recursion is figured out as having to build a state
instead of just filling the stack, it's a thing.
(A single-threaded thing.)

These days most distributed algorithms are sort
of advised for "horizontal scaling" and "eventual
consistency" with often "opportunistic locks" in
a world of "Murphy guarantees the un-ordered".

Then transactions of the more critical sort are
often "boxes with huge RAM rollback segments"
or as with regards to "matching and reconciliation",
after the fact.

Then of course obligatory about C++, or, C/C++,
it's about OS threads and, "guarantees".

Here my approach is "re-routines". "Re-routines:
it's a co-routine, though instead of suspending
it just quits, and instead of switching it just
builds its own monad for the recusion, and
instead of having callbacks, it's always callbacks,
and instead of having futures everywhere,
it's futures everywhere. Try, try again."


Click here to read the complete article
Re: Threads across programming languages

<RsudnRRDUtiEcbL7nZ2dnZfqnPednZ2d@giganews.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder9.news.weretis.net!border-4.nntp.ord.giganews.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Mon, 29 Apr 2024 18:51:05 +0000
Subject: Re: Threads across programming languages
Newsgroups: comp.lang.c++,comp.lang.c
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<RPidnQT6TOLEU7L7nZ2dnZfqnPWdnZ2d@giganews.com>
From: ross.a.f...@gmail.com (Ross Finlayson)
Date: Mon, 29 Apr 2024 11:51:07 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <RPidnQT6TOLEU7L7nZ2dnZfqnPWdnZ2d@giganews.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <RsudnRRDUtiEcbL7nZ2dnZfqnPednZ2d@giganews.com>
Lines: 299
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-My4jWvHXiyoB6OfhyRsJpQZxVbxUdKnoOyj/isk6sU1ISkmQ84iqc9l4gKlVlSSHgrQBuvmWW8cZrrC!3QsTsoRFLVPR5337ksC5Gv9y9lgO76+Usfl138NYBgXyW8OJHeCmmfGU+17C3kwia+TV6dBLrM25!mg==
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Ross Finlayson - Mon, 29 Apr 2024 18:51 UTC

On 04/29/2024 09:44 AM, Ross Finlayson wrote:
> On 04/29/2024 08:19 AM, Stefan Ram wrote:
>> paavo512 <paavo@osa.pri.ee> wrote or quoted:
>> |Anyway, multithreading performance is a non-issue for Python so far as
>> |the Python interpreter runs in a single-threaded regime anyway, under a
>> |global GIL lock. They are planning to get rid of GIL, but this work is
>> |still in development AFAIK. I'm sure it will take years to stabilize the
>> |whole Python zoo without GIL.
>>
>> The GIL only prevents multiple Python statements from being
>> interpreted simultaneously, but if you're waiting on inputs (like
>> sockets), it's not active, so that could be distributed across
>> multiple cores.
>>
>> With asyncio, however, you can easily handle the application
>> for threads to "wait in parallel" for thousands of sockets in a
>> single thread, and there are fewer opportunities for errors than
>> with multithreading.
>>
>> Additionally, there are libraries like numpy that use true
>> multithreading internally to distribute computational tasks
>> across multiple cores. By using such libraries, you can take
>> advantage of that. (Not to mention the AI libraries that have their
>> work done in highly parallel fashion by graphics cards.)
>>
>> If you want real threads, you could probably work with Cython
>> sometimes.
>>
>> Other languages like JavaScript seem to have an advantage there
>> because they don't know a GIL, but with JavaScript, for example,
>> it's because it always runs in a single thread overall. And in
>> the languages where there are threads without a GIL, you quickly
>> realize that programming correct non-trivial programs with
>> parallel processing is error-prone.
>>
>> Often in Python you can use "ThreadPoolExecutor" to start
>> multiple threads. If the GIL then becomes a problem (which is
>> not the case if you're waiting on I/O), you can easily swap it
>> out for "ProcessPoolExecutor": Then processes are used instead
>> of threads, and there is no GIL for those.
>>
>> If four cores are available, by dividing up compute-intensive tasks
>> using "ProcessPoolExecutor", you can expect a speedup factor of two
>> to eight.
>>
>> With the Celery library, tasks can be distributed across multiple
>> processes that can also run on different computers. See, for
>> example, "Parallel Programming with Python" by Jan Palach.
>>
>
>
>
> It sort of seems there are two approaches to
> the parallel, and the asynchronous.
>
> There's, "divide-and-conquer", and "information-cooperation".
>
> The linear-speedup of the embarrassingly parallel
> in the divide-and-conquer, or single-instruction-multiple-data,
> is a pretty great thing.
>
> Notions like map-reduce when the count of values
> per key is about same and thusly the computing
> the aggregates (summaries, digests, aggregate
> and analytic functions) can be accomplished by
> horizontal scaling (more boxes with same resources),
> is another usual divide-and-conquer approach
> (horizontal scaling).
>
> Once upon a time there was this great idea called
> "Aglets" or "mobile agents" or "mobile code". This
> is basically that a functional program is distributed
> to nodes, to run on the facilities of the nodes with
> some resources, then to return to the "aglet-hive"
> what results can be composed. This is also usually
> called anything the "agent" or "instrumentation"
> on the box. (The box, a process model, its processes,
> their threads, their "inter-thread calls", their "inter-process
> calls", their network, a node, a box. Aglets are the
> little caps or tape at the end of shoe-laces, here
> with regards to notions like "aggregate functions"
> and "analytic functions".)
>
>
> The cooperation is basically any notion of a callback.
> The callback is one of the fundamental notions of
> flow-of-control, and about the most elementary
> notion of the functional paradigm in otherwise
> the procedural or the imperative paradigm.
>
> Otherwise for threads to fork, to divide, then
> whether they join, is a callback.
>
> So, first learning the idea of a callback is like,
> "you mean I need to provide a different entry
> point for this code to return and then where
> I'm at is exiting forever as if in a shell process
> model exec'ing another process and resulting
> that this process becomes that one", and it's
> like "yeah, you just give it a callback address
> and what results is that's where it goes".
> It's functional.
>
> (Functional/event-driven, procedural/imperative.)
>
>
> Some people learn functional first, and others
> procedural first. It's hard to say how people
> think, in their mental models of the things,
> which is pretty much always flow-machines.
> The chip, or the old planar integrated-circuit
> the usually standard logic the chip, is systolic,
> the systolic flow driven by the systolic clock,
> that most people have a flow-model of code.
>
>
> So, there's callbacks, and then there's funnels
> and distributors, say, then as with regards to
> something like a "Clos network", any kind of
> usual model of data-flow, it's a flow-machine.
>
> Funnels/sprinklers: Venturi effect.
>
> In flow machines, there's basically something
> like "Ford-Fulkerson flow algorithm", which is
> a hypothetical sort of algorithm that formalizes
> and optimizes flow.
>
>
> Threads fork, and they also join.
>
> The only hardware threads are independent cores,
> and, their semantics of memory barriers,
> according to their clocks. The rest is organization
> of context and routine and state and stack,
> and for the general purpose usually pre-emptive,
> or, "time-sharing".
>
> Or, you know, "nodes".
>
>
> It's a time-sharing system.
>
>
> So, there's processes and a process model,
> there's the inter-process, then there's threading
> models, and the re-entrant and shared and
> the mutex, according to ordering and serial
> guarantees or "delivery", it's message-passing
> of course, vis-a-vis "the core" or memory,
> a monad or a purely functional state,
> it's a distributed system of nodes.
>
>
> Once there was an initiative called "Parallel C",
> language and compiler extensions to support
> language constructs embodying the notions of
> the parallel.
>
> Somebody came up with pi calculus, process
> calculus, communicating sequential processes
> and the like. I've heard of Djikstra's law yet I
> forget it, and any entry point is a "goto".
>
> In clusters, there's a usual notion of message-passing,
> often organized about the process model among nodes
> of the cluster. There's MPI and old Silicon Grid Engine.
> Once there was Wolfpack cluster. The clusters are
> often mounted in a rack together and about things
> like Infiniband networking and NUMA memory.
>
> "HPC" they call it, though that includes both
> clusters the horizontally scale-able, and also
> computers of the super-scalar word variety.
>
> The process model, is the usual way of the old
> control-plane way to organize processes with
> shared resources and separate quotas, and
> to support independent process spaces,
> making for fork as spawn and otherwise
> though pipes and message-slots what make
> for join. Then there are thread, OS threads,
> and in some cases fibers, OS threads, as
> about processes, OS threads.
>
> Some usual virtual machines or runtimes like
> ye olde Java, have threads and synchronization
> for barriers and monitors and mutexes and what,
> about system calls and barriers and monitors and
> mutexes, in the process model.
>
> The interpreted runtimes are usually "single-threaded",
> about though the notions of event loops and responsiveness.
> That follows from "a Win32 app the message pump", then
> mostly these days since "a JavaScript binding for the script
> element binding of an HTML with HTTP user-agent, for
> UI-Events according to old W3C now whatwg, and maybe
> it's ECMAScript and with modules or something, and then
> also there's new-fangled web workers which are threads for
> ECMAScript or JavaScript which are about the same".
>
> Writing algorithms in event loops is a sort of
> exercise in frustration, in a sense. Yet, when
> recursion is figured out as having to build a state
> instead of just filling the stack, it's a thing.
> (A single-threaded thing.)
>
> These days most distributed algorithms are sort
> of advised for "horizontal scaling" and "eventual
> consistency" with often "opportunistic locks" in
> a world of "Murphy guarantees the un-ordered".
>
> Then transactions of the more critical sort are
> often "boxes with huge RAM rollback segments"
> or as with regards to "matching and reconciliation",
> after the fact.
>
>
> Then of course obligatory about C++, or, C/C++,
> it's about OS threads and, "guarantees".
>
>
> Here my approach is "re-routines". "Re-routines:
> it's a co-routine, though instead of suspending
> it just quits, and instead of switching it just
> builds its own monad for the recusion, and
> instead of having callbacks, it's always callbacks,
> and instead of having futures everywhere,
> it's futures everywhere. Try, try again."
>
> In the process model in the runtime though,
> it's mostly about what services the bus DMA.
> "Systems", programming.
>
> Boxes is nodes, ....
>
>


Click here to read the complete article
Re: Threads across programming languages

<v0ovis$1uq6q$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 13:22:52 -0700
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <v0ovis$1uq6q$3@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 Apr 2024 22:22:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="68a1f8b2290ba520f984bb7e7fb4eebe";
logging-data="2058458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Dtk+hhrF6s6fofpcDNe2Qi6VxTX8jPvc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/dmXvYQ7g3ir/++zDueA7tkdpCI=
Content-Language: en-US
In-Reply-To: <GIL-20240429161553@ram.dialup.fu-berlin.de>
 by: Chris M. Thomasson - Mon, 29 Apr 2024 20:22 UTC

On 4/29/2024 8:19 AM, Stefan Ram wrote:
> paavo512 <paavo@osa.pri.ee> wrote or quoted:
> |Anyway, multithreading performance is a non-issue for Python so far as
> |the Python interpreter runs in a single-threaded regime anyway, under a
> |global GIL lock. They are planning to get rid of GIL, but this work is
> |still in development AFAIK. I'm sure it will take years to stabilize the
> |whole Python zoo without GIL.
>
> The GIL only prevents multiple Python statements from being
> interpreted simultaneously, but if you're waiting on inputs (like
> sockets), it's not active, so that could be distributed across
> multiple cores.
>
> With asyncio, however, you can easily handle the application
> for threads to "wait in parallel" for thousands of sockets in a
> single thread, and there are fewer opportunities for errors than
> with multithreading.
>
> Additionally, there are libraries like numpy that use true
> multithreading internally to distribute computational tasks
> across multiple cores. By using such libraries, you can take
> advantage of that. (Not to mention the AI libraries that have their
> work done in highly parallel fashion by graphics cards.)
>
> If you want real threads, you could probably work with Cython
> sometimes.
>
> Other languages like JavaScript seem to have an advantage there
> because they don't know a GIL, but with JavaScript, for example,
> it's because it always runs in a single thread overall. And in
> the languages where there are threads without a GIL, you quickly
> realize that programming correct non-trivial programs with
> parallel processing is error-prone.
[...]

Have you ever used webworkers?

Re: Threads across programming languages

<v0ovvl$1ur12$4@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 20:29:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 6
Message-ID: <v0ovvl$1ur12$4@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0ogum$1rc5n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Apr 2024 22:29:42 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="04215bbbe15e1cd8ac94ba1cee5d62b8";
logging-data="2059298"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QSBATakNlXOuPDFgQh7ft"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:Xp0th1qv6uB1UBG0dkDSiTa7Nac=
 by: Lawrence D'Oliv - Mon, 29 Apr 2024 20:29 UTC

On Mon, 29 Apr 2024 19:13:09 +0300, Paavo Helde wrote:

> Just for waiting on thousands on sockets I believe a single select()
> call would be sufficient ...

We use poll(2) or epoll(2) nowadays. select(2) is antiquated.

Re: Threads across programming languages

<v0p02j$1ur12$5@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 20:31:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <v0p02j$1ur12$5@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Apr 2024 22:31:15 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="04215bbbe15e1cd8ac94ba1cee5d62b8";
logging-data="2059298"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18kqm6zS9ngmBBDwI8+6lOJ"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:L/afx1JyWCNOylbOHPt/usvYm/c=
 by: Lawrence D'Oliv - Mon, 29 Apr 2024 20:31 UTC

On Mon, 29 Apr 2024 18:18:57 +0200, Bonita Montero wrote:

> But you need multithreading to have maximum throughput since you often
> process the data while other data is available.

In a lot of applications, the bottleneck is the network I/O, or a GUI
waiting for the next user event, that kind of thing. In this situation,
multithreading is more trouble than it’s worth. This is why coroutines (in
the form of async/await) have made a comeback over the last decade or so.

Re: Threads across programming languages

<v0p06i$1uq6q$5@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 13:33:22 -0700
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <v0p06i$1uq6q$5@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0ogum$1rc5n$1@dont-email.me> <v0ovvl$1ur12$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 29 Apr 2024 22:33:23 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="68a1f8b2290ba520f984bb7e7fb4eebe";
logging-data="2058458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gpJ01y23IxuYWUuna+sN1yG6d5ugo2nQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:eLycvuZrAZPweJEBH5yILSAPmuA=
In-Reply-To: <v0ovvl$1ur12$4@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Mon, 29 Apr 2024 20:33 UTC

On 4/29/2024 1:29 PM, Lawrence D'Oliveiro wrote:
> On Mon, 29 Apr 2024 19:13:09 +0300, Paavo Helde wrote:
>
>> Just for waiting on thousands on sockets I believe a single select()
>> call would be sufficient ...
>
> We use poll(2) or epoll(2) nowadays. select(2) is antiquated.

AIO on Linux, IOCP on windows.

Re: Threads across programming languages

<v0p0d9$1ur12$6@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 20:36:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <v0p0d9$1ur12$6@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 29 Apr 2024 22:36:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="04215bbbe15e1cd8ac94ba1cee5d62b8";
logging-data="2059298"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ZZw5eO+8My5Od7EHjObkB"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:gb9aPTk0TiUMHossiboCplqA5B4=
 by: Lawrence D'Oliv - Mon, 29 Apr 2024 20:36 UTC

On 29 Apr 2024 15:19:19 GMT, Stefan Ram wrote:

> With asyncio, however, you can easily handle the application for
> threads to "wait in parallel" for thousands of sockets in a single
> thread, and there are fewer opportunities for errors than with
> multithreading.

It makes event-loop programming much more convenient. I posted a
simple example here from some years ago
<https://github.com/HamPUG/meetings/tree/master/2017/2017-05-08/ldo-generators-coroutines-asyncio>:
compare the version based on callbacks, with the one using asyncio:
the former is about 30% bigger.

Re: Threads across programming languages

<v0p7mj$20lfm$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 22:41:23 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <v0p7mj$20lfm$3@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0ogum$1rc5n$1@dont-email.me> <v0ovvl$1ur12$4@dont-email.me>
<v0p06i$1uq6q$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 00:41:24 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b9c5c061751fa9a194e47f34ce1cb82";
logging-data="2119158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WeH23MiU5XU0iTs27JMvI"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:n0KhBX+C+TylNeiwZMkCUx75go4=
 by: Lawrence D'Oliv - Mon, 29 Apr 2024 22:41 UTC

On Mon, 29 Apr 2024 13:33:22 -0700, Chris M. Thomasson wrote:

> On 4/29/2024 1:29 PM, Lawrence D'Oliveiro wrote:
>
>> On Mon, 29 Apr 2024 19:13:09 +0300, Paavo Helde wrote:
>>
>>> Just for waiting on thousands on sockets I believe a single select()
>>> call would be sufficient ...
>>
>> We use poll(2) or epoll(2) nowadays. select(2) is antiquated.
>
> AIO on Linux, IOCP on windows.

AIO is for block I/O. Try io_uring instead.

Re: Threads across programming languages

<v0pbg9$21isb$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Mon, 29 Apr 2024 16:46:17 -0700
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <v0pbg9$21isb$1@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0ogum$1rc5n$1@dont-email.me> <v0ovvl$1ur12$4@dont-email.me>
<v0p06i$1uq6q$5@dont-email.me> <v0p7mj$20lfm$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 30 Apr 2024 01:46:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="59e3cacb37dde286cbf606801e5bc80d";
logging-data="2149259"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RCYbOb25+33qVJbYl+7l+3ffWHtLKTl8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PPcUK0ix3q7F67dJqVThSpw2UIA=
Content-Language: en-US
In-Reply-To: <v0p7mj$20lfm$3@dont-email.me>
 by: Chris M. Thomasson - Mon, 29 Apr 2024 23:46 UTC

On 4/29/2024 3:41 PM, Lawrence D'Oliveiro wrote:
> On Mon, 29 Apr 2024 13:33:22 -0700, Chris M. Thomasson wrote:
>
>> On 4/29/2024 1:29 PM, Lawrence D'Oliveiro wrote:
>>
>>> On Mon, 29 Apr 2024 19:13:09 +0300, Paavo Helde wrote:
>>>
>>>> Just for waiting on thousands on sockets I believe a single select()
>>>> call would be sufficient ...
>>>
>>> We use poll(2) or epoll(2) nowadays. select(2) is antiquated.
>>
>> AIO on Linux, IOCP on windows.
>
> AIO is for block I/O. Try io_uring instead.

Afaict, AIO is analogous to IOCP.

Re: Threads across programming languages

<v0pcvu$21qqr$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 00:11:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <v0pcvu$21qqr$1@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0ogum$1rc5n$1@dont-email.me> <v0ovvl$1ur12$4@dont-email.me>
<v0p06i$1uq6q$5@dont-email.me> <v0p7mj$20lfm$3@dont-email.me>
<v0pbg9$21isb$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 02:11:43 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b9c5c061751fa9a194e47f34ce1cb82";
logging-data="2157403"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+K804Tr4LfiLHpvNAOUUP6"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:+PresoGuTRNH00ah/H/tI64AQ7w=
 by: Lawrence D'Oliv - Tue, 30 Apr 2024 00:11 UTC

On Mon, 29 Apr 2024 16:46:17 -0700, Chris M. Thomasson wrote:

> On 4/29/2024 3:41 PM, Lawrence D'Oliveiro wrote:
>>
>> On Mon, 29 Apr 2024 13:33:22 -0700, Chris M. Thomasson wrote:
>>
>>> On 4/29/2024 1:29 PM, Lawrence D'Oliveiro wrote:
>>>
>>>> On Mon, 29 Apr 2024 19:13:09 +0300, Paavo Helde wrote:
>>>>
>>>>> Just for waiting on thousands on sockets I believe a single select()
>>>>> call would be sufficient ...
>>>>
>>>> We use poll(2) or epoll(2) nowadays. select(2) is antiquated.
>>>
>>> AIO on Linux, IOCP on windows.
>>
>> AIO is for block I/O. Try io_uring instead.
>
> Afaict, AIO is analogous to IOCP.

So not really analogous to io_uring, then?

Re: Threads across programming languages

<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 05:58:31 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 05:58:29 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="50660c7bf27b19b3bba1d0771662361a";
logging-data="2372309"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19A/XjI5awH1SSi5j/dDV4p2rbfuA2fFgI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:n6LX+KjbHpNlip+/ggoDk5Ez+2A=
In-Reply-To: <v0p02j$1ur12$5@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Tue, 30 Apr 2024 03:58 UTC

Am 29.04.2024 um 22:31 schrieb Lawrence D'Oliveiro:
> On Mon, 29 Apr 2024 18:18:57 +0200, Bonita Montero wrote:
>
>> But you need multithreading to have maximum throughput since you often
>> process the data while other data is available.
>
> In a lot of applications, the bottleneck is the network I/O, or a GUI
> waiting for the next user event, that kind of thing. In this situation,
> multithreading is more trouble than it’s worth. This is why coroutines (in
> the form of async/await) have made a comeback over the last decade or so.

Having a single thread and using state machines is more effortz.

Re: Threads across programming languages

<v0pqsr$28g0v$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 04:09:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <v0pqsr$28g0v$3@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 06:09:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b9c5c061751fa9a194e47f34ce1cb82";
logging-data="2375711"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+vsy0Jldiy6hjq0XRrZpVM"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:f0BagL4LupCXvOAFdlt5I7ztyos=
 by: Lawrence D'Oliv - Tue, 30 Apr 2024 04:09 UTC

On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:

> Am 29.04.2024 um 22:31 schrieb Lawrence D'Oliveiro:
>
>> On Mon, 29 Apr 2024 18:18:57 +0200, Bonita Montero wrote:
>>
>>> But you need multithreading to have maximum throughput since you often
>>> process the data while other data is available.
>>
>> In a lot of applications, the bottleneck is the network I/O, or a GUI
>> waiting for the next user event, that kind of thing. In this situation,
>> multithreading is more trouble than it’s worth. This is why coroutines
>> (in the form of async/await) have made a comeback over the last decade
>> or so.
>
> Having a single thread and using state machines is more effortz.

It would indeed. That’s why coroutines (async/await) are so handy.

Re: Threads across programming languages

<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 07:59:06 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 07:59:04 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="50660c7bf27b19b3bba1d0771662361a";
logging-data="2423401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oVdtpOqGm/aVq4hC8DQ0hidqSQrTXuuE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:j/k8hmc0mBsaTwZWrEWbUkap28Y=
In-Reply-To: <v0pqsr$28g0v$3@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Tue, 30 Apr 2024 05:59 UTC

Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>
>> Am 29.04.2024 um 22:31 schrieb Lawrence D'Oliveiro:
>>
>>> On Mon, 29 Apr 2024 18:18:57 +0200, Bonita Montero wrote:
>>>
>>>> But you need multithreading to have maximum throughput since you often
>>>> process the data while other data is available.
>>>
>>> In a lot of applications, the bottleneck is the network I/O, or a GUI
>>> waiting for the next user event, that kind of thing. In this situation,
>>> multithreading is more trouble than it’s worth. This is why coroutines
>>> (in the form of async/await) have made a comeback over the last decade
>>> or so.
>>
>> Having a single thread and using state machines is more effortz.
>
> It would indeed. That’s why coroutines (async/await) are so handy.

Using a thread is even more handy.

Re: Threads across programming languages

<v0q3ti$2aiff$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 06:42:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v0q3ti$2aiff$1@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 08:42:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b9c5c061751fa9a194e47f34ce1cb82";
logging-data="2443759"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gHdZElYIh90hb4OWBceRZ"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:kT15DCqFT3FPaAgLPJnbDuLkLLM=
 by: Lawrence D'Oliv - Tue, 30 Apr 2024 06:42 UTC

On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:

> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>
>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>
>>> Having a single thread and using state machines is more effortz.
>>
>> It would indeed. That’s why coroutines (async/await) are so handy.
>
> Using a thread is even more handy.

Do you know what a “heisenbug” is?

Re: Threads across programming languages

<v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 09:37:18 +0200
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
<v0q3ti$2aiff$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 09:37:17 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="50660c7bf27b19b3bba1d0771662361a";
logging-data="2466710"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TufjMkqQq/iCQNXycNyrZ5bcqE7VZMrw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:48t1zaVFDFfliIDFP2dg6FmT7vw=
Content-Language: de-DE
In-Reply-To: <v0q3ti$2aiff$1@dont-email.me>
 by: Bonita Montero - Tue, 30 Apr 2024 07:37 UTC

Am 30.04.2024 um 08:42 schrieb Lawrence D'Oliveiro:
> On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:
>
>> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>>
>>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>>
>>>> Having a single thread and using state machines is more effortz.
>>>
>>> It would indeed. That’s why coroutines (async/await) are so handy.
>>
>> Using a thread is even more handy.
>
> Do you know what a “heisenbug” is?

This has nothing to do with a heisenbug. Threads are slightly less
performance than managing state with a coroutine, but they're more
convenient to develop. In Python the difference wouldn't count.

Re: Threads across programming languages

<multithreading-20240430095639@ram.dialup.fu-berlin.de>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: 30 Apr 2024 09:04:48 GMT
Organization: Stefan Ram
Lines: 55
Expires: 1 Feb 2025 11:59:58 GMT
Message-ID: <multithreading-20240430095639@ram.dialup.fu-berlin.de>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de YzVniy7QGjnCDQnsqIdP9Qq2m7efUcjSjUrcbKbyWb+rXg
Cancel-Lock: sha1:jYX34LR4HlT87Jj1mkrI4nyuCiE= sha256:OA7Q7c/KBaQAF6VZEDZJSMLREWeq+0ZIg5kfeWIejBc=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
 by: Stefan Ram - Tue, 30 Apr 2024 09:04 UTC

ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
>The GIL only prevents multiple Python statements from being
>interpreted simultaneously, but if you're waiting on inputs (like
>sockets), it's not active, so that could be distributed across
>multiple cores.

Disclaimer: This is not on-topic here as it discusses Python,
not C or C++.

FWIW, here's some multithreaded Python code modeled after what
I use in an application.

I am using Python to prepare a press review for me, getting article
headers from several newssites, removing all headers matching a list
of regexps, and integrating everything into a single HTML resource.
(I do not like to read about Lindsay Lohan, for example, so articles
with the text "Lindsay Lohan" will not show up on my HTML review.)

I'm usually downloading all pages at once using Python threads,
which will make sure that a thread uses the CPU while another
thread is waiting for TCP/IP data. This is the code, taken from
my Python program and a bit simplified:

from multiprocessing.dummy import Pool

....

with Pool( 9 if fast_internet else 1 )as pool:
for i in range( 9 ):
content[ i ] = pool.apply_async( fetch,[ uris[ i ] ])
pool.close()
pool.join()

. I'm using my "fetch" function to fetch a single URI, and the
loop starts nine threads within a thread pool to fetch the
content of those nine URIs "in parallel". This is observably
faster than corresponding sequential code.

(However, sometimes I have a slow connection and have to download
sequentially in order not to overload the slow connection, which
would result in stalled downloads. To accomplish this, I just
change the "9" to "1" in the first line above.)

In case you wonder about the "dummy":

|The multiprocessing.dummy module module provides a wrapper
|for the multiprocessing module, except implemented using
|thread-based concurrency.
| |It provides a drop-in replacement for multiprocessing,
|allowing a program that uses the multiprocessing API to
|switch to threads with a single change to import statements.

. So, this is an area where multithreading the Python way is easy
to use and enhances performance even in the presence of the GIL!

Re: Threads across programming languages

<v0qcgc$2ce30$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 09:09:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <v0qcgc$2ce30$1@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
<v0q3ti$2aiff$1@dont-email.me>
<v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 11:09:32 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b9c5c061751fa9a194e47f34ce1cb82";
logging-data="2504800"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+/Hf7fDv142+A51Q+BXgIP"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:ComG6s6gxTX1bGjzZcuDm/tKrlk=
 by: Lawrence D'Oliv - Tue, 30 Apr 2024 09:09 UTC

On Tue, 30 Apr 2024 09:37:18 +0200, Bonita Montero wrote:

> Am 30.04.2024 um 08:42 schrieb Lawrence D'Oliveiro:
>> On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:
>>
>>> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>>>
>>>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>>>
>>>>> Having a single thread and using state machines is more effortz.
>>>>
>>>> It would indeed. That’s why coroutines (async/await) are so handy.
>>>
>>> Using a thread is even more handy.
>>
>> Do you know what a “heisenbug” is?
>
> [No]

Do you know what a “race condition” is?

Re: Threads across programming languages

<v0qddn$2ckv6$1@raubtier-asyl.eternal-september.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 11:25:13 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <v0qddn$2ckv6$1@raubtier-asyl.eternal-september.org>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
<v0q3ti$2aiff$1@dont-email.me>
<v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
<v0qcgc$2ce30$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 11:25:12 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="50660c7bf27b19b3bba1d0771662361a";
logging-data="2511846"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lFg6L7YPyj+qI1mli99LJJ21qfoXsQ54="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:l0cqs3FaPltTOslfFbz2AhtqWzs=
In-Reply-To: <v0qcgc$2ce30$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Tue, 30 Apr 2024 09:25 UTC

Am 30.04.2024 um 11:09 schrieb Lawrence D'Oliveiro:
> On Tue, 30 Apr 2024 09:37:18 +0200, Bonita Montero wrote:
>
>> Am 30.04.2024 um 08:42 schrieb Lawrence D'Oliveiro:
>>> On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:
>>>
>>>> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>>>>
>>>>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>>>>
>>>>>> Having a single thread and using state machines is more effortz.
>>>>>
>>>>> It would indeed. That’s why coroutines (async/await) are so handy.
>>>>
>>>> Using a thread is even more handy.
>>>
>>> Do you know what a “heisenbug” is?
>>
>> [No]
>
> Do you know what a “race condition” is?
>

Race conditions are mostly easy to handle. If you do I/O and the
send / receive options are atomic you'd even not need a mutex and
the race condition isn't a problem although it is not handled.

Re: Threads across programming languages

<Th9YN.35667$gF_b.28190@fx17.iad>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!npeer.as286.net!npeer-ng0.as286.net!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx17.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: Threads across programming languages
Newsgroups: comp.lang.c++,comp.lang.c
References: <GIL-20240429161553@ram.dialup.fu-berlin.de> <v0ogum$1rc5n$1@dont-email.me>
Lines: 24
Message-ID: <Th9YN.35667$gF_b.28190@fx17.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 30 Apr 2024 16:48:51 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 30 Apr 2024 16:48:51 GMT
X-Received-Bytes: 1840
 by: Scott Lurndal - Tue, 30 Apr 2024 16:48 UTC

Paavo Helde <eesnimi@osa.pri.ee> writes:
>On 29.04.2024 18:19, Stefan Ram wrote:
>> paavo512 <paavo@osa.pri.ee> wrote or quoted:
>> |Anyway, multithreading performance is a non-issue for Python so far as
>> |the Python interpreter runs in a single-threaded regime anyway, under a
>> |global GIL lock. They are planning to get rid of GIL, but this work is
>> |still in development AFAIK. I'm sure it will take years to stabilize the
>> |whole Python zoo without GIL.
>>
>> The GIL only prevents multiple Python statements from being
>> interpreted simultaneously, but if you're waiting on inputs (like
>> sockets), it's not active, so that could be distributed across
>> multiple cores.
>>
>> With asyncio, however, you can easily handle the application
>> for threads to "wait in parallel" for thousands of sockets in a
>> single thread, and there are fewer opportunities for errors than
>> with multithreading.
>
>In C++, async io is provided e.g. by the asio library.

And the POSIX aio interfaces, on systems that support them.

I used lio_listio heavily in Oracle's RDMS.

Re: Threads across programming languages

<v0ribl$2lc99$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 12:55:33 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <v0ribl$2lc99$1@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
<v0q3ti$2aiff$1@dont-email.me>
<v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 21:55:34 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="59e3cacb37dde286cbf606801e5bc80d";
logging-data="2797865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OJF+uHUmQScDOShVzQOIfrK7DEeVgf0c="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:9pdYLwLnB9ti3o5VcZ8EsHt4SFE=
Content-Language: en-US
In-Reply-To: <v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Tue, 30 Apr 2024 19:55 UTC

On 4/30/2024 12:37 AM, Bonita Montero wrote:
> Am 30.04.2024 um 08:42 schrieb Lawrence D'Oliveiro:
>> On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:
>>
>>> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>>>
>>>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>>>
>>>>> Having a single thread and using state machines is more effortz.
>>>>
>>>> It would indeed. That’s why coroutines (async/await) are so handy.
>>>
>>> Using a thread is even more handy.
>>
>> Do you know what a “heisenbug” is?
>
> This has nothing to do with a heisenbug. Threads are slightly less
> performance than managing state with a coroutine,

Huh? Threads allow one to take advantage of the processing power of a
multi-core/socket system. We can multiplex coroutines on a single
thread, okay fine, ugg... This is not going to use the full spectrum of
a system wrt multiple processing units. We can decide to use at least as
many threads as there are cores. This can get the full power of said
system. Sometimes using number_of_cores * 2 threads might be in order.

> but they're more
> convenient to develop. In Python the difference wouldn't count.

Re: Threads across programming languages

<v0ricv$2lc99$2@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 12:56:14 -0700
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <v0ricv$2lc99$2@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
<v0q3ti$2aiff$1@dont-email.me>
<v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
<v0qcgc$2ce30$1@dont-email.me>
<v0qddn$2ckv6$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 21:56:15 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="59e3cacb37dde286cbf606801e5bc80d";
logging-data="2797865"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Jw5SZ0XjpuoB1kgLnTi4WyLjKTSybQGk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:1l/3jXk1G8KG9qCrRkUHDjzXJaY=
Content-Language: en-US
In-Reply-To: <v0qddn$2ckv6$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Tue, 30 Apr 2024 19:56 UTC

On 4/30/2024 2:25 AM, Bonita Montero wrote:
> Am 30.04.2024 um 11:09 schrieb Lawrence D'Oliveiro:
>> On Tue, 30 Apr 2024 09:37:18 +0200, Bonita Montero wrote:
>>
>>> Am 30.04.2024 um 08:42 schrieb Lawrence D'Oliveiro:
>>>> On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:
>>>>
>>>>> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>>>>>
>>>>>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>>>>>
>>>>>>> Having a single thread and using state machines is more effortz.
>>>>>>
>>>>>> It would indeed. That’s why coroutines (async/await) are so handy.
>>>>>
>>>>> Using a thread is even more handy.
>>>>
>>>> Do you know what a “heisenbug” is?
>>>
>>> [No]
>>
>> Do you know what a “race condition” is?
>>
>
> Race conditions are mostly easy to handle.

Have you fixed your massive bug in your DCL futex thing?

> If you do I/O and the
> send / receive options are atomic you'd even not need a mutex and
> the race condition isn't a problem although it is not handled.
>

Re: Threads across programming languages

<v0rjug$2lnd6$3@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.c++ comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: Threads across programming languages
Date: Tue, 30 Apr 2024 20:22:40 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <v0rjug$2lnd6$3@dont-email.me>
References: <GIL-20240429161553@ram.dialup.fu-berlin.de>
<v0oh9f$1rdff$1@raubtier-asyl.eternal-september.org>
<v0p02j$1ur12$5@dont-email.me>
<v0pq95$28cml$1@raubtier-asyl.eternal-september.org>
<v0pqsr$28g0v$3@dont-email.me>
<v0q1b7$29uj9$1@raubtier-asyl.eternal-september.org>
<v0q3ti$2aiff$1@dont-email.me>
<v0q73c$2b8sm$1@raubtier-asyl.eternal-september.org>
<v0qcgc$2ce30$1@dont-email.me>
<v0qddn$2ckv6$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 30 Apr 2024 22:22:40 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7b9c5c061751fa9a194e47f34ce1cb82";
logging-data="2809254"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hpo1oVQxqsHmW6eCZQOT/"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:WnBCr7KEZfuLmfmOEGVF+uvhROI=
 by: Lawrence D'Oliv - Tue, 30 Apr 2024 20:22 UTC

On Tue, 30 Apr 2024 11:25:13 +0200, Bonita Montero wrote:

> Am 30.04.2024 um 11:09 schrieb Lawrence D'Oliveiro:
>> On Tue, 30 Apr 2024 09:37:18 +0200, Bonita Montero wrote:
>>
>>> Am 30.04.2024 um 08:42 schrieb Lawrence D'Oliveiro:
>>>> On Tue, 30 Apr 2024 07:59:06 +0200, Bonita Montero wrote:
>>>>
>>>>> Am 30.04.2024 um 06:09 schrieb Lawrence D'Oliveiro:
>>>>>>
>>>>>> On Tue, 30 Apr 2024 05:58:31 +0200, Bonita Montero wrote:
>>>>>>
>>>>>>> Having a single thread and using state machines is more effortz.
>>>>>>
>>>>>> It would indeed. That’s why coroutines (async/await) are so handy.
>>>>>
>>>>> Using a thread is even more handy.
>>>>
>>>> Do you know what a “heisenbug” is?
>>>
>>> [No]
>>
>> Do you know what a “race condition” is?
>>
> [No]

You haven’t actually done much thread programming, have you?


devel / comp.lang.c++ / Re: Threads across programming languages

Pages:1234567
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor