On 10/23/26 02:45, David Brown wrote:
On 23/10/2026 08:25, Lawrence DrCOOliveiro wrote:
On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:
On 10/22/2026 8:19 PM, Lawrence DrCOOliveiro wrote:
On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:
That's why I try to use PL/I AUTOMATIC (stack) storage and not
allocate a lot of stuff. You need to have a disciplined approach
if you allocate random stuff here and there.
What if yourCOre building an object that needs to be returned to the >>>>> caller?
Have the caller have the object before hand and call a function to
initialize it?
IrCOm assuming that all that BASIC programming hasnrCOt got to your head, >>> and yourCOre not serious. ;)
Chris' wording is perhaps poor, but the principle is right.
I don't know PL/I or Fortran, but in C if you have :
-a-a-a-a-atypedef struct data_struct { int a; int xs[20]; } S ;
-a-a-a-a-aS build_some_data(void) {
-a-a-a-a-a-a-a-a S s;
-a-a-a-a-a-a-a-a s.a = 123;
-a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) s.xs[i] = i;
-a-a-a-a-a-a-a-a return s;
-a-a-a-a-a}
-a-a-a-a-avoid foo() {
-a-a-a-a-a-a-a-a S s = build_some_data();
-a-a-a-a-a}
then it is typically handled as though you had written :
-a-a-a-a-avoid build_some_data(S * p) {
-a-a-a-a-a-a-a-a p->a = 123;
-a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) p->xs[i] = i;
-a-a-a-a-a-a-a-a return;
-a-a-a-a-a}
-a-a-a-a-avoid foo() {
-a-a-a-a-a-a-a-a S s;
-a-a-a-a-a-a-a-a build_some_data(&s);
-a-a-a-a-a}
That is - the caller creates the /space/ for the returned object, but
does not do any kind of initialisation.-a It passes a pointer to that
space as a hidden parameter to the function that wants to return the
object.
That principle should work fine in any language, as long as the size
of the returned object is known by the caller code.
That last sentence is why it would not work fine,
On 10/23/26 01:01, boltar@caprica.universe wrote:
On Thu, 22 Oct 2026 12:19:49 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bd7tj$rh4f$1@dont-email.me>,-a <boltar@battlestar.co.uk>
wrote:
Most of us have a CS degree. But then we go out into the real world,
get a
job and find out what real programming on real products entails, not
a load
of virtual academic naval gazing.
That's because it's not a trade school degree.-a It's not there to teach >>> you to program, it's there to teach you the fundamentals that you
need to
properly understand programming.
No, it teaches you fundamentals of certain aspects of computer
paradigms such
as databases, graphics, AI. Most people into computers learn actual
programming
long before they hit university.
Engineering schools are even more that way.-a They don't teach you much
engineering, but they give you all the background that you need to learn >>> engineering.
Programming isn't pure engineering - its a combination of engineering,
logic,
art and a trade.
If you just want a job, getting one of these degrees is not for you.
It's
not there for that.
Bill Gates never earned a degree. He seemed to do ok.
From what I understand, he wasn't a very good programmer, though.
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads >>>>>in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an >>>>operating system. I mean, POSIX already does an ok job of >>>>standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but >>>not a process library. Its perfectly possible to simulate a multiprocess >>>enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>> On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but >>> not a process library. Its perfectly possible to simulate a multiprocess >>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
boltar@caprica.universe writes:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an >>>>>operating system. I mean, POSIX already does an ok job of >>>>>standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but >>>>not a process library. Its perfectly possible to simulate a multiprocess >>>>enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
It doesn't. It does have an abstraction wrapper around
whatever threading support the target host has.
boltar@caprica.universe writes:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
It doesn't. It does have an abstraction wrapper around
whatever threading support the target host has.
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads >>>>>in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an >>>>operating system. I mean, POSIX already does an ok job of >>>>standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but >>>not a process library. Its perfectly possible to simulate a multiprocess >>>enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
On 10/23/2026 11:06 AM, Peter Flass wrote:
Bill Gates never earned a degree. He seemed to do ok.
From what I understand, he wasn't a very good programmer, though.
Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>Altair 8080 in 2K of ram using assembly language. Take that as you will.
Gates when he put his mind to it could certainly program. Even Sinclair >required 4K for BASIC in the ZX80 for example. But some of his technical
(and business) decisions leave a lot to be desired.
On 10/24/26 01:21, boltar@caprica.universe wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
You can have co-operative threads. IBM CICS used to run lots of threads >(tasks) concurrently, and ran them well.
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
- Dan C.
boltar@caprica.universe writes:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
It doesn't. It does have an abstraction wrapper around
whatever threading support the target host has.
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:42 PM, Lawrence DrCOOliveiro wrote:
On Fri, 23 Oct 2026 13:56:49 -0700, Chris M. Thomasson wrote:
On 10/23/2026 12:19 PM, Lawrence DrCOOliveiro wrote:
In short, the concept doesnrCOt scale, because it completely breaks
the concept of data abstraction.
And it just pushes the dynamic-allocation problem elsewhere,
without making it easier.
It can be made to work ...
IrCOm sure itrCOs *possible*, but what is the *point*?
The whole aim of levels of abstraction is to tame the multi-headed
beast of complexity that is computer programming. What you are
doing here is breaking down those levels, all in the aid of, I
donrCOt know, just to keep using gotos in your code, or something.
Well, not about goto's and such. Just so a lib can inform the caller
as to what it needs to work with. The caller sets it up, then calls
into the init etc. Its being used in a lot of places. Take Vulkan.
Where in Vulkan? Exposing implementation details to the caller not
only increases complexity, it also limits the implementorrCOs ability to change those details later.
Iiic, vkGetBufferMemoryRequirements and vkGetImageMemoryRequirements,
which return a VkMemoryRequirements struct containing size, alignment,
and memoryTypeBits. The caller allocates the memory with
vkAllocateMemory and binds it with vkBindBufferMemory.
Also, iirc io_uring: IORING_SETUP_NO_MMAP (Linux 6.5+) lets the caller supply the memory for the rings and SQE array. It must be suitably
aligned (page or huge page), and the caller has to compute how big it
needs to be from the entry count and flags.
So it can be made to work.
On 10/24/26 09:41, Dan Cross wrote:
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual
memory, who knows?)
On 10/23/2026 8:33 PM, Lawrence DrCOOliveiro wrote:
On Fri, 23 Oct 2026 17:01:28 -0700, Chris M. Thomasson wrote:
On 10/23/2026 3:42 PM, Lawrence DrCOOliveiro wrote:
The whole aim of levels of abstraction is to tame the
multi-headed beast of complexity that is computer programming.
What you are doing here is breaking down those levels, all in the
aid of, I donrCOt know, just to keep using gotos in your code, or
something.
Well, not about goto's and such. Just so a lib can inform the
caller as to what it needs to work with. The caller sets it up,
then calls into the init etc. Its being used in a lot of places.
Take Vulkan.
Where in Vulkan? Exposing implementation details to the caller not
only increases complexity, it also limits the implementorrCOs ability
to change those details later.
Iiic, vkGetBufferMemoryRequirements and
vkGetImageMemoryRequirements, which return a VkMemoryRequirements
struct containing size, alignment, and memoryTypeBits. The caller
allocates the memory with vkAllocateMemory and binds it with vkBindBufferMemory.
Or what about miniaudiorCOs ma_engine_get_heap_size plus ma_engine_init_preallocated
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote: >>On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>>On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an >>>>>operating system. I mean, POSIX already does an ok job of >>>>>standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but >>>>not a process library. Its perfectly possible to simulate a multiprocess >>>>enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote: >>Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
On 10/23/2026 11:06 AM, Peter Flass wrote:
Bill Gates never earned a degree. He seemed to do ok.
From what I understand, he wasn't a very good programmer, though.
Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>>Altair 8080 in 2K of ram using assembly language. Take that as you will.
Gates when he put his mind to it could certainly program. Even Sinclair >>required 4K for BASIC in the ZX80 for example. But some of his technical >>(and business) decisions leave a lot to be desired.
But the ZX80 (and most later MBASICs) had floating point.
In article <11bif5s$2pam0$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
You can have co-operative threads. IBM CICS used to run lots of threads >>(tasks) concurrently, and ran them well.
When I learned C, there was no threading and there were only different >processes, so you had to do a fork and then synchronize with the other >process. This wasn't a dealbreaker and we did plenty of stuff that way,
but having threads available was very nice and made for many operations >becoming more convenient to write.
In article <11bj08r$309uk$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
On 10/24/26 09:41, Dan Cross wrote:
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> >wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> >wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >wrote:
You need an OS to do threading properly too. Theres a reason green >threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library >but
not a process library. Its perfectly possible to simulate a multiprocess >>>>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual >>memory, who knows?)
Indeed, but I'm hoping Mr Boltar will chime in with his answers,
so that we can understand why thinks that a language like C
should introduce a *process* model, and how threads are similar.
On 10/24/26 09:41, Dan Cross wrote:
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
- Dan C.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual
memory, who knows?)
On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) wrote:
In article <11bj08r$309uk$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
On 10/24/26 09:41, Dan Cross wrote:
In article <11bhppd$2lpkc$1@dont-email.me>,
<boltar@caprica.universe> wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>,
<boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>,
<boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason >>>>>>>>> green threads in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an >>>>>>>> operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading
library but not a process library. Its perfectly possible to
simulate a multiprocess enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual
memory, who knows?)
Indeed, but I'm hoping Mr Boltar will chime in with his answers,
so that we can understand why thinks that a language like C
should introduce a *process* model, and how threads are similar.
- Dan C.
First, he was talking about C++. Unlike me, he does not appear to care
about C.
Second, while in theory threads can be implemented by C++
compilers+language support library, in practice I had never seen it
done. All I had seen is C++ threads implemented in library as thin
wrapper atop of the OS (or RT executive) implementation.
I can not see while the same can't be done for processes, with
API modeled on posix_spawn() or Windows CreateProcess().
It does not look like variety in this field is bigger than in case of threads. More like it is smaller.
Now, would it be the first thing I would want like addition to C++
standard library? No it would not be.
The first thing would be IPv4 communication, sockets, poll etc...
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote: >>>Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
On 10/23/2026 11:06 AM, Peter Flass wrote:Gates when he put his mind to it could certainly program. Even Sinclair >>>required 4K for BASIC in the ZX80 for example. But some of his technical >>>(and business) decisions leave a lot to be desired.
Bill Gates never earned a degree. He seemed to do ok.
From what I understand, he wasn't a very good programmer, though.
Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>>>Altair 8080 in 2K of ram using assembly language. Take that as you will. >>>
But the ZX80 (and most later MBASICs) had floating point.
The ZX80 ran Sinclair Basic, it had nothing to do with MS and it was integer >only. The ZX81 had flowing point basic and had an 8K ROM which is still >bloody impressive.
In article <11bkfcc$104cc$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
[snip]
No, it isn't. How similar do you think the posix and windows threading
model/api are? Yet somehow C++ provides a common wrapper for both. There is >> no reason the same can't be done for processes and your irrelevant waffle
about past issues of threading on *nix don't change that.
You didn't answer my questions.
What do you think that a "thread" is?
What do you think that a "process" is?
- Dan C.
On 10/25/26 06:34, Dan Cross wrote:
[snip]
What do you think that a "thread" is?
What do you think that a "process" is?
I vote that alt.folklore.computers gets pruned from the list of
recipients, as this discussion seems irrelevant here.
In article <11bker0$2pa7q$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Sat, 24 Oct 2026 13:53:39 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bhpo6$2lpjl$1@dont-email.me>, <boltar@caprica.universe> wrote:
Lynn McGuire <lynnmcguire5@gmail.com> gabbled:
On 10/23/2026 11:06 AM, Peter Flass wrote:Gates when he put his mind to it could certainly program. Even Sinclair >>>> required 4K for BASIC in the ZX80 for example. But some of his technical >>>> (and business) decisions leave a lot to be desired.
Bill Gates wrote the Microsoft Basic compiler and interpreter for the >>>>> Altair 8080 in 2K of ram using assembly language. Take that as you will. >>>>Bill Gates never earned a degree. He seemed to do ok.
From what I understand, he wasn't a very good programmer, though. >>>>>
But the ZX80 (and most later MBASICs) had floating point.
The ZX80 ran Sinclair Basic, it had nothing to do with MS and it was integer >> only. The ZX81 had flowing point basic and had an 8K ROM which is still
bloody impressive.
I did not realize that the ZX80 was integer only! I thought it was more
or less like the ZX81 with everything stuffed into an asic.
--scott
On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bif5s$2pam0$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
You can have co-operative threads. IBM CICS used to run lots of threads
(tasks) concurrently, and ran them well.
When I learned C, there was no threading and there were only different
processes, so you had to do a fork and then synchronize with the other
process. This wasn't a dealbreaker and we did plenty of stuff that way,
but having threads available was very nice and made for many operations
becoming more convenient to write.
Unfortunately most win32 programmers don't really understand multiprocess programming because the w32 API is so borked so use threads even when seperate process would be more appropriate.
On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bif5s$2pam0$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
You can have co-operative threads. IBM CICS used to run lots of threads
(tasks) concurrently, and ran them well.
When I learned C, there was no threading and there were only different
processes, so you had to do a fork and then synchronize with the other
process. This wasn't a dealbreaker and we did plenty of stuff that way,
but having threads available was very nice and made for many operations
becoming more convenient to write.
Unfortunately most win32 programmers don't really understand multiprocess programming because the w32 API is so borked so use threads even when seperate process would be more appropriate.
On Sat, 24 Oct 2026 16:41:22 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >> wrote:
You need an OS to do threading properly too. Theres a reason green threads
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an
operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library but
not a process library. Its perfectly possible to simulate a multiprocess >>>>> enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
The differences are utterly irrelevant when it comes to prividing a common API to the functionality but thank you for demonstrating you had no answer
to my question.
On Sun, 25 Oct 2026 16:15:21 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <YHpDS.27364$9b8f.4666@fx39.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <20261025084234.0000449c@yahoo.com>,<snip>
Michael S <already5chosen@yahoo.com> wrote:
How any of this trivia has anything to do with real-world
implementations of C++11 threads?
Your statement, "while in theory threads can be implemented by
C++ compilers+language support library, in practice I had never
seen it done" is probably strictly true: you, individually, have
never seen it done.
But that does not imply that it has never been done. In
fact, it has; many times over. There are complications, but it
can be done. That is what I was telling you, supported by
examples.
Although it does, generally, rely on specific operating system
interfaces (e.g. makecontext, setcontext, et alia).
That's true. But no one said that one can use strict ISO C++ to
implement the C++ standard library.
Regardless, if you can set the stack pointer, you can build a
reasonable cooperative threading library purely in userspace,
without the OS caring.
Oh really? You seem to have forgotten about the program counter not to mentioning pushing and popping all the other cpu registers and flags at context
switch.
The Apple ][ was also integer only. The Apple ][+ had floating point.
The top 16k of memory was ROM supporting the OS and BASIC. Relatively
roomy compared to the ZX80/81.
pt--
On 10/22/2026 8:19 PM, Lawrence DrCOOliveiro wrote:
On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:
That's why I try to use PL/I AUTOMATIC (stack) storage and not
allocate a lot of stuff. You need to have a disciplined approach if
you allocate random stuff here and there.
What if yourCOre building an object that needs to be returned to the
caller?
Have the caller have the object before hand and call a function to initialize it?
Cryptoengineer <petertrei@gmail.com> wrote:
The Apple ][ was also integer only. The Apple ][+ had floating point.
The top 16k of memory was ROM supporting the OS and BASIC. Relatively
roomy compared to the ZX80/81.
Yes, the INTBASIC was Apple code, while APPLESOFT BASIC was written by Microsoft on contract to Apple. APPLESOFT worked pretty well aside from programmable functions. It could do realtime FFTs at 0.5 samp/sec which
was good enough for some interesting things.
You could upgrade the roms in your original Apple ][ to the ][+ roms
for what seemed like a fortune to me at the time but which was probably
quite reasonable. I think you lost Sweet-16 in the process though.
--scott
pt
Bill Gates wrote the Microsoft Basic compiler and interpreter for the
Altair 8080 in 2K of ram using assembly language. Take that as you will.
On Sun, 25 Oct 2026 08:41:48 -0000 (UTC)
boltar@caprica.universe wrote:
On Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <20261025011151.000038ef@yahoo.com>,
Now, would it be the first thing I would want like addition to C++
standard library? No it would not be.
The first thing would be IPv4 communication, sockets, poll etc...
POSIX has all of that. POSIX also has a process model. Why not
just make POSIX a part of the language, then? (Answer that and
you may start to understand why this is harder than it looks
for C++ [and C].)
No, it isn't. How similar do you think the posix and windows threading
model/api are? Yet somehow C++ provides a common wrapper for both.
Actually, implementing C++11 (or C11) threads fully in user space on pre-Vista Win32 (i.e. before addition of support for conditional
variables to OS API) would be quite challenging. I don't know if
anybody bothered.
I think that it is possible, but if you want it robust then it (cond. variables) will cost you significant overhead relatively to "native" synchronization primitives.
There is no reason the same can't be done for processes and your
irrelevant waffle about past issues of threading on *nix don't change
that.
Dick-measuring competitions are integral part of Usenet tradition.
Even analogous, to say, an API that says read n bytes and store into
buffer. Well, the caller has lifetime of said buffer. The caller makes
the buffer, calls into the function.
On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bj08r$309uk$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
On 10/24/26 09:41, Dan Cross wrote:wrote:
In article <11bhppd$2lpkc$1@dont-email.me>, <boltar@caprica.universe>
wrote:On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>, <boltar@caprica.universe>
threadsOn Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>, <boltar@battlestar.co.uk> >> wrote:
You need an OS to do threading properly too. Theres a reason green
in java were a joke.
Weird that you think you need a operating system for threads,
yet you want C to standardize processes which also ... need an >>>>>>>> operating system. I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect
from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading library >> but
not a process library. Its perfectly possible to simulate a multiprocess
enviroment.
So write a simulator in your language of choice. You don't need
the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is? And how is it
different from a _process_? For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual
memory, who knows?)
Indeed, but I'm hoping Mr Boltar will chime in with his answers,
so that we can understand why thinks that a language like C
should introduce a *process* model, and how threads are similar.
Who mentioned C? I was talking about C++ which has a threading API already. Do try and keep up.
On Sat, 24 Oct 2026 12:17:47 -0700
Peter Flass <Peter@Iron-Spring.com> gabbled:
On 10/24/26 09:41, Dan Cross wrote:
In article <11bhppd$2lpkc$1@dont-email.me>,
<boltar@caprica.universe> wrote:
What, pray tell, do you think that a _thread_ is?-a And how is it
different from a _process_?-a For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
-a-a-a-a- Dan C.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual
memory, who knows?)
With copy-on-write process models the actual difference is a bit less
clear cut.
On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:
Even analogous, to say, an API that says read n bytes and store into
buffer. Well, the caller has lifetime of said buffer. The caller makes
the buffer, calls into the function.
So how is the caller supposed to manage that memory?
On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:
Even analogous, to say, an API that says read n bytes and store into
buffer. Well, the caller has lifetime of said buffer. The caller makes
the buffer, calls into the function.
So how is the caller supposed to manage that memory?
I had a quick look at that. It seems to have to do with the reality of graphics hardware implementing different kinds of memory with
different kinds of characteristics, and the impossibility of
completely such ignoring such issues in real-time 3D rendering.
I expect higher-level APIs (e.g. game engines) will wrap all this
behind their own higher-level abstractions, so regular
programmers/game creators donrCOt have to worry about it.
In short, itrCOs an abstraction that leaks that you accept only because
you have to, not because itrCOs a good idea for abstractions in general.
If you can successfully hide issues of memory and other resource
allocation behind your abstraction, you would still rather do it than
not.
So, to get back to my point, the technique I use is based on a form of structured programming called a rCLNassi-Shneiderman diagramrCY. The
overall structure looks like
... initialize object pointer to NULL ...
do /*once*/
{
... possible other stuff ...
... allocate object pointer ...
if (error occurred)
break;
... possible other stuff using object pointer ...
}
while (false);
... call free(3) (or equivalent) on object pointer ...
So you can see there is no way out of the inner block without passing
through the dispose call. Using gotos would contribute nothing except
make it harder to assure yourself of the simplicity of the control
flow.
Looks deceptively simple. But the same technique can scale up to quite complex cases.
Cryptoengineer <petertrei@gmail.com> wrote:
The Apple ][ was also integer only. The Apple ][+ had floating point.
The top 16k of memory was ROM supporting the OS and BASIC. Relatively
roomy compared to the ZX80/81.
Yes, the INTBASIC was Apple code, while APPLESOFT BASIC was written by Microsoft on contract to Apple. APPLESOFT worked pretty well aside from programmable functions. It could do realtime FFTs at 0.5 samp/sec which
was good enough for some interesting things.
You could upgrade the roms in your original Apple ][ to the ][+ roms
for what seemed like a fortune to me at the time but which was probably
quite reasonable. I think you lost Sweet-16 in the process though.
--scott
pt
A caller provided buffer is normal with a lot of API's out there.
Managing the memory is the callerrCOs job in C anyway.
A lib that never allocates behind your back is what you
want in embedded, kernel, and arena code ...
I distinctly recall working with Sweet-16 on my ][+ back in the day,
but can't recall the details.
On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bif5s$2pam0$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
You can have co-operative threads. IBM CICS used to run lots of threads >>>> (tasks) concurrently, and ran them well.
When I learned C, there was no threading and there were only different
processes, so you had to do a fork and then synchronize with the other
process. This wasn't a dealbreaker and we did plenty of stuff that way, >>> but having threads available was very nice and made for many operations
becoming more convenient to write.
Unfortunately most win32 programmers don't really understand multiprocess
programming because the w32 API is so borked so use threads even when
seperate process would be more appropriate.
Windows has what we need to run multi process. Even for a Mutex...
Remember WAIT_ABANDONED?
On 10/25/2026 1:31 AM, boltar@caprica.universe wrote:
The differences are utterly irrelevant when it comes to prividing a common >> API to the functionality but thank you for demonstrating you had no answer >> to my question.
Ummm... It is relevant. Every process has a single thread of execution,
but not all processes have multiple threads.
Basically that methinks you insult too much. Your wisdom here isn't
worth a sack of beans. I haven't learned one thing from you.
On Sun, 25 Oct 2026 14:19:14 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bif5s$2pam0$1@dont-email.me>,
Peter Flass-a <Peter@Iron-Spring.com> wrote:
You can have co-operative threads. IBM CICS used to run lots of
threads
(tasks) concurrently, and ran them well.
When I learned C, there was no threading and there were only different >>>> processes, so you had to do a fork and then synchronize with the other >>>> process.-a This wasn't a dealbreaker and we did plenty of stuff that
way,
but having threads available was very nice and made for many operations >>>> becoming more convenient to write.
Unfortunately most win32 programmers don't really understand
multiprocess
programming because the w32 API is so borked so use threads even when
seperate process would be more appropriate.
Windows has what we need to run multi process. Even for a Mutex...
Remember WAIT_ABANDONED?
win32 can't do fork() making it effectively a totally useless API for a
lot of multiprocess development.
Creating a brand new process is fine if
you don't need any complicated shared state such as when kicking off something
on the command line or creating a pipe (something else win32 is shit at)
but
thats about it.
On Sun, 25 Oct 2026 22:56:19 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sun, 25 Oct 2026 08:41:48 -0000 (UTC)
boltar@caprica.universe wrote:
On Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <20261025011151.000038ef@yahoo.com>,
Now, would it be the first thing I would want like addition to C++
standard library? No it would not be.
The first thing would be IPv4 communication, sockets, poll etc...
POSIX has all of that. POSIX also has a process model. Why not
just make POSIX a part of the language, then? (Answer that and
you may start to understand why this is harder than it looks
for C++ [and C].)
No, it isn't. How similar do you think the posix and windows threading
model/api are? Yet somehow C++ provides a common wrapper for both.
Actually, implementing C++11 (or C11) threads fully in user space on
pre-Vista Win32 (i.e. before addition of support for conditional
variables to OS API) would be quite challenging. I don't know if
anybody bothered.
I think that it is possible, but if you want it robust then it (cond.
variables) will cost you significant overhead relatively to "native"
synchronization primitives.
C++ threading didn't have 3 level locking until 2017 making it effectively useless IMO. Perhaps that was down to the lowest common denominator called Windows.
On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)Still don't really know what he means by 3 level locking. Using lock
boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 14:41:54 GMT
scott@slp53.sl.home (Scott Lurndal) gabbled:
boltar@caprica.universe writes:
C++ threading didn't have 3 level locking until 2017 making it
effectively useless IMO. Perhaps that was down to the lowest common
denominator called Windows.
Mind defining your terminology? "3 level locking", in particular?
If you have to ask....
1. No lock
2. Write lock - Read only access, writer blocked until all readers
out of critic al section)
3. Read-write lock - all threads other than the one in section block)
Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
time as conditional variables. 5 years before C++11. https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader-writer--srw--locks
Of course WinXP remained popular for few more years, approximately up
until 2nd half of 2010, but that too predates publication of C++11 in 2011-09.
This is basic stuff FFS. C++ finally got around to #2 with
shared_mutex in 2017 and its rather critical for certain algorithms.
Assigning a canonical "lock number" to each lock, and failing a lock
request for a lock with a lower number than that already held is
a design pattern that has been around since 1980 (in Burroughs
mainframes it was implemented in hardware). Easy enough to do
prior to C++17 in software.
Thats something else entirely.
And your assertion that a language that doesn't support it
intrinsically is "useless" is ridiculous.
Not useless then, just less useful.
I never ever used what you call "3 level locking", not even by mistake.
But then, I don't write complicated apps on "big" computers day in day
out.
On Sun, 25 Oct 2026 14:22:34 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/25/2026 1:31 AM, boltar@caprica.universe wrote:
The differences are utterly irrelevant when it comes to prividing a
common
API to the functionality but thank you for demonstrating you had no
answer
to my question.
Ummm... It is relevant. Every process has a single thread of
execution, but not all processes have multiple threads.
No shit sherlock, thanks for the heads up. Your point is?
On Sun, 25 Oct 2026 19:28:00 -0700, Chris M. Thomasson wrote:
A lib that never allocates behind your back is what you
want in embedded, kernel, and arena code ...
Even kernels want a common memory-management architecture, so addon
modules donrCOt have to reinvent memory management on their own.
Think of something like allocating low-priority cache memory, for
stuff that can be dumped if necessary: that needs to be managed in the
core of the kernel, so that if apps need regular memory for things
they want to keep in memory, the kernel can free up cache as necessary
to make more memory available.
Stop trying to rationalize away the whole point of dynamic memory
allocation.
On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there.
No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of solving the resource-allocation problem once and for all in the
library API, you are pushing the burden onto all the client code, each
one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the callerrCOs job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the callerrCOs job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
Yes. The caller calls malloc, if it succeeded, the caller needs to free
what it got... Right?
On Mon, 26 Oct 2026 13:12:24 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:
On 10/26/2026 12:45 PM, Michael S wrote:
On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)Still don't really know what he means by 3 level locking. Using lock
boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 14:41:54 GMT
scott@slp53.sl.home (Scott Lurndal) gabbled:
boltar@caprica.universe writes:
C++ threading didn't have 3 level locking until 2017 making it
effectively useless IMO. Perhaps that was down to the lowest
common denominator called Windows.
Mind defining your terminology? "3 level locking", in
particular?
If you have to ask....
1. No lock
2. Write lock - Read only access, writer blocked until all readers
out of critic al section)
3. Read-write lock - all threads other than the one in section
block)
Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
time as conditional variables. 5 years before C++11.
https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader-writer--srw--locks
Of course WinXP remained popular for few more years, approximately
up until 2nd half of 2010, but that too predates publication of
C++11 in 2011-09.
This is basic stuff FFS. C++ finally got around to #2 with
shared_mutex in 2017 and its rather critical for certain
algorithms.
Assigning a canonical "lock number" to each lock, and failing a
lock request for a lock with a lower number than that already
held is a design pattern that has been around since 1980 (in
Burroughs mainframes it was implemented in hardware). Easy
enough to do prior to C++17 in software.
Thats something else entirely.
And your assertion that a language that doesn't support it
intrinsically is "useless" is ridiculous.
Not useless then, just less useful.
I never ever used what you call "3 level locking", not even by
mistake. But then, I don't write complicated apps on "big"
computers day in day out.
hashing where an address is hashed into a lock index such that no
object needs its own lock is nothing new. But it needs to be sorted
and deduped.
He explained it in the post above.
It seem that he mistyped few things in explanation, but it is possible
to understand intentions. He is talking about std::shared_mutex.
On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the callerrCOs job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
Yes. The caller calls malloc, if it succeeded, the caller needs to free
what it got... Right?
Say a lib that has foo_create... Well, the damn called must remember
to call foo_destroy, right?
HUH? How do you call say, fread without a user provided buffer?
If you need dynamic memory fine.
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
On Mon, 26 Oct 2026 13:23:59 -0700, Chris M. Thomasson wrote:
If you need dynamic memory fine.
What the hell do you think we have been talking about this whole
time??
On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:
Say a lib that has foo_create... Well, the damn called must remember
to call foo_destroy, right?
Are you backpedalling from your previous idea that the caller must
allocate the memory for the library to use?
On 26/10/2026 21:29, Chris M. Thomasson wrote:
On 10/25/2026 8:40 PM, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the callerrCOs job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
Yes. The caller calls malloc, if it succeeded, the caller needs to
free what it got... Right?
Exactly.-a The caller is responsible for /managing/ the memory (or it can pass on that responsibility to something else).-a malloc and free are provide and dispose of memory, they do not manage it.
On 10/23/26 01:01, boltar@caprica.universe wrote:
On Thu, 22 Oct 2026 12:19:49 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bd7tj$rh4f$1@dont-email.me>,-a <boltar@battlestar.co.uk>
wrote:
Most of us have a CS degree. But then we go out into the real world,
get a
job and find out what real programming on real products entails, not
a load
of virtual academic naval gazing.
That's because it's not a trade school degree.-a It's not there to teach >>> you to program, it's there to teach you the fundamentals that you
need to
properly understand programming.
No, it teaches you fundamentals of certain aspects of computer
paradigms such
as databases, graphics, AI. Most people into computers learn actual
programming
long before they hit university.
Engineering schools are even more that way.-a They don't teach you much
engineering, but they give you all the background that you need to learn >>> engineering.
Programming isn't pure engineering - its a combination of engineering,
logic,
art and a trade.
If you just want a job, getting one of these degrees is not for you.
It's
not there for that.
Bill Gates never earned a degree. He seemed to do ok.
From what I understand, he wasn't a very good programmer, though.
On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:
Say a lib that has foo_create... Well, the damn called must
remember to call foo_destroy, right?
Are you backpedalling from your previous idea that the caller must
allocate the memory for the library to use?
Where did I say must?
On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:
On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:
Say a lib that has foo_create... Well, the damn called must
remember to call foo_destroy, right?
Are you backpedalling from your previous idea that the caller must
allocate the memory for the library to use?
Where did I say must?
You said rCLManaging the memory is the callerrCOs job in C anyway.rCY You didnrCOt say rCLcould be the callerrCOs jobrCY as in rCLthe caller could have a
choicerCY, you said rCL*is* the callerrCOs jobrCY. No choice. I.e. the caller *must* manage memory.
On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
Managing the memory is the callerrCOs job in C anyway.
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:
On 10/26/2026 2:45 PM, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote:
Say a lib that has foo_create... Well, the damn called must
remember to call foo_destroy, right?
Are you backpedalling from your previous idea that the caller must
allocate the memory for the library to use?
Where did I say must?
You said rCLManaging the memory is the callerrCOs job in C anyway.rCY You didnrCOt say rCLcould be the callerrCOs jobrCY as in rCLthe caller could have a
choicerCY, you said rCL*is* the callerrCOs jobrCY. No choice. I.e. the caller *must* manage memory.
Michael S <already5chosen@yahoo.com> writes:
On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) wrote:
Indeed, but I'm hoping Mr Boltar will chime in with his answers,
so that we can understand why thinks that a language like C
should introduce a *process* model, and how threads are similar.
- Dan C.
First, he was talking about C++. Unlike me, he does not appear to care
about C.
Second, while in theory threads can be implemented by C++
compilers+language support library, in practice I had never seen it
done. All I had seen is C++ threads implemented in library as thin
wrapper atop of the OS (or RT executive) implementation.
I can not see while the same can't be done for processes, with
API modeled on posix_spawn() or Windows CreateProcess().
It does not look like variety in this field is bigger than in case of
threads. More like it is smaller.
Now, would it be the first thing I would want like addition to C++
standard library? No it would not be.
The first thing would be IPv4 communication, sockets, poll etc...
For which we, thankfully, have POSIX on most non-windows operating
systems.
On 23/10/2026 18:57, Peter Flass wrote:
On 10/23/26 02:45, David Brown wrote:
On 23/10/2026 08:25, Lawrence DrCOOliveiro wrote:
On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:
On 10/22/2026 8:19 PM, Lawrence DrCOOliveiro wrote:
On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:
That's why I try to use PL/I AUTOMATIC (stack) storage and not
allocate a lot of stuff. You need to have a disciplined approach >>>>>>> if you allocate random stuff here and there.
What if yourCOre building an object that needs to be returned to the >>>>>> caller?
Have the caller have the object before hand and call a function to
initialize it?
IrCOm assuming that all that BASIC programming hasnrCOt got to your head, >>>> and yourCOre not serious. ;)
Chris' wording is perhaps poor, but the principle is right.
I don't know PL/I or Fortran, but in C if you have :
-a-a-a-a-atypedef struct data_struct { int a; int xs[20]; } S ;
-a-a-a-a-aS build_some_data(void) {
-a-a-a-a-a-a-a-a S s;
-a-a-a-a-a-a-a-a s.a = 123;
-a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) s.xs[i] = i;
-a-a-a-a-a-a-a-a return s;
-a-a-a-a-a}
-a-a-a-a-avoid foo() {
-a-a-a-a-a-a-a-a S s = build_some_data();
-a-a-a-a-a}
then it is typically handled as though you had written :
-a-a-a-a-avoid build_some_data(S * p) {
-a-a-a-a-a-a-a-a p->a = 123;
-a-a-a-a-a-a-a-a for (int i = 0; i < 20; i++) p->xs[i] = i;
-a-a-a-a-a-a-a-a return;
-a-a-a-a-a}
-a-a-a-a-avoid foo() {
-a-a-a-a-a-a-a-a S s;
-a-a-a-a-a-a-a-a build_some_data(&s);
-a-a-a-a-a}
That is - the caller creates the /space/ for the returned object, but
does not do any kind of initialisation.-a It passes a pointer to that
space as a hidden parameter to the function that wants to return the
object.
That principle should work fine in any language, as long as the size
of the returned object is known by the caller code.
That last sentence is why it would not work fine,
OK.-a Knowing the size of the returned object is an absolute requirement
for pre-allocation by the caller, and it is a requirement that is fine
for a lot of situations and a lot of languages.-a But if it is not the
case for PL/I, Fortran, or any other particular language (or particular function in any language), then I fully agree - the object's space can't
be handled by the caller.
On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:
Or what about miniaudiorCOs ma_engine_get_heap_size plus
ma_engine_init_preallocated
No idea about that, but the same principle would apply.
On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:
Or what about miniaudiorCOs ma_engine_get_heap_size plus
ma_engine_init_preallocated
No idea about that, but the same principle would apply.
On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)Seems so! Damn it.
boltar@caprica.universe wrote:
On Sun, 25 Oct 2026 14:19:14 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/25/2026 1:34 AM, boltar@caprica.universe wrote:
On Sat, 24 Oct 2026 13:57:02 -0400 (EDT)
kludge@panix.com (Scott Dorsey) gabbled:
In article <11bif5s$2pam0$1@dont-email.me>,
Peter Flass <Peter@Iron-Spring.com> wrote:
You can have co-operative threads. IBM CICS used to run lots of
threads (tasks) concurrently, and ran them well.
When I learned C, there was no threading and there were only
different processes, so you had to do a fork and then synchronize
with the other process. This wasn't a dealbreaker and we did
plenty of stuff that way, but having threads available was very
nice and made for many operations becoming more convenient to
write.
Unfortunately most win32 programmers don't really understand
multiprocess programming because the w32 API is so borked so use
threads even when seperate process would be more appropriate.
Windows has what we need to run multi process. Even for a Mutex...
Remember WAIT_ABANDONED?
win32 can't do fork() making it effectively a totally useless API for
a lot of multiprocess development. Creating a brand new process is
fine if you don't need any complicated shared state such as when
kicking off something on the command line or creating a pipe
(something else win32 is shit at) but thats about it.
You are clueless about Windows. That's o.k.
Your pretense that you know something about it is not o.k.
In that regard you are not better than LDO.
On 25/10/2026 00:11, Michael S wrote:
On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) wrote:
In article <11bj08r$309uk$1@dont-email.me>,
Peter Flass-a <Peter@Iron-Spring.com> wrote:
On 10/24/26 09:41, Dan Cross wrote:
In article <11bhppd$2lpkc$1@dont-email.me>,
<boltar@caprica.universe> wrote:
On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bf4d1$skul$1@dont-email.me>,
<boltar@caprica.universe> wrote:
On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <11bd7rg$2cvfs$1@dont-email.me>,
<boltar@battlestar.co.uk> wrote:
You need an OS to do threading properly too. Theres a reason >>>>>>>>>> green threads in java were a joke.
Weird that you think you need a operating system for threads, >>>>>>>>> yet you want C to standardize processes which also ... need an >>>>>>>>> operating system.-a I mean, POSIX already does an ok job of
standardizing the sorts of process-y things you would expect >>>>>>>>> from, you know, an operating system.
I'm simply pointing out the inconsistency in having a threading >>>>>>>> library but not a process library. Its perfectly possible to
simulate a multiprocess enviroment.
So write a simulator in your language of choice.-a You don't need >>>>>>> the language to standardize a process model for that.
Ditto threads. So why does C++ have a threading library?
Take your time...
What, pray tell, do you think that a _thread_ is?-a And how is it
different from a _process_?-a For that matter, what do you think
that a _process_ is?
Please, take all the time you need to answer.
Threads share resources such as address space, files, etc. A process
runs in its own address space. (at least these days, before virtual
memory, who knows?)
Indeed, but I'm hoping Mr Boltar will chime in with his answers,
so that we can understand why thinks that a language like C
should introduce a *process* model, and how threads are similar.
-a-a-a-a- Dan C.
First, he was talking about C++. Unlike me, he does not appear to care
about C.
Second, while in theory threads can be implemented by C++
compilers+language-a support library, in practice I had never seen it
done. All I had seen is C++ threads implemented in library as thin
wrapper atop of the OS (or RT executive) implementation.
I can not see while the same can't be done for processes, with
API modeled on posix_spawn() or Windows CreateProcess().
It does not look like variety in this field is bigger than in case of
threads. More like it is smaller.
No one is suggesting that the threads themselves are implemented in
pure, standard, portable C++.-a You need an underlying OS or support of
some sort if you are going to have preemptable threads.-a It's the same principle as IO and file access.
But the difference between threads and processes is very simple from the viewpoint of C and C++.-a Suppose you have a global (i.e., external
linkage) variable :
-a-a-a-aint x;
Two threads that have "int a = x;" see the same "x" (ignoring data races
and synchronisation).-a Two processes see completely different "x".[...]
On 10/25/2026 2:45 AM, David Brown wrote:
No one is suggesting that the threads themselves are implemented in
pure, standard, portable C++.-a You need an underlying OS or support of
some sort if you are going to have preemptable threads.-a It's the same
principle as IO and file access.
But the difference between threads and processes is very simple from
the viewpoint of C and C++.-a Suppose you have a global (i.e., external
linkage) variable :
-a-a-a-a-aint x;
Two threads that have "int a = x;" see the same "x" (ignoring data
races and synchronisation).-a Two processes see completely different
"x".[...]
Bingo. So, trying to imply that system is something okay for multi
process, well, good luck. Daft. C/C++ has no std way to deal with multi process. But, we can use C/C++ to program for it all day long. Interesting.
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there.
No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of >>> solving the resource-allocation problem once and for all in the
library API, you are pushing the burden onto all the client code, each
one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there.
No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of >>>> solving the resource-allocation problem once and for all in the
library API, you are pushing the burden onto all the client code, each >>>> one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
fread() uses a caller-provided buffer, which, according to your previous comment, "push[es] the burden onto all the client code, each one of
which has to solve it for itself", so according to you, "That's a dumb
way to design things"..If that isn't your actual opinion of fread(),
your comments need to be at least a little more nuanced to avoid
applying to fread().
On 10/27/26 08:00, James Kuyper wrote:
On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there.
No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of >>>>> solving the resource-allocation problem once and for all in the
library API, you are pushing the burden onto all the client code, each >>>>> one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
fread() uses a caller-provided buffer, which, according to your previous
comment, "push[es] the burden onto all the client code, each one of
which has to solve it for itself", so according to you, "That's a dumb
way to design things"..If that isn't your actual opinion of fread(),
your comments need to be at least a little more nuanced to avoid
applying to fread().
The difference is that the size of the buffer for fread() is the maximum
you want/expect to read. The size of an object is the size it is, not >necessarily what you expect. If you don't provide enough space you will >truncate.
On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there.
No it isnrCOt. ItrCOs not a good way to manage things, anyway:
instead of solving the resource-allocation problem once and for
all in the library API, you are pushing the burden onto all the
client code, each one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
fread() uses a caller-provided buffer, which, according to your previous comment, "push[es] the burden onto all the client code, each one of
which has to solve it for itself", so according to you, "That's a dumb
way to design things"..
On 2026-10-25 20:42, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 16:16:26 -0700, Chris M. Thomasson wrote:
Even analogous, to say, an API that says read n bytes and store into
buffer. Well, the caller has lifetime of said buffer. The caller makes
the buffer, calls into the function.
So how is the caller supposed to manage that memory?
On Tue, 27 Oct 2026 11:00:08 -0400, James Kuyper wrote:
On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:
On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote:
On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there.
No it isnrCOt. ItrCOs not a good way to manage things, anyway:
instead of solving the resource-allocation problem once and for
all in the library API, you are pushing the burden onto all the
client code, each one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
fread() uses a caller-provided buffer, which, according to your previous
comment, "push[es] the burden onto all the client code, each one of
which has to solve it for itself", so according to you, "That's a dumb
way to design things"..
Not even paying attention to whatrCOs being said in the parts you
quoted, never mind the parts you didnrCOt. Note my remark above about rCLsolving the resource allocation problemrCY; elsewhere I asked: rCLWhat if yourCOre building an object that needs to be returned to the caller?rCY
Not clear yet what werCOre talking about here? WerCOre not talking about random API calls, werCOre talking about libraries that need to create
and manage abstract objects that encapsulate the function they are
providing!
... without the context that applies elsewhere, your comment about
resource allocation comes off as a non-sequitur.
On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:No, none of those comments appear anywhere in this sub-thread as
... without the context that applies elsewhere, your comment about
resource allocation comes off as a non-sequitur.
ThatrCOs just an excuse. Other comments of mine, from further back in
this particular line of this thread:
* rCLWhat if yourCOre building an object that needs to be returned to the
caller?rCY
* rCLThe principle applies to Fortran as it does to any language where
you have to explicitly manage storage allocations.rCY
* rCLIf you have to do cleanup at each level before exiting, then it works
perfectly well.rCY
Did you notice any of that?
On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:
... without the context that applies elsewhere, your comment about
resource allocation comes off as a non-sequitur.
ThatrCOs just an excuse. Other comments of mine, from further back in
this particular line of this thread:
* rCLWhat if yourCOre building an object that needs to be returned to the
caller?rCY
* rCLThe principle applies to Fortran as it does to any language where
you have to explicitly manage storage allocations.rCY
* rCLIf you have to do cleanup at each level before exiting, then it works
perfectly well.rCY
Did you notice any of that?
From elsewhere in the discussion:
I find the C code I write tends to do a lot of dynamic resource
allocations. These can sometimes fail with errors. So error
recovery will invariably involve cleaning up those parts of the
allocations which already succeeded. Gotos are no good for this;
you need to exit levels of structure nesting one by one, disposing
of allocations as you go.
I put together an example here
<https://gitlab.com/ldo/a_structured_discipline_of_programming>.
This is an extension module that offers services to Python code,
because that is just about the worst example I could think of, for
those who think gotos can cut it.
Did you pay attention to any of that?
On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
Creating a brand new process is fine if
you don't need any complicated shared state such as when kicking off
something
on the command line or creating a pipe (something else win32 is shit at)
but
thats about it.
Shared state? Just use memory mapped files. You don't need pipes/sockets >etc. You need to know how to properly sync things.
On Mon, 26 Oct 2026 13:03:25 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
Creating a brand new process is fine if
you don't need any complicated shared state such as when kicking off
something
on the command line or creating a pipe (something else win32 is shit
at) but
thats about it.
Shared state? Just use memory mapped files. You don't need pipes/
sockets etc. You need to know how to properly sync things.
Oh really? So you receive an incoming connection to a socket via an
accept()
call. In unix you can fork() at that point so the connecting client has a server process all to itself with all the state instantly copied from the parent process. HOw do you mimic that in windows? Start the server process from scratch and pass it a ton of state via the command line or using some roll-your-own shared memory nonsense? Give me a break. I guess in
windows it
spawns a thread leading to the issue of a single thread crashing
bringing down
the entire application - something multiprocess completely avoids.
On Mon, 26 Oct 2026 21:45:17 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)
boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 14:41:54 GMT
scott@slp53.sl.home (Scott Lurndal) gabbled:
boltar@caprica.universe writes:
C++ threading didn't have 3 level locking until 2017 making it
effectively useless IMO. Perhaps that was down to the lowest common
denominator called Windows.
Mind defining your terminology? "3 level locking", in particular?
If you have to ask....
1. No lock
2. Write lock - Read only access, writer blocked until all readers
out of critic al section)
3. Read-write lock - all threads other than the one in section block)
Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
time as conditional variables. 5 years before C++11.
And unix got pthreads in 1995. Windows a decade late as usual.
Not useless then, just less useful.
I never ever used what you call "3 level locking", not even by mistake.
But then, I don't write complicated apps on "big" computers day in day
out.
Fine, most people will never use it, but for certain things its vital.
On 10/28/2026 1:58 AM, boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 21:45:17 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Mon, 26 Oct 2026 16:16:46 -0000 (UTC)
boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 14:41:54 GMT
scott@slp53.sl.home (Scott Lurndal) gabbled:
boltar@caprica.universe writes:If you have to ask....
C++ threading didn't have 3 level locking until 2017 making it
effectively useless IMO. Perhaps that was down to the lowest common >>>>>> denominator called Windows.
Mind defining your terminology?-a-a "3 level locking", in particular? >>>>
1. No lock
2. Write lock - Read only access, writer blocked until all readers
out of critic al section)
3. Read-write lock-a - all threads other than the one in section block) >>>>
Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
time as conditional variables. 5 years before C++11.
And unix got pthreads in 1995. Windows a decade late as usual.
Not useless then, just less useful.
I never ever used what you call "3 level locking", not even by mistake.
But then, I don't write complicated apps on "big" computers day in day
out.
Fine, most people will never use it, but for certain things its vital.
Its simple, if you don't like windows, do use the damn pile.
On Mon, 26 Oct 2026 22:04:33 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Mon, 26 Oct 2026 09:51:51 -0000 (UTC)
boltar@caprica.universe wrote:
Go ahead and remain clueless.
system() can do most of the same things as spawn() family.
Rubbish, you clearly didn't bother to spend 2 mins googling.
The problem with system() is not that. Often not even an efficiency.
The problem with system() identified most easily if we ask ourself "Why
do we want xyz in standard library?"
The problem with system is its fire and forget - all you can do with it is collect its exit code when its done. You can't communicate with it via
pipes, you can't control it via signals (well, not easily), you can't set its process group, tty and on and on. Oh, and it also fires up the default shell to
do the actual execution making it hideously inefficient. No serious unix dev uses system() unless thay have absolutely no choice or it really is a case of "go run this, I don't care what happens".
On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote:
... without the context that applies elsewhere, your comment about
resource allocation comes off as a non-sequitur.
ThatrCOs just an excuse. Other comments of mine, from further back in
this particular line of this thread:
* rCLWhat if yourCOre building an object that needs to be returned to the
caller?rCY
* rCLThe principle applies to Fortran as it does to any language where
you have to explicitly manage storage allocations.rCY
* rCLIf you have to do cleanup at each level before exiting, then it works
perfectly well.rCY
Did you notice any of that?
From elsewhere in the discussion:
I find the C code I write tends to do a lot of dynamic resource
allocations. These can sometimes fail with errors. So error
recovery will invariably involve cleaning up those parts of the
allocations which already succeeded. Gotos are no good for this;
you need to exit levels of structure nesting one by one, disposing
of allocations as you go.
I put together an example here
<https://gitlab.com/ldo/a_structured_discipline_of_programming>.
This is an extension module that offers services to Python code,
because that is just about the worst example I could think of, for
those who think gotos can cut it.
Did you pay attention to any of that?
On 10/28/2026 2:01 AM, boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 13:03:25 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
Creating a brand new process is fine if
you don't need any complicated shared state such as when kicking off
something
on the command line or creating a pipe (something else win32 is shit
at) but
thats about it.
Shared state? Just use memory mapped files. You don't need pipes/
sockets etc. You need to know how to properly sync things.
Oh really? So you receive an incoming connection to a socket via an
accept()
call. In unix you can fork() at that point so the connecting client has a
server process all to itself with all the state instantly copied from the
parent process. HOw do you mimic that in windows? Start the server process >> from scratch and pass it a ton of state via the command line or using some >> roll-your-own shared memory nonsense? Give me a break. I guess in
windows it
spawns a thread leading to the issue of a single thread crashing
bringing down
the entire application - something multiprocess completely avoids.
On Windows? Get used to
https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsadup
licatesocketa
DuplicateHandle
On 10/28/2026 2:06 AM, boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 22:04:33 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Mon, 26 Oct 2026 09:51:51 -0000 (UTC)
boltar@caprica.universe wrote:
Go ahead and remain clueless.
system() can do most of the same things as spawn() family.
Rubbish, you clearly didn't bother to spend 2 mins googling.
The problem with system() is not that. Often not even an efficiency.
The problem with system() identified most easily if we ask ourself "Why
do we want xyz in standard library?"
The problem with system is its fire and forget - all you can do with it is >> collect its exit code when its done. You can't communicate with it via
pipes, you can't control it via signals (well, not easily), you can't set its
process group, tty and on and on. Oh, and it also fires up the default shell >to
do the actual execution making it hideously inefficient. No serious unix dev >> uses system() unless thay have absolutely no choice or it really is a case of
"go run this, I don't care what happens".
Right. std::system, at least when I use it, makes the caller block until
the process is done.
On Wed, 28 Oct 2026 14:04:02 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/28/2026 2:01 AM, boltar@caprica.universe wrote:
On Mon, 26 Oct 2026 13:03:25 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/26/2026 3:01 AM, boltar@caprica.universe wrote:
Creating a brand new process is fine if
you don't need any complicated shared state such as when kicking
off something
on the command line or creating a pipe (something else win32 is
shit at) but
thats about it.
Shared state? Just use memory mapped files. You don't need pipes/
sockets etc. You need to know how to properly sync things.
Oh really? So you receive an incoming connection to a socket via an
accept()
call. In unix you can fork() at that point so the connecting client
has a
server process all to itself with all the state instantly copied from
the
parent process. HOw do you mimic that in windows? Start the server
process
from scratch and pass it a ton of state via the command line or using
some
roll-your-own shared memory nonsense? Give me a break. I guess in
windows it
spawns a thread leading to the issue of a single thread crashing
bringing down
the entire application - something multiprocess completely avoids.
On Windows? Get used to
https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-
winsock2-wsadup
licatesocketa
DuplicateHandle
Right, lets duplicate everything manually - so much easier than one
system call.
And thats just file descriptors.
On Thu, 29 Oct 2026 16:22:29 -0000 (UTC)
boltar@caprica.universe wrote:
On Thu, 29 Oct 2026 00:06:45 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Wed, 28 Oct 2026 08:58:55 -0000 (UTC)
boltar@caprica.universe wrote:
And unix got pthreads in 1995. Windows a decade late as usual.
That's like if I'd say that Linux is 33 years (and counting) late
because it has no QueueUserAPC(). Of course, I am smarter than saying
such nonsense.
More relevantly, Windows (Win32) has preemptive kernel-scheduled
threads
+ assortment of synchronization primitives since very beginning
(1993)
- ahead of many Unixen and behind some of them. Certainly ahead of
Posix standardisation of threads.
Wow, pre-emptive multitasking in 1993. Incredible technology!
Not just preemptive multitasking between processes, but
kernel-scheduled threads within each process as well.
Not a novel idea, but the one that eventually won over all others.
In 1993 it was already obvious that it is going to win, but in
1988-1989, when development started, it was less trivial.
On 10/29/2026 9:19 AM, boltar@caprica.universe wrote:
Right, lets duplicate everything manually - so much easier than one
system call.
And thats just file descriptors.
Do we actually need everything, or just a subset?
On Thu, 29 Oct 2026 22:39:22 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Thu, 29 Oct 2026 16:22:29 -0000 (UTC)
boltar@caprica.universe wrote:
On Thu, 29 Oct 2026 00:06:45 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Wed, 28 Oct 2026 08:58:55 -0000 (UTC)
boltar@caprica.universe wrote:
And unix got pthreads in 1995. Windows a decade late as usual.
That's like if I'd say that Linux is 33 years (and counting) late
because it has no QueueUserAPC(). Of course, I am smarter than saying
such nonsense.
More relevantly, Windows (Win32) has preemptive kernel-scheduled
threads
+ assortment of synchronization primitives since very beginning
(1993)
- ahead of many Unixen and behind some of them. Certainly ahead of
Posix standardisation of threads.
Wow, pre-emptive multitasking in 1993. Incredible technology!
Not just preemptive multitasking between processes, but
kernel-scheduled threads within each process as well.
Not a novel idea, but the one that eventually won over all others.
In 1993 it was already obvious that it is going to win, but in
1988-1989, when development started, it was less trivial.
Implementing threads is trivial compared to implementing multi processes with shared memory. Adding them to a pre-existing kernel might be tricky but when you're building one from scratch as per NT then its hardly a big deal.
The trend nowadays is to revive the old coroutine concept, in a new
guise called rCLstacklessrCY coroutines. These give you support for async >operations, but with transfers of control being made explicit at
rCLawaitrCY points, rather than unpredictably as with full preemptive >threading. This greatly reduces the opportunity for race conditions.
Credit to Microsoft for pioneering this, but nowadays you see the idea >popping up in JavaScript and Python and who knows where else.
HererCOs a fun little thing: if you set a socket to nonblocking and then
do the connect(2) call, it will seemingly fail with an EINPROGRESS
error. But in fact, the connection attempt gets initiated, and you can >monitor its subsequent progress from your event loop.
On Fri, 30 Oct 2026 20:37:14 +0100
Jeroen Belleman <jeroen@nospam.please> gabbled:
On 10/30/26 17:07, boltar@caprica.universe wrote:
On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <20261030105900.000020ce@yahoo.com>,
Michael S-a <already5chosen@yahoo.com> wrote:
Only if you intended to close the TTY the programs were started
on.-a Otherwise, I don't see why it would be necessary:
What happens when caller is GUI-style application?
That depends on a number of factors, but basically, "it does the
same thing".-a Why would it be any different?
Windows treats GUI apps entirely differently to console ones so a
Windows
dev might not appreciate that on unix there is no demarcation - a GUI
app
simply has a network connection to the X server and it can either sit in >>> an event loop waiting for events - as per a windows main thread - or
go do
other things and periodically check the X event list.
That's where threads are useful: The GUI is one thread, and the "other
things" are in one or more other threads. There are altogether too many
programs that hang the GUI while "other things" are going on. That
should never happen!
If its multithreaded but that still happens someone probably has created
too
many critical sections with too many locks.
On Fri, 30 Oct 2026 20:37:14 +0100
Jeroen Belleman <jeroen@nospam.please> gabbled:
On 10/30/26 17:07, boltar@caprica.universe wrote:
On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <20261030105900.000020ce@yahoo.com>,
Michael S-a <already5chosen@yahoo.com> wrote:
Only if you intended to close the TTY the programs were started
on.-a Otherwise, I don't see why it would be necessary:
What happens when caller is GUI-style application?
That depends on a number of factors, but basically, "it does the
same thing".-a Why would it be any different?
Windows treats GUI apps entirely differently to console ones so a
Windows
dev might not appreciate that on unix there is no demarcation - a GUI
app
simply has a network connection to the X server and it can either sit in >>> an event loop waiting for events - as per a windows main thread - or
go do
other things and periodically check the X event list.
That's where threads are useful: The GUI is one thread, and the "other
things" are in one or more other threads. There are altogether too many
programs that hang the GUI while "other things" are going on. That
should never happen!
If its multithreaded but that still happens someone probably has created
too
many critical sections with too many locks.
On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
On Fri, 30 Oct 2026 20:37:14 +0100
Jeroen Belleman <jeroen@nospam.please> gabbled:
On 10/30/26 17:07, boltar@caprica.universe wrote:
On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <20261030105900.000020ce@yahoo.com>,
Michael S-a <already5chosen@yahoo.com> wrote:
Only if you intended to close the TTY the programs were started
on.-a Otherwise, I don't see why it would be necessary:
What happens when caller is GUI-style application?
That depends on a number of factors, but basically, "it does the
same thing".-a Why would it be any different?
Windows treats GUI apps entirely differently to console ones so a
Windows
dev might not appreciate that on unix there is no demarcation - a GUI >>>> app
simply has a network connection to the X server and it can either sit in >>>> an event loop waiting for events - as per a windows main thread - or
go do
other things and periodically check the X event list.
That's where threads are useful: The GUI is one thread, and the "other
things" are in one or more other threads. There are altogether too many
programs that hang the GUI while "other things" are going on. That
should never happen!
If its multithreaded but that still happens someone probably has created
too
many critical sections with too many locks.
What do you mean? Is the GUI deadlocking?
On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
If its multithreaded but that still happens someone probably has created
too
many critical sections with too many locks.
Makes no sense at all. Have you taken a look at my multex? It can create
a shit lod of mutexes, and never deadlock. It keeps a strict locking
order. Sorts and dedups the mutexes. Also, notice that an object does
not need its own mutex:
Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
time as conditional variables. 5 years before C++11. https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader- writer--srw--locks
Of course WinXP remained popular for few more years, approximately up
until 2nd half of 2010, but that too predates publication of C++11 in 2011-09.
On Sat, 31 Oct 2026 13:11:29 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
On Fri, 30 Oct 2026 20:37:14 +0100
Jeroen Belleman <jeroen@nospam.please> gabbled:
On 10/30/26 17:07, boltar@caprica.universe wrote:
On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
In article <20261030105900.000020ce@yahoo.com>,
Michael S-a <already5chosen@yahoo.com> wrote:
Only if you intended to close the TTY the programs were started >>>>>>>> on.-a Otherwise, I don't see why it would be necessary:
What happens when caller is GUI-style application?
That depends on a number of factors, but basically, "it does the
same thing".-a Why would it be any different?
Windows treats GUI apps entirely differently to console ones so a
Windows
dev might not appreciate that on unix there is no demarcation - a
GUI app
simply has a network connection to the X server and it can either
sit in
an event loop waiting for events - as per a windows main thread -
or go do
other things and periodically check the X event list.
That's where threads are useful: The GUI is one thread, and the
"other things" are in one or more other threads. There are
altogether too many
programs that hang the GUI while "other things" are going on. That
should never happen!
If its multithreaded but that still happens someone probably has
created too
many critical sections with too many locks.
What do you mean? Is the GUI deadlocking?
What do I mean? If you don't understand the concepts of multithreading then maybe stay out of the discussion.
On Sat, 31 Oct 2026 13:14:47 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
If its multithreaded but that still happens someone probably has
created too
many critical sections with too many locks.
Makes no sense at all. Have you taken a look at my multex? It can create
WTF has your multex got to do with anything? No one was talking about your code so don't use this discussion as some excuse to show off some code you wrote than no one cares about.
a shit lod of mutexes, and never deadlock. It keeps a strict locking
order. Sorts and dedups the mutexes. Also, notice that an object does
not need its own mutex:
Thats nice.
tl;dr
On 11/1/2026 1:33 AM, boltar@caprica.universe wrote:
What do you mean? Is the GUI deadlocking?
What do I mean? If you don't understand the concepts of multithreading then >> maybe stay out of the discussion.
Ummm. I think you are the one that does not know what the heck they are >talking about.
On 11/1/2026 1:34 AM, boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 13:14:47 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:WTF has your multex got to do with anything? No one was talking about your >> code so don't use this discussion as some excuse to show off some code you >> wrote than no one cares about.
If its multithreaded but that still happens someone probably has
created too
many critical sections with too many locks.
Makes no sense at all. Have you taken a look at my multex? It can create >>
It uses a table of a lot of mutexes. Never deadlocks. So, you need to
study up? You said "too many critical sections with too many locks."
Well, if you don't know how to use them, don't use them. Learn first?
On Sun, 1 Nov 2026 18:04:13 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/1/2026 1:34 AM, boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 13:14:47 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 10/31/2026 2:38 AM, boltar@caprica.universe wrote:
If its multithreaded but that still happens someone probably has
created too
many critical sections with too many locks.
Makes no sense at all. Have you taken a look at my multex? It can
create
WTF has your multex got to do with anything? No one was talking about
your
code so don't use this discussion as some excuse to show off some
code you
wrote than no one cares about.
It uses a table of a lot of mutexes. Never deadlocks. So, you need to
study up? You said "too many critical sections with too many locks."
Well, if you don't know how to use them, don't use them. Learn first?
I have no desire to spend hours trawling through someones pet project so they
can make a point about what a L337 coder they are. HTH.
On Sun, 1 Nov 2026 18:03:06 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/1/2026 1:33 AM, boltar@caprica.universe wrote:
What do you mean? Is the GUI deadlocking?
What do I mean? If you don't understand the concepts of
multithreading then
maybe stay out of the discussion.
Ummm. I think you are the one that does not know what the heck they
are talking about.
Yeah, ok. I've only been using pthreads for the last 25 years but sure,
what
do I know.
On 10/27/2026 3:45 AM, Michael S wrote:
Windows got Slim Reader/Writer Locks in Vista (2006-11) at the same
time as conditional variables. 5 years before C++11.
https://learn.microsoft.com/en-us/windows/win32/sync/slim-reader-
writer--srw--locks
Of course WinXP remained popular for few more years, approximately up
until 2nd half of 2010, but that too predates publication of C++11 in
2011-09.
Wasn't that work done in preparation for the C++11 standard?-a I did not
keep track of the standard's discussion, but presumably Microsoft had
people both on the C++ standard's committee, and the Vista programming
team.
Best wishes, and happy standards!
On Sat, 31 Oct 2026 19:56:10 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid> gabbled: >>>> Here=E2=80=99s a fun little thing: if you set a socket to nonblocking and >>>> then do the connect(2) call, it will seemingly fail with an
EINPROGRESS error. But in fact, the connection attempt gets=20
initiated, and you can monitor its subsequent progress from your
event loop. =20
Far too many devs don't know about or don't understand multiplexing
using select() or poll(). Admittedly these are borked on Windows as
you can't use sockets with them=20
On what planet?
On this one where you see code that is only multithreaded in order to serve individual sockets, not because it needs to be.
On Sun, 1 Nov 2026 21:59:41 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
boltar@caprica.universe wrote:
On this one where you see code that is only multithreaded in order to
serve individual sockets, not because it needs to be.
That's because many people unable to implement state machines. Or able,
but don't like them.
It has nothing to do with availability and functionality of select/poll
on Windows.
Last time I had the misfortune to use win32 it couldn't multiplex on sockets.
On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sun, 1 Nov 2026 21:59:41 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
boltar@caprica.universe wrote:
On this one where you see code that is only multithreaded in order
to serve individual sockets, not because it needs to be.
That's because many people unable to implement state machines. Or
able, but don't like them.
It has nothing to do with availability and functionality of
select/poll on Windows.
Last time I had the misfortune to use win32 it couldn't multiplex on
sockets.
That's nonsense. That part of Winsock2 API did not change since 1993.
That is, in early 2000s they added poll() (WAASAPoll), but select() is
the same BSD select() from the very beginning, just a little easier to
use than original, because nfds is DNC.
Now, if you woulds say that on Winsock2 select() can't multiplex
waiting for socket I/O with waiting for other sorts of I/O (files and
pipes) then your statement would make more sense*.
But it does not sound like you really want to make sense. You strongly
prefer mindless bashing.
----
* - Although,
1) of course, there (in Win32) exist not too complicated alternative
methods to achieve such multiplexing as well. Just not via select().
2) today, with nearly all file I/O deeply cached, multiplexing waiting
for file I/O with waiting for sockets is a bad idea. OTOH, Multiplexing sockets with pipes could still make sense, infrequently.
On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sun, 1 Nov 2026 21:59:41 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
boltar@caprica.universe wrote:
On this one where you see code that is only multithreaded in order
to serve individual sockets, not because it needs to be.
That's because many people unable to implement state machines. Or
able, but don't like them.
It has nothing to do with availability and functionality of
select/poll on Windows.
Last time I had the misfortune to use win32 it couldn't multiplex on
sockets.
That's nonsense. That part of Winsock2 API did not change since 1993.
That is, in early 2000s they added poll() (WAASAPoll), but select() is
the same BSD select() from the very beginning, just a little easier to
use than original, because nfds is DNC.
Now, if you woulds say that on Winsock2 select() can't multiplex
waiting for socket I/O with waiting for other sorts of I/O (files and
pipes) then your statement would make more sense*.
But it does not sound like you really want to make sense. You strongly
prefer mindless bashing.
----
* - Although,
1) of course, there (in Win32) exist not too complicated alternative
methods to achieve such multiplexing as well. Just not via select().
2) today, with nearly all file I/O deeply cached, multiplexing waiting
for file I/O with waiting for sockets is a bad idea. OTOH, Multiplexing sockets with pipes could still make sense, infrequently.
On Mon, 2 Nov 2026 15:03:44 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> wrote:
On 11/2/2026 1:46 PM, Michael S wrote:
On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sun, 1 Nov 2026 21:59:41 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
boltar@caprica.universe wrote:
On this one where you see code that is only multithreaded in
order to serve individual sockets, not because it needs to be.
That's because many people unable to implement state machines. Or
able, but don't like them.
It has nothing to do with availability and functionality of
select/poll on Windows.
Last time I had the misfortune to use win32 it couldn't multiplex
on sockets.
That's nonsense. That part of Winsock2 API did not change since
1993. That is, in early 2000s they added poll() (WAASAPoll), but
select() is the same BSD select() from the very beginning, just a
little easier to use than original, because nfds is DNC.
Now, if you woulds say that on Winsock2 select() can't multiplex
waiting for socket I/O with waiting for other sorts of I/O (files
and pipes) then your statement would make more sense*.
But it does not sound like you really want to make sense. You
strongly prefer mindless bashing.
----
* - Although,
1) of course, there (in Win32) exist not too complicated alternative
methods to achieve such multiplexing as well. Just not via select().
2) today, with nearly all file I/O deeply cached, multiplexing
waiting for file I/O with waiting for sockets is a bad idea. OTOH,
Multiplexing sockets with pipes could still make sense,
infrequently.
Have you ever used IOCP on windows?
No, I didn't.
IMHO, IO compleiion ports "solve" problems that do not exist today
and mostly did not exist since 15-20 years ago.
On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 19:56:10 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid> gabbled: >>>>> Here=E2=80=99s a fun little thing: if you set a socket to nonblocking and >>>>> then do the connect(2) call, it will seemingly fail with an
EINPROGRESS error. But in fact, the connection attempt gets=20
initiated, and you can monitor its subsequent progress from your
event loop. =20
Far too many devs don't know about or don't understand multiplexing
using select() or poll(). Admittedly these are borked on Windows as
you can't use sockets with them=20
On what planet?
On this one where you see code that is only multithreaded in order to serve >> individual sockets, not because it needs to be.
Either you are trolling or don't have a clue?
On Mon, 2 Nov 2026 14:59:26 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 19:56:10 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid>
gabbled:
Here=E2=80=99s a fun little thing: if you set a socket to=20
nonblocking and
then do the connect(2) call, it will seemingly fail with an
EINPROGRESS error. But in fact, the connection attempt gets
initiated, and you can monitor its subsequent progress from your
event loop. =20
Far too many devs don't know about or don't understand multiplexing
using select() or poll(). Admittedly these are borked on Windows as
you can't use sockets with them=20
On what planet?
On this one where you see code that is only multithreaded in order to
serve
individual sockets, not because it needs to be.
Either you are trolling or don't have a clue?
Seems to be your standard response to anyone you disagree with. Go back under
your bridge.
On Mon, 2 Nov 2026 14:59:26 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/1/2026 1:32 AM, boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 19:56:10 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sat, 31 Oct 2026 09:47:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
Lawrence =3D?iso-8859-13?q?D=3DFFOliveiro?=3D <ldo@nz.invalid>
gabbled:
Here=E2=80=99s a fun little thing: if you set a socket to=20
nonblocking and
then do the connect(2) call, it will seemingly fail with an
EINPROGRESS error. But in fact, the connection attempt gets
initiated, and you can monitor its subsequent progress from your
event loop. =20
Far too many devs don't know about or don't understand multiplexing
using select() or poll(). Admittedly these are borked on Windows as
you can't use sockets with them=20
On what planet?
On this one where you see code that is only multithreaded in order to
serve
individual sockets, not because it needs to be.
Either you are trolling or don't have a clue?
Seems to be your standard response to anyone you disagree with. Go back under
your bridge.
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <20261027102255.00006052@yahoo.com>,
Michael S <already5chosen@yahoo.com> wrote:
On Tue, 27 Oct 2026 09:06:26 +0100
David Brown <david.brown@hesbynett.no> wrote:
[snip]
And there are languages like Erlang that divide everything into
micro-processes, and use the same mechanisms for controlling and
passing data around regardless of whether this little processes are
in the same thread, or different threads, different OS processes, or
different computers. That works because there are very narrow and
tightly controlled mechanisms for sharing data.
Note that these are both languages that run on a VM, not compiled
languages.
What you wrote about Erlang resembles MPI, which of course is readily
available for many compiled or jitted languages, including Fortran, C
and C++.
I tried to utilize MPI 20 years ago, but the thinking behind it is to
different from mine, so I ran away in horror.
Erlang uses the "actor" model to represent concurrency; state is
held by each actor, and actors communicate via message passing,
potentially changing state in response to messages. This is a
model for _concurrency_, in which multiple independent threads
of execution are coordinated to some in a single system.
Chorus (the microkernel) worked in a similar fashion. The
microkernel coordinated between actors using message passing.
The actors implemented the higher level operating system
functionality. The Amadeus project, for example, implemented
a version of unix on top of the microkernel using message
passing between actors (The Object manager handled files and
filesystems, the Process actor handled the POSIX process
and thread (SVR4.2ES/MP threads) interfaces including fork,
and light-weight processes that implemented threads, and
the Streams actor provide system V streams support and
networking.
Unisys released the OS as part of their massively parallel
OPUS computer system.
For the particular case of why C++ supports threads but not processes,
the answer should be obvious.
Peter Flass <Peter@Iron-Spring.com> writes:
On 10/27/26 08:00, James Kuyper wrote:
On 2026-10-26 17:45, Lawrence DrCOOliveiro wrote:
On Mon, 26 Oct 2026 13:26:38 -0700, Chris M. Thomasson wrote:[restore snippage]>> On 2026-10-25 23:39, Lawrence DrCOOliveiro wrote: >>>>>> On Sun, 25 Oct 2026 19:11:48 -0700, Chris M. Thomasson wrote:
A caller provided buffer is normal with a lot of API's out there. >>>>>>No it isnrCOt. ItrCOs not a good way to manage things, anyway: instead of
solving the resource-allocation problem once and for all in the
library API, you are pushing the burden onto all the client code, each >>>>>> one of which has to solve it for itself.
ThatrCOs a dumb way to design things.
HUH? How do you call say, fread without a user provided buffer?
Relevance being?
fread() uses a caller-provided buffer, which, according to your previous >>> comment, "push[es] the burden onto all the client code, each one of
which has to solve it for itself", so according to you, "That's a dumb
way to design things"..If that isn't your actual opinion of fread(),
your comments need to be at least a little more nuanced to avoid
applying to fread().
The difference is that the size of the buffer for fread() is the maximum
you want/expect to read. The size of an object is the size it is, not
necessarily what you expect. If you don't provide enough space you will
truncate.
Which isn't a significant issue with fread, since the underlying stdio
buffer (or kernel file cache or terminal driver buffer) will hold the
unread information for the next call to fread.
fread(3) is basically obsolete for most high-performance applications
which map the file directly into the process address space (mmap).
On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
Seems to be your standard response to anyone you disagree with. Go back
under
your bridge.
Really? Why do you have a hatred for say, IOCP? If so, you must also
HATE AIO, or io_uring?
On Wed, 4 Nov 2026 02:22:52 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
Seems to be your standard response to anyone you disagree with. Go
back under
your bridge.
Really? Why do you have a hatred for say, IOCP? If so, you must also
HATE AIO, or io_uring?
I never mentioned IOCP but looking at it, yeah, looks like your standard Windows approach of chucking threads at everything.
On 11/4/2026 8:22 AM, boltar@caprica.universe wrote:
On Wed, 4 Nov 2026 02:22:52 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
Seems to be your standard response to anyone you disagree with. Go
back under
your bridge.
Really? Why do you have a hatred for say, IOCP? If so, you must also
HATE AIO, or io_uring?
I never mentioned IOCP but looking at it, yeah, looks like your standard
Windows approach of chucking threads at everything.
Huh? You mean a thread pool, sometimes we can oversubscribe and use
hardware threads * 2
I don't think you should mock IOCP. Then you would be mocking AIO, or >io_uring.
On Wed, 4 Nov 2026 10:56:20 -0800I sometimes just reserve space in the page file and let the OS lazy write/read.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/4/2026 8:22 AM, boltar@caprica.universe wrote:
On Wed, 4 Nov 2026 02:22:52 -0800
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
On 11/4/2026 12:54 AM, boltar@caprica.universe wrote:
Seems to be your standard response to anyone you disagree with. Go
back under
your bridge.
Really? Why do you have a hatred for say, IOCP? If so, you must also
HATE AIO, or io_uring?
I never mentioned IOCP but looking at it, yeah, looks like your standard >>> Windows approach of chucking threads at everything.
Huh? You mean a thread pool, sometimes we can oversubscribe and use
hardware threads * 2
I don't care if its a thread ocean, its still threads being used where they're
possibly not needed. Obviously depends on load. But if I'm writing a client such as ssh where the only I/O is via stdin and the socket I'm going to multiplex them in select() or poll(), not have 2 seperate threads.
I don't think you should mock IOCP. Then you would be mocking AIO, or
io_uring.
I don't give a toss about IOCP, its a windows thing.
On Sat, 7 Nov 2026 01:17:19 -0000 (UTC)
antispam@fricas.org (Waldek Hebisch) wrote:
In comp.lang.c++ Michael S <already5chosen@yahoo.com> wrote:
On Mon, 2 Nov 2026 15:43:42 -0000 (UTC)
boltar@caprica.universe wrote:
On Sun, 1 Nov 2026 21:59:41 +0200
Michael S <already5chosen@yahoo.com> gabbled:
On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
boltar@caprica.universe wrote:
On this one where you see code that is only multithreaded in
order to serve individual sockets, not because it needs to be.
That's because many people unable to implement state machines. Or
able, but don't like them.
It has nothing to do with availability and functionality of
select/poll on Windows.
Last time I had the misfortune to use win32 it couldn't multiplex
on sockets.
That's nonsense. That part of Winsock2 API did not change since
1993. That is, in early 2000s they added poll() (WAASAPoll), but
select() is the same BSD select() from the very beginning, just a
little easier to use than original, because nfds is DNC.
Now, if you woulds say that on Winsock2 select() can't multiplex
waiting for socket I/O with waiting for other sorts of I/O (files
and pipes) then your statement would make more sense*.
But it does not sound like you really want to make sense. You
strongly prefer mindless bashing.
----
* - Although,
1) of course, there (in Win32) exist not too complicated alternative
methods to achieve such multiplexing as well. Just not via select().
2) today, with nearly all file I/O deeply cached, multiplexing
waiting for file I/O with waiting for sockets is a bad idea. OTOH,
Multiplexing sockets with pipes could still make sense,
infrequently.
Just curious how you solve problem of blocking in single threaded
program?
I don't.
If it is important and I expect that file operation will take
significant time then I do it in another thread.
May be, if I were doing server-side I'd treat it differently, but on
cleent it's unlikely that I don't have more hardware threads than work
to do, so separate thread is just right thing to do in such case.
Assuming, of course, that performance at all matters, which is uncommon.
AFAIK to get data from disc one needs about 10ms or possibly
more, which is pretty long time on modern machines.
I absolutly do not care about spinning rust. For close to 15 years.
Do you assume
that all data that you need is in RAM (or will be after short startup
time)?
In practice, it's extremely likely that all data is in system's file
cache, i.e. in RAM.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 76 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 55:40:32 |
| Calls: | 1,265 |
| Calls today: | 1 |
| Files: | 1,362 |
| D/L today: |
3 files (2,684K bytes) |
| Messages: | 285,687 |