Maybe IOhannes & Christof can give their take? Also, I believe the PR includes a compile-time define to enable/disable.
I think the PR is already in very good shape. The public API functions (in s_stuff.h) look reasonable. I have to admit I haven't checked the most recent commits yet, but I'll put that on my list.

It seems it's too late for Pd 0.52 anyway, but it should definitely be on the roadmap for Pd 0.53! I would suggest to handle it like the networking IPv6 overhaul: review and merge it well in advance, so it can be tested for a few month in the wild before it goes into Pd 0.53.

---

threads are the easiest way to make software less reliable :)
It depends. If threading is done with lots of shared state then it can easily become messy. But if it's done with message passing (via thread-safe queues), things become much simpler and less error prone (see also my proposed asynchronous task API: https://github.com/pure-data/pure-data/pull/1357).

The PR by Giulio falls into the second category, so I don't think you have to worry too much about race conditions and such.

---

As a general remark:

Single core CPU performance hasn't improved much for the last decade, instead we get more and more cores. My working machine already has 16 hardware threads, so at the moment Pd can only use 1/16 of the available processing power. There are already CPUs with 128 hardware threads, like the AMD Ryzen Threadripper 3995WX. With 5000€ it is not exactly cheap, but it shows us the direction we're heading to.

In the future it will become less and less acceptable that Pd does most of its work on a single thread. IMHO we really have to embrance multi-threading to stay relevant.

Actually, I've been thinking about ways to implement multi-threaded DSP in Pd that is optional, backwards-compatible and also works in the context of libpd.

I'm too busy with other stuff at the moment, but I'll try to come up with a PoC at the end of the year.*

Christof

* I actually need this for a specific large project of mine. Currently, I have to split it into several independent [pd~] instances so that it runs in realtime, which is very awkward. I have been thinking to switch to Supernova (Supercollider), but first I want to see how far I can get with a custom multi-threaded Pd version.


On 14.09.2021 19:50, Dan Wilcox wrote:
Maybe IOhannes & Christof can give their take? Also, I believe the PR includes a compile-time define to enable/disable.

On Sep 14, 2021, at 7:37 PM, Miller Puckette <msp@ucsd.edu> wrote:

I confess I haven't even looked at this yet. Any added thread operations in
Pd will take a lot of work for me to scrutinize (threads are the easiest way
to make software less reliable :)

Miller

On Tue, Sep 14, 2021 at 11:36:36AM +0100, Giulio Moro via Pd-dev wrote:
Let me take the opportunity to flag again that it would be great if I could receive some feedback on this:

I have had this PR open for a while: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_pure-2Ddata_pure-2Ddata_pull_1261&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=CIAxkh54128umfUyOzvHUJpNlBoM5hT8fsDZOvywKOQ&s=NEKBF7n4zuLkQoHhnt2oBrRg860DeQ60qejG5VrplXE&e=  . It adds threaded behaviour for disk and network I/O, making the Pd audio thread "real-time safer". I went through quite a few revisions courtesy of umlaeute and Spacechild1, but haven't heard from you directly. I am happy to do some more work if there is interest in merging. CI build currently fails because of weird "support" of ssize_t on VS (happy to hear about workarounds).

Thanks,
Giulio

Dan Wilcox wrote on 14/09/2021 11:18:
...which reminds me I haven't had any time to look into macOS-specific stuff (bad) such as usual TK issues, M1 arm builds, etc, due to too much project work (good). Maybe this weekend / coming week.

On Sep 14, 2021, at 12:00 PM, pd-dev-request@lists.iem.at <mailto:pd-dev-request@lists.iem.at> wrote:

Message: 1
Date: Mon, 13 Sep 2021 20:52:19 -0300
From: Alexandre Torres Porres <porres@gmail.com <mailto:porres@gmail.com>>
To: Miller Puckette <msp@ucsd.edu <mailto:msp@ucsd.edu>>
Cc: pd-dev <pd-dev@lists.iem.at <mailto:pd-dev@lists.iem.at>>
Subject: Re: [PD-dev] plans for next Pd release
Message-ID:
<CAEAsFmivBpXw=kCOYO6Xjtjja8wZnKaiy3vG30cc=vHxXOFuYw@mail.gmail.com <mailto:CAEAsFmivBpXw=kCOYO6Xjtjja8wZnKaiy3vG30cc=vHxXOFuYw@mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"

hi, sorry to bug you Miller, but summer is ending and I was wondering about
the next release if it's coming soon.

cheers

--------
Dan Wilcox
@danomatika <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_danomatika&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=CIAxkh54128umfUyOzvHUJpNlBoM5hT8fsDZOvywKOQ&s=zjK5QkKGpT-PmrQubeExT09_VePF4PLClKFuUU7Lsmw&e= >
danomatika.com <https://urldefense.proofpoint.com/v2/url?u=http-3A__danomatika.com&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=CIAxkh54128umfUyOzvHUJpNlBoM5hT8fsDZOvywKOQ&s=KZkE41QzIdpbaImsCAE9wFPhFxPOKT2p3q3zEaWbkiU&e= >
robotcowboy.com <https://urldefense.proofpoint.com/v2/url?u=http-3A__robotcowboy.com&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=CIAxkh54128umfUyOzvHUJpNlBoM5hT8fsDZOvywKOQ&s=YHBFPwMTjJhBcivlhnTedozN_bJVvdETM-YaNsV2zOY&e= >




_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=CIAxkh54128umfUyOzvHUJpNlBoM5hT8fsDZOvywKOQ&s=VPt5_FzAma0FrHHO7yOSiWOvqe7vlOuPzDm2yRw376U&e=




_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev&d=DwICAg&c=-35OiAkTchMrZOngvJPOeA&r=XprZV3Fxus2L1LCw80hE4Q&m=CIAxkh54128umfUyOzvHUJpNlBoM5hT8fsDZOvywKOQ&s=VPt5_FzAma0FrHHO7yOSiWOvqe7vlOuPzDm2yRw376U&e=

--

--------
Dan Wilcox
@danomatika
danomatika.com
robotcowboy.com




_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev