> > In theory, simulating such global limit should be possible using a bit > of shared memory for the current total, per-process counter and probably > some simple abort handling (say, just like contrib/openssl does using > ResourceOwner). >
I would expect that this limit is already available and it's parallel worker limit. Basically, when start a new thread I would like to somehow consume a part of parallel worker limit - a thread is a kind of parallel worker, from user's perspective. If I have 4 cores and Postgres already started 4 parallel workers, I don't really want to start 4 threads for each of them, or 4 for one of them and 1 for each of the rest, if I manage that separately from parallel worker limit. IPC and co - that's another question and out of scope for this one. Since OpenMP allows to write multithreaded code by just adding more #pragma around loops, I don't want to reinvent that part of infrastructure. -- Darafei Praliaskouski Support me: http://patreon.com/komzpa