🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.c++
529 messages
529 total messages Page 8 of 11 Started by Lynn McGuire Wed, 14 Oct 2026 04:18
Page 8 of 11 • 529 total messages
Re: Re: what's a process, was The end of software secrecy is almost upon
#413
Author: Peter Flass
Date: Mon, 26 Oct 2026 10:53
23 lines
2492 bytes
On 10/26/26 02:57, boltar@caprica.universe wrote:
> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
> John Levine <johnl@taugh.com> gabbled:
>> According to  <boltar@caprica.universe>:
>>>> 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.
>>
>> Copy-on-write (or on some older systems copy-on-touch) is an implementation
>> detail.  Neither process can look inside the other even if they share some
>> unwritten or untouched pages.
> 
> The point is they are sharing memory. In a reference implementation processes
> don't share any virtual memory at all - everything is copied to a new location
> at fork - so you can't use sharing memory as a way to demarcate multithreading
> and multiprocess.

In the old days before IUCV or VMCF I did a multi-process application on 
VM by using a file to pass data among processes. Surprisingly, it worked 
well.
Re: “The end of software secrecy is almost upon
#412
Author: Scott Dorsey
Date: Mon, 26 Oct 2026 13:50
9 lines
1188 bytes
In article <11bn80e$11hkj$1@dont-email.me>,  <boltar@caprica.universe> wrote:
>Oh please, try a bit harder. You can do anything you want in ring 0 assembler, 
>that doesn't mean its a good idea.

As someone who is spending his morning writing 8051 code, I think it can be
a very very good idea.
--scott
-- 
"C'est un Nagra. C'est suisse, et tres, tres precis."
Re: “The end of software secrecy is almost upon
#416
Author: Scott Lurndal
Date: Mon, 26 Oct 2026 14:41
44 lines
3107 bytes
boltar@caprica.universe writes:
>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.
>

Mind defining your terminology?   "3 level locking", in particular?

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.

And your assertion that a language that doesn't support it intrinsically
is "useless" is ridiculous.
Re: Re: what's a process, was The end of software secrecy is almost upon
#417
Author: Scott Lurndal
Date: Mon, 26 Oct 2026 14:44
28 lines
2344 bytes
Peter Flass <Peter@Iron-Spring.com> writes:
>On 10/26/26 02:57, boltar@caprica.universe wrote:
>> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
>> John Levine <johnl@taugh.com> gabbled:
>>> According to  <boltar@caprica.universe>:
>>>>> 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.
>>>
>>> Copy-on-write (or on some older systems copy-on-touch) is an implementation
>>> detail.  Neither process can look inside the other even if they share some
>>> unwritten or untouched pages.
>> 
>> The point is they are sharing memory. In a reference implementation processes
>> don't share any virtual memory at all - everything is copied to a new location
>> at fork - so you can't use sharing memory as a way to demarcate multithreading
>> and multiprocess.
>
>In the old days before IUCV or VMCF I did a multi-process application on 
>VM by using a file to pass data among processes. Surprisingly, it worked 
>well.

Burroughs had both a synchronous 'core2core' interface between processes
as well as asynchronous storage queues. In the days of small address spaces,
those were invaluable interfaces.
Re: what's a process, was The end of software secrecy is almost upon
#418
Author: Peter Flass
Date: Mon, 26 Oct 2026 15:56
32 lines
2961 bytes
On 10/26/26 07:44, Scott Lurndal wrote:
> Peter Flass <Peter@Iron-Spring.com> writes:
>> On 10/26/26 02:57, boltar@caprica.universe wrote:
>>> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
>>> John Levine <johnl@taugh.com> gabbled:
>>>> According to  <boltar@caprica.universe>:
>>>>>> 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.
>>>>
>>>> Copy-on-write (or on some older systems copy-on-touch) is an implementation
>>>> detail.  Neither process can look inside the other even if they share some
>>>> unwritten or untouched pages.
>>>
>>> The point is they are sharing memory. In a reference implementation processes
>>> don't share any virtual memory at all - everything is copied to a new location
>>> at fork - so you can't use sharing memory as a way to demarcate multithreading
>>> and multiprocess.
>>
>> In the old days before IUCV or VMCF I did a multi-process application on
>> VM by using a file to pass data among processes. Surprisingly, it worked
>> well.
> 
> Burroughs had both a synchronous 'core2core' interface between processes
> as well as asynchronous storage queues. In the days of small address spaces,
> those were invaluable interfaces.

It took IBM a little longer for this, but eventually they got there.
Re: “The end of software secrecy is almost upon
#419
Author: boltar
Date: Mon, 26 Oct 2026 16:16
33 lines
2537 bytes
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)

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.
Re: Re: what's a process, was The end of software secrecy is almost
#420
Author: boltar
Date: Mon, 26 Oct 2026 16:19
34 lines
2740 bytes
On Mon, 26 Oct 2026 03:53:45 -0700
Peter Flass <Peter@Iron-Spring.com> gabbled:
>On 10/26/26 02:57, boltar@caprica.universe wrote:
>> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
>> John Levine <johnl@taugh.com> gabbled:
>>> According to  <boltar@caprica.universe>:
>>>>> 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.
>>>
>>> Copy-on-write (or on some older systems copy-on-touch) is an implementation
>>> detail.  Neither process can look inside the other even if they share some
>>> unwritten or untouched pages.
>> 
>> The point is they are sharing memory. In a reference implementation processes
>
>> don't share any virtual memory at all - everything is copied to a new
>location
>> at fork - so you can't use sharing memory as a way to demarcate
>multithreading
>> and multiprocess.
>
>In the old days before IUCV or VMCF I did a multi-process application on 
>VM by using a file to pass data among processes. Surprisingly, it worked 
>well.

I'd be interested how you'd implement fork() using that method given you
need to copy the state of all file descriptors, heap, stack and global 
memory, current working directory, enviroment variables and a ton of other
things I can't remember without googling.
Re: “The end of software secrecy is almost upon
#422
Author: Dan Cross
Date: Mon, 26 Oct 2026 16:58
14 lines
1531 bytes
In article <11bnlrn$ghl$1@panix2.panix.com>,
Scott Dorsey <kludge@panix.com> wrote:
>In article <11bn80e$11hkj$1@dont-email.me>,  <boltar@caprica.universe> wrote:
>>Oh please, try a bit harder. You can do anything you want in ring 0 assembler,
>>that doesn't mean its a good idea.
>
>As someone who is spending his morning writing 8051 code, I think it can be
>a very very good idea.

The irony is that, by definition, if you are running something
in userspace, it's not in "Ring 0" anyway.

	- Dan C.
Re: what's a process, was The end of software secrecy is almost
#421
Author: Peter Flass
Date: Mon, 26 Oct 2026 18:46
41 lines
3238 bytes
On 10/26/26 09:19, boltar@caprica.universe wrote:
> On Mon, 26 Oct 2026 03:53:45 -0700
> Peter Flass <Peter@Iron-Spring.com> gabbled:
>> On 10/26/26 02:57, boltar@caprica.universe wrote:
>>> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
>>> John Levine <johnl@taugh.com> gabbled:
>>>> According to  <boltar@caprica.universe>:
>>>>>> 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.
>>>>
>>>> Copy-on-write (or on some older systems copy-on-touch) is an 
>>>> implementation
>>>> detail.  Neither process can look inside the other even if they 
>>>> share some
>>>> unwritten or untouched pages.
>>>
>>> The point is they are sharing memory. In a reference implementation 
>>> processes
>>
>>> don't share any virtual memory at all - everything is copied to a new
>> location
>>> at fork - so you can't use sharing memory as a way to demarcate
>> multithreading
>>> and multiprocess.
>>
>> In the old days before IUCV or VMCF I did a multi-process application 
>> on VM by using a file to pass data among processes. Surprisingly, it 
>> worked well.
> 
> I'd be interested how you'd implement fork() using that method given you
> need to copy the state of all file descriptors, heap, stack and global 
> memory, current working directory, enviroment variables and a ton of other
> things I can't remember without googling.

No fork. Each VM had a single thread of execution. I was happy to get 
multiple processes to cooperate. It was a master process (virtual 
machine) that distributed work to worker machines.
Re: “The end of software secrecy is almost upon
#423
Author: Blaine
Date: Mon, 26 Oct 2026 19:10
26 lines
2546 bytes
boltar@caprica.universe wrote:
> 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?
> 
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.

-- 
Can you strip away so we may start again?
"There’s a switch and they don't
seem authentic or themselves. It
feels like I’m an unnecessary
body and it’s a waste of time to
even be there." -- Grim, playful Blaine.
Re: “The end of software secrecy is almost upon
#424
Author: Scott Dorsey
Date: Mon, 26 Oct 2026 19:32
19 lines
1638 bytes
Dan Cross <cross@spitfire.i.gajendra.net> wrote:
>In article <11bnlrn$ghl$1@panix2.panix.com>,
>Scott Dorsey <kludge@panix.com> wrote:
>>In article <11bn80e$11hkj$1@dont-email.me>,  <boltar@caprica.universe> wrote:
>>>Oh please, try a bit harder. You can do anything you want in ring 0 assembler,
>>>that doesn't mean its a good idea.
>>
>>As someone who is spending his morning writing 8051 code, I think it can be
>>a very very good idea.
>
>The irony is that, by definition, if you are running something
>in userspace, it's not in "Ring 0" anyway.

On the 8051 there is only one ring.  It is like Middle Earth in that regard.
It does have an atomic test and set instruction, though, which is more than
I can say for some machines.
--scott
-- 
"C'est un Nagra. C'est suisse, et tres, tres precis."
Re: “The end of software secrecy is almost upon
#425
Author: Titus G
Date: Mon, 26 Oct 2026 19:43
8 lines
1805 bytes
On 27/10/2026 08:10, Blaine wrote:

> 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.

What a laugh. You are the clown replying to Starmaker.

Re: “The end of software secrecy is almost upon
#427
Author: Michael S
Date: Mon, 26 Oct 2026 19:45
54 lines
3449 bytes
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.
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.





Re: “The end of software secrecy is almost upon
#428
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:03
44 lines
3312 bytes
On 10/26/2026 3:01 AM, 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.

Afaict, its not useless.

> 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.
Re: “The end of software secrecy is almost upon
#426
Author: Michael S
Date: Mon, 26 Oct 2026 20:04
49 lines
3254 bytes
On Mon, 26 Oct 2026 09:51:51 -0000 (UTC)
boltar@caprica.universe wrote:

> On Sun, 25 Oct 2026 17:14:18 -0000 (UTC)
> cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
> >In article <11blaui$2q6vd$1@dont-email.me>,
> ><boltar@caprica.universe> wrote:  
> >>anyway. Whoops, didn't
> >>turn out quite how you expected did it?  
> >
> >Actually, it "turned out" juat about exactly as I expected it
> >would.  
> 
> You have low expectations then.
> 
> >>Oh dear, you really have no clue!  
> >
> >You're snotty little attitude aside, I note that you can't even  
> 
> Anyone who equates system() with multiprocess programming doesn't
> know wtf they're talking about. Hows that for a snotty aside?
> 
> >arriculate what, exactly, it is that you want.  "Argument by
> >insult" seems about par for the course here, but using that to
> >hide your ignorance both doesn't work and makes you look
> >incredbily insecure.
> >
> >Anyway, go ahead and keep flailing.  Ta!  
> 
> Go ahead and remain clueless.
> 


system() can do most of the same things as spawn() family.
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?" 
Sometimes the answer is "because functionality is not available
otherwise". 
But more often functonality is available in native OS API. Not just
that, typically functionality of native APIs is better than one of
standard language library.
So, what is the other reason? It is portability at source level + "learn
once use everywhere".
Here system() fails. That is, the function is the same everywhere, but
string argument is OS-dependent. So, system() may be achieves
functionality, but does not really help portability.

Re: “The end of software secrecy is almost upon
#429
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:05
35 lines
3168 bytes
On 10/26/2026 2:59 AM, boltar@caprica.universe wrote:
> 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.
> 

3 level locking? What do you mean?
Re: “The end of software secrecy is almost upon
#432
Author: Michael S
Date: Mon, 26 Oct 2026 20:09
45 lines
3292 bytes
On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)
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.





Re: “The end of software secrecy is almost upon
#431
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:12
241 lines
7877 bytes
On 10/26/2026 12:45 PM, Michael S wrote:
> 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.
> 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.
Still don't really know what he means by 3 level locking. Using lock 
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.

(google groups wrt usenet seems to be back up now)
https://groups.google.com/g/comp.lang.c++/c/sV4WC_cBb9Q/m/SkSqpSxGCAAJ

some of my old relacy code:

#include <relacy/relacy.hpp>
#include <cstdio>
#include <cstddef>
#include <cstdlib>
#include <string>
#include <vector>

#if ! defined (NDEBUG)
#   define CT_DBG_PRINTF(e) std::printf e
#else
#   define CT_DBG_PRINTF(e) ((void)0)
#endif


#define CT_THREADS (5)
#define CT_MUTEX_TABLE_N (64)


struct ct_mutex_table
{
     rl::mutex m_mutexs[CT_MUTEX_TABLE_N];

     std::size_t
     hash_ptr(
         void* p
     ) const {
         return rl::hash_ptr(p, CT_MUTEX_TABLE_N);
     }
};


struct ct_thread_mutex_hash
{
     std::vector<std::size_t> m_hashed_idxs;

     // must be before any locks!
     void finalize()
     {
         std::sort(
             m_hashed_idxs.begin(),
             m_hashed_idxs.end());

         m_hashed_idxs.erase(
             std::unique(
                 m_hashed_idxs.begin(),
                 m_hashed_idxs.end()),
             m_hashed_idxs.end());
     }


     // BEFORE WE CALL, WE NEED TO sort and dedup before this.
     void
     lock(
         ct_mutex_table& mutex_table
     ) {
         for (auto& mtx_idx : m_hashed_idxs)
         {
             rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx];
             mtx.lock($);
         }
     }

     // does not really even need to be reversed...
     void
     unlock(
         ct_mutex_table& mutex_table
     ) {
         for (auto& mtx_idx : m_hashed_idxs)
         {
             rl::mutex& mtx = mutex_table.m_mutexs[mtx_idx];
             mtx.unlock($);
         }
     }
};


struct ct_state
{
     ct_mutex_table m_mutex_table;
     VAR_T(int) m_var_0 = 0;
     VAR_T(int) m_var_1 = 1;
     VAR_T(int) m_var_2 = 2;


     void worker_thread_a()
     {
         ct_thread_mutex_hash self_hash;

         self_hash.m_hashed_idxs.push_back(
             m_mutex_table.hash_ptr(&m_var_0));

         self_hash.m_hashed_idxs.push_back(
             m_mutex_table.hash_ptr(&m_var_1));

         self_hash.finalize();

         self_hash.lock(m_mutex_table);

         VAR(m_var_0) = 42;
         VAR(m_var_1) = 128;

         self_hash.unlock(m_mutex_table);
     }

     void worker_thread_b()
     {
         ct_thread_mutex_hash self_hash;

         // Seed!
         {
             self_hash.m_hashed_idxs.push_back(
                 m_mutex_table.hash_ptr(&m_var_1));

             self_hash.m_hashed_idxs.push_back(
                 m_mutex_table.hash_ptr(&m_var_0));
         }


         // Okay... Finalize it...
         {
             self_hash.finalize();
         }


         // Finally, we can lock the bastard!
         {
             self_hash.lock(m_mutex_table);

             {
                 VAR(m_var_0) = 99;
                 VAR(m_var_1) = 77;
             }

             self_hash.unlock(m_mutex_table);
         }
     }
};


struct ct_multex_relacy_test_v000
     : rl::test_suite<ct_multex_relacy_test_v000, CT_THREADS>
{
     ct_state m_state = { };

     void before()
     {
         // not sure to init m_state here. Is it already init?
     }

     void
     thread(
         unsigned tidx
     ) {
         if (tidx == 0)
             m_state.worker_thread_a();
         else
             m_state.worker_thread_b();
     }
};


int main(int argc, char** argv)
{
     {
         rl::test_params p;

         p.iteration_count = argc > 1 ? (unsigned)atoi(argv[1]) : 100000;
         p.execution_depth_limit = 100000;

         if (argc > 2) {
             std::string m = argv[2];
             if (m == "full") p.search_type = rl::sched_full;
             else if (m == "bound") { p.search_type = rl::sched_bound; 
p.context_bound = argc > 3 ? atoi(argv[3]) : 2; }
         }

         rl::simulate<ct_multex_relacy_test_v000>(p);
     }

     return 0;
}

Re: what's a process, was The end of software secrecy is almost
#430
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:19
40 lines
3108 bytes
On 10/26/2026 9:19 AM, boltar@caprica.universe wrote:
> On Mon, 26 Oct 2026 03:53:45 -0700
> Peter Flass <Peter@Iron-Spring.com> gabbled:
>> On 10/26/26 02:57, boltar@caprica.universe wrote:
>>> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
>>> John Levine <johnl@taugh.com> gabbled:
>>>> According to  <boltar@caprica.universe>:
>>>>>> 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.
>>>>
>>>> Copy-on-write (or on some older systems copy-on-touch) is an 
>>>> implementation
>>>> detail.  Neither process can look inside the other even if they 
>>>> share some
>>>> unwritten or untouched pages.
>>>
>>> The point is they are sharing memory. In a reference implementation 
>>> processes
>>
>>> don't share any virtual memory at all - everything is copied to a new
>> location
>>> at fork - so you can't use sharing memory as a way to demarcate
>> multithreading
>>> and multiprocess.
>>
>> In the old days before IUCV or VMCF I did a multi-process application 
>> on VM by using a file to pass data among processes. Surprisingly, it 
>> worked well.
> 
> I'd be interested how you'd implement fork() using that method given you
> need to copy the state of all file descriptors, heap, stack and global 
> memory, current working directory, enviroment variables and a ton of other
> things I can't remember without googling.
> 

Why even do that? Sigh.
Re: what's a process, was The end of software secrecy is almost
#433
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:19
45 lines
3413 bytes
On 10/26/2026 11:46 AM, Peter Flass wrote:
> On 10/26/26 09:19, boltar@caprica.universe wrote:
>> On Mon, 26 Oct 2026 03:53:45 -0700
>> Peter Flass <Peter@Iron-Spring.com> gabbled:
>>> On 10/26/26 02:57, boltar@caprica.universe wrote:
>>>> On Sun, 25 Oct 2026 18:17:44 -0000 (UTC)
>>>> John Levine <johnl@taugh.com> gabbled:
>>>>> According to  <boltar@caprica.universe>:
>>>>>>> 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.
>>>>>
>>>>> Copy-on-write (or on some older systems copy-on-touch) is an 
>>>>> implementation
>>>>> detail.  Neither process can look inside the other even if they 
>>>>> share some
>>>>> unwritten or untouched pages.
>>>>
>>>> The point is they are sharing memory. In a reference implementation 
>>>> processes
>>>
>>>> don't share any virtual memory at all - everything is copied to a new
>>> location
>>>> at fork - so you can't use sharing memory as a way to demarcate
>>> multithreading
>>>> and multiprocess.
>>>
>>> In the old days before IUCV or VMCF I did a multi-process application 
>>> on VM by using a file to pass data among processes. Surprisingly, it 
>>> worked well.
>>
>> I'd be interested how you'd implement fork() using that method given you
>> need to copy the state of all file descriptors, heap, stack and global 
>> memory, current working directory, enviroment variables and a ton of 
>> other
>> things I can't remember without googling.
> 
> No fork. Each VM had a single thread of execution. I was happy to get 
> multiple processes to cooperate. It was a master process (virtual 
> machine) that distributed work to worker machines.

That works well.
Re: “The end of software secrecy is almost upon
#434
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:20
18 lines
2250 bytes
On 10/26/2026 3:02 AM, boltar@caprica.universe wrote:
> 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?
> 

My point is that you seem to be daft on these issues. Are you trolling?
Re: “The end of software secrecy is almost upon
#435
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:23
21 lines
3255 bytes
On 10/25/2026 8:43 PM, Lawrence D’Oliveiro wrote:
> 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 don’t 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.

If you need dynamic memory fine. If a lib allocates things for itself, 
fine. Just make sure to know how to clean it up. Also, the caller can 
use dynamic memory if it wants to. RAII is pretty nice here.
Re: “The end of software secrecy is almost upon
#436
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:26
13 lines
2629 bytes
On 10/25/2026 8:39 PM, Lawrence D’Oliveiro 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 isn’t. It’s 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.
> 
> That’s a dumb way to design things.

HUH? How do you call say, fread without a user provided buffer?
Re: “The end of software secrecy is almost upon
#438
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:29
10 lines
2423 bytes
On 10/25/2026 8:40 PM, Lawrence D’Oliveiro wrote:
> On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
> 
>> Managing the memory is the caller’s 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?
Re: “The end of software secrecy is almost upon
#437
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:33
14 lines
2620 bytes
On 10/26/2026 1:29 PM, Chris M. Thomasson wrote:
> On 10/25/2026 8:40 PM, Lawrence D’Oliveiro wrote:
>> On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
>>
>>> Managing the memory is the caller’s 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?
Re: “The end of software secrecy is almost upon
#439
Author: Michael S
Date: Mon, 26 Oct 2026 20:40
68 lines
4247 bytes
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)
> > 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.  
> Still don't really know what he means by 3 level locking. Using lock 
> 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.





Re: “The end of software secrecy is almost upon
#440
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 20:44
66 lines
4425 bytes
On 10/26/2026 1:40 PM, Michael S wrote:
> 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)
>>> 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.
>> Still don't really know what he means by 3 level locking. Using lock
>> 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.

Ahhh! I call that a read/write mutex. Okay.
Re: “The end of software secrecy is almost upon
#441
Author: David Brown
Date: Mon, 26 Oct 2026 21:29
16 lines
2707 bytes
On 26/10/2026 21:29, Chris M. Thomasson wrote:
> On 10/25/2026 8:40 PM, Lawrence D’Oliveiro wrote:
>> On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
>>
>>> Managing the memory is the caller’s 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.  The caller is responsible for /managing/ the memory (or it can 
pass on that responsibility to something else).  malloc and free are 
provide and dispose of memory, they do not manage it.
Re: “The end of software secrecy is almost upon
#442
Author: Lawrence D’Oliveiro
Date: Mon, 26 Oct 2026 21:45
7 lines
2320 bytes
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?
Re: “The end of software secrecy is almost upon
#444
Author: Lawrence D’Oliveiro
Date: Mon, 26 Oct 2026 21:45
5 lines
2158 bytes
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?
Re: “The end of software secrecy is almost upon
#443
Author: Lawrence D’Oliveiro
Date: Mon, 26 Oct 2026 21:46
6 lines
2383 bytes
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??
Re: “The end of software secrecy is almost upon
#445
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 21:47
9 lines
2471 bytes
On 10/26/2026 2:45 PM, Lawrence D’Oliveiro wrote:
> 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?

Ummm... What we were talking about. You snipped a lot. See, the caller 
needs to have the buffer in order to call fread, right?
Re: “The end of software secrecy is almost upon
#447
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 21:51
19 lines
2858 bytes
On 10/26/2026 2:46 PM, Lawrence D’Oliveiro wrote:
> 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??

Why do you "seem" to think we "always" need dynamic memory? Then you ask 
this gem:
__________
Does that apply to the caller of library APIs like malloc(3) and
free(3)?
__________

See, the caller is responsible for managing things. Say foo_create that 
succeeds. Well, now the caller must call foo_destroy.

Re: “The end of software secrecy is almost upon
#446
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 21:53
12 lines
2721 bytes
On 10/26/2026 2:45 PM, Lawrence D’Oliveiro 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? I said some libs allow the caller to create their 
internal state. You are the one that seems to not understand it? Either 
way, the caller needs to manage things in C. malloc/free, etc.
Re: “The end of software secrecy is almost upon
#448
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 21:58
24 lines
3156 bytes
On 10/26/2026 2:29 PM, David Brown wrote:
> On 26/10/2026 21:29, Chris M. Thomasson wrote:
>> On 10/25/2026 8:40 PM, Lawrence D’Oliveiro wrote:
>>> On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
>>>
>>>> Managing the memory is the caller’s 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.  The caller is responsible for /managing/ the memory (or it can 
> pass on that responsibility to something else).  malloc and free are 
> provide and dispose of memory, they do not manage it.
> 

Right. For instance take my ralloc thing. A user can create a big pile 
of memory, have rallocex carve it up for them (align, etc), and use it. 
But, the user needs to know how to free that memory. If its on the 
stack, well, easy. If not call free, or whatever it needs.

ralloc does not give a crap where the memory came from.
Re: “The end of software secrecy is almost upon us”
#449
Author: Lawrence D’Oliveiro
Date: Mon, 26 Oct 2026 21:59
22 lines
2558 bytes
On Mon, 26 Oct 2026 13:03:25 -0700, Chris M. Thomasson wrote:

> Shared state? Just use memory mapped files. You don't need
> pipes/sockets etc. You need to know how to properly sync things.

Like it or not, the Unix-type model is the closest we have to a
standard set of OS APIs. It’s the only one that starts from an
official spec, namely POSIX.

At one point, Sun did spearhead a campaign to standardize Microsoft
Windows, believe it or not
<https://www.youtube.com/watch?v=H5v0CK249rI> -- but of course
Microsoft successfully stymied that effort.

And as a result of all that past market strategizing, nowadays we have
a multi-decade-long accumulation of Free software that assumes that
basic Unix-type set of APIs, and nothing else is able to come close.
So that is what we expect to have when we start new projects or keep
existing ones going, because nobody wants to reinvent the wheel when
they can build on all the high-quality work that has gone before.

Like it or not, the Unix model has conquered the world.
Re: “The end of software secrecy is almost upon
#450
Author: Lynn McGuire
Date: Mon, 26 Oct 2026 22:08
63 lines
3948 bytes
On 10/23/2026 11:06 AM, Peter Flass wrote:
> 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>,  <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.  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.  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.

https://www.joelonsoftware.com/2006/06/16/my-first-billg-review/

"Then I sat down to write the Excel Basic spec, a huge document that 
grew to hundreds of pages. I think it was 500 pages by the time it was 
done. (“Waterfall,” you snicker; yeah yeah shut up.)"

"In my BillG review meeting, the whole reporting hierarchy was there, 
along with their cousins, sisters, and aunts, and a person who came 
along from my team whose whole job during the meeting was to keep an 
accurate count of how many times Bill said the F word. The lower the 
f***-count, the better."

"… and THERE WERE NOTES IN ALL THE MARGINS. ON EVERY PAGE OF THE SPEC. 
HE HAD READ THE WHOLE GODDAMNED THING AND WRITTEN NOTES IN THE MARGINS."

He Read The Whole Thing! [OMG SQUEEE!]

I turned down an unsolicited job at Microsoft in 1987.  In retrospect, 
it may have been a bad decision.  Then again, BillG seems to be a crazy 
overseer from the latest reports.

Lynn
Re: “The end of software secrecy is almost upon
#451
Author: Lawrence D’Oliveiro
Date: Mon, 26 Oct 2026 22:20
18 lines
2817 bytes
On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:

> On 10/26/2026 2:45 PM, Lawrence D’Oliveiro 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 “Managing the memory is the caller’s job in C anyway.” You
didn’t say “could be the caller’s job” as in “the caller could have a
choice”, you said “*is* the caller’s job”. No choice. I.e. the caller
*must* manage memory.
Re: “The end of software secrecy is almost upon
#452
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 22:42
30 lines
3554 bytes
On 10/26/2026 3:20 PM, Lawrence D’Oliveiro wrote:
> On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:
> 
>> On 10/26/2026 2:45 PM, Lawrence D’Oliveiro 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 “Managing the memory is the caller’s job in C anyway.” You
> didn’t say “could be the caller’s job” as in “the caller could have a
> choice”, you said “*is* the caller’s job”. No choice. I.e. the caller
> *must* manage memory.

But, the caller must take care in C. Say a lib that allows the caller to 
create their own memory from the requirements reaped from the lib. Okay. 
Fine. Also, take a lib that is more "encapsulated" than say a pure 
foo_create/destroy. The caller must remember to call foo_destroy, right?

Using io_uring is a fun one. The caller created the memory, iirc from 
mmap, so the kernel can use it. The Kernel punts off the lifetime 
management of the users ring buffers.

The C must manage things regardless. say malloc and free?
Re: “The end of software secrecy is almost upon
#453
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 22:46
9 lines
2367 bytes
On 10/25/2026 8:40 PM, Lawrence D’Oliveiro wrote:
> On Sun, 25 Oct 2026 19:21:00 -0700, Chris M. Thomasson wrote:
> 
>> Managing the memory is the caller’s job in C anyway.
> 
> Does that apply to the caller of library APIs like malloc(3) and
> free(3)?

you should print that out and frame it.
Re: “The end of software secrecy is almost upon
#454
Author: Chris M. Thomasson
Date: Mon, 26 Oct 2026 23:06
36 lines
3534 bytes
On 10/26/2026 3:20 PM, Lawrence D’Oliveiro wrote:
> On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote:
> 
>> On 10/26/2026 2:45 PM, Lawrence D’Oliveiro 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 “Managing the memory is the caller’s job in C anyway.” You
> didn’t say “could be the caller’s job” as in “the caller could have a
> choice”, you said “*is* the caller’s job”. No choice. I.e. the caller
> *must* manage memory.

A simple pattern... Now, some libs can do it others are simply not 
designed that way.


foo_alloc_req r = foo_query_alloc(&cfg);
void *mem = aligned_alloc(r.align, r.size);      /* once */

for (int i = 0; i < n_jobs; ++i) {
     foo *f = foo_init(mem, r.size, &cfg);        /* build in the same 
block */
     /* ... use f ... */
     foo_deinit(f);                               /* object ends, block 
stays ours */
}

free(mem);                                       /* once, at the very end */
Re: what's a process, was The end of software secrecy is almost upon
#455
Author: Lynn Wheeler
Date: Mon, 26 Oct 2026 23:36
46 lines
3927 bytes
Peter Flass <Peter@Iron-Spring.com> writes:
> In the old days before IUCV or VMCF I did a multi-process application
> on VM by using a file to pass data among processes. Surprisingly, it
> worked well.

Some of the MIT CTSS/7094 people went to the 5th flr for Multics (which
spawns unix). Others went to the 4th flr for IBM Cambridge Scientific
Center and did virtual machines (originally wanted 360/50 to hardware
mods adding virtual memory, but all the spare ones were going to FAA ATC
effort, so they had to settle for 360/40 and did CP40/CMS, which morphs
into CP67/CMS when 360/67 standard with virtual memory becomes
available), science center wide-area network which mophs into the
internal corporate network RSCS/VNET (larger than arpanet/internet from
the beginning until sometime mid/late 80s about the time it was force to
convert to SNA/VTAM), performance and online apps (including email, ctss
runoff became "script", invented GML in 1969 and GML tags added to
script), etc.

SPM was done by IBM Pisa Scientific Center for CP/67. In the decision to
add virtual memory to all 370s, some of the CSC people went to 3rd flr
taking over the IBM Boston Programming Center for the vm370 development
group, in the morph of CP67->VM370 lots of stuff was simplified and/or
dropped. When I joined IBM, one of my hobbies was enhanced production
operating systems for internal datacenters. For VM370R2-base, I started
adding lots of stuff back in for my CSC/VM (and it included SPM)

Then for VM370R3-base CSC/VM, I added lot more stuff back in, including
multiprocessor support. The development group had introduced VMCF in
VM370R3. Then the head of POK (high-end 370s) had convinced corporate to
kill VM370, shutdown the development group and transfer all the people
to POK for MVS/XA. Endicott (mid-range 370s) was able to acquire the
VM370 product mission but had to recreate a development group from
scratch. For VM370, Endicott introduces IUCV and SMSG.

However, one of the issues was that SPM (from CP67) was a superset of
VMCF, IUCV, and SMSG.

trivia: The REXX author did a multi-user, client/server, SPM-based
spacewar game and since RSCS/VNET had full SPM support, clients weren't
limited to the same physical machine as the server (anywhere on internal
network). note: almost immediately robot clients appeared beating all
human clients. the server then was tweaked to increase power use
non-linear as client responses dropped below human threasholds.

-- 
virtualization experience starting Jan1968, online at home since Mar1970
Threads and processes (Re: “The end of software secrecy is almost upon)
#456
Author: Lars Poulsen
Date: Tue, 27 Oct 2026 02:14
42 lines
3574 bytes
On 10/22/2026 07:50, boltar@battlestar.co.uk wrote:
> On Wed, 21 Oct 2026 19:01:38 -0000 (UTC)
> cross@spitfire.i.gajendra.net (Dan Cross) wrote:
>> In article <11bb1da$qfn9$1@dont-email.me>,  <boltar@battlestar.co.uk> wrote:
>>> Not sure why you think its conspiracy anything. I use the language on a
>>> daily basis and everytime a new version comes out I hope they've added
>>> something useful but since 2014 its been a law of diminishing returns.
>>> Plus there's unexplained omissions - eg threads have been part of the core
>>> language since 2011. Great, but what about processes? When do we get them?
>>> Sure, I could just use fork() but then I could also just use pthread_create()
>>> too.
>>
>> One can implement a pretty reasonable threads library given the
>> virtual machine model of standard C or C++.  Processes?  With
> 
> Virtual machine? Wrong language , comp.lang.java is that way --->
> 
>> their own address spaces, credentials, resource limits, IPC
>> mechanisms, potentially running different programs, and so on?
>>
>> Not so much.  You need an operating system for that, son.
> 
> You need an OS to do threading properly too. Theres a reason green threads
> in java were a joke.
Processes are almost self-contained virtual machines. Unix has one of 
the cleanest implementations around, and the fork() system call combined 
with copy-on-write is very elegant. None of the other operating system I 
have worked with have anything remotely like it. VMS was also quite 
elegant, but so different that I think it would be impossible to 
simulate one on the other (in either direction).

Threads are much simpler. Multiple strands of execution in a shared 
address space. All the language needs to do is provide one shared 
vocabulary to allow code portability.

To me it is obvious that threads can and should be standardized, while 
processes are generally not portable.

But if you hotheads can't agree on that, can you please now agree to 
disagree and shut up!
-- 
Lars Poulsen - an old geek in Santa Barbara, California
Re: “The end of software secrecy is almost upon
#457
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 02:20
34 lines
2930 bytes
On 10/25/2026 8:56 AM, Scott Lurndal wrote:
> 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.

POSIC, bow down, even way before C11. It still can be used, and is very 
nice.
Re: “The end of software secrecy is almost upon
#458
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 02:29
79 lines
4950 bytes
On 10/24/2026 3:43 AM, David Brown wrote:
> 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 D’Oliveiro wrote:
>>>> On Thu, 22 Oct 2026 22:29:45 -0700, Chris M. Thomasson wrote:
>>>>
>>>>> On 10/22/2026 8:19 PM, Lawrence D’Oliveiro 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 you’re 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?
>>>>
>>>> I’m assuming that all that BASIC programming hasn’t got to your head,
>>>> and you’re 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 :
>>>
>>>      typedef struct data_struct { int a; int xs[20]; } S ;
>>>
>>>      S build_some_data(void) {
>>>          S s;
>>>
>>>          s.a = 123;
>>>          for (int i = 0; i < 20; i++) s.xs[i] = i;
>>>
>>>          return s;
>>>      }
>>>
>>>      void foo() {
>>>          S s = build_some_data();
>>>      }
>>>
>>>
>>> then it is typically handled as though you had written :
>>>
>>>      void build_some_data(S * p) {
>>>          p->a = 123;
>>>          for (int i = 0; i < 20; i++) p->xs[i] = i;
>>>
>>>          return;
>>>      }
>>>
>>>      void foo() {
>>>          S s;
>>>          build_some_data(&s);
>>>      }
>>>
>>>
>>> That is - the caller creates the /space/ for the returned object, but 
>>> does not do any kind of initialisation.  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.  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.  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.
> 

Use when the API provides it, or else, well, read the api learn and know 
how to use it. If it allows the caller to make the memory it needs, so 
be it, if not, who cares?
Re: “The end of software secrecy is almost upon us”
#460
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 02:43
53 lines
4065 bytes
On 10/24/2026 2:38 PM, Charlie Gibbs wrote:
> On 2026-10-24, Chris M. Thomasson <chris.m.thomasson.1@gmail.com> wrote:
> 
>> On 10/23/2026 8:44 PM, Lawrence D’Oliveiro wrote:
>>
>>> On Fri, 23 Oct 2026 23:31:41 GMT, Charlie Gibbs wrote:
>>>
>>>> On 2026-10-23, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
>>>>
>>>>> What was that error message? I was expecting something like “DISK
>>>>> ERROR” or “I/O ERROR”. Instead, it said
>>>>>
>>>>>       I’m having trouble with the disk.
>>>>>
>>>>> The idea of an error message phrased in plain, approachable
>>>>> language (using a first-person pronoun, even) instead of technical
>>>>> terms?? That was a revelation.
>>>>
>>>> Unfortunately it's not the kind of revelation I welcome. Back in my
>>>> mainframe days, I learned to hate catch-all error messages; they're
>>>> the sign of a programmer who's too lazy to try to help the user. If
>>>> something goes wrong, I want to be given some clues as to where to
>>>> look. But more and more these days, your typical error message is
>>>> "Something went wrong." Nothing more. This kind of conduct should be
>>>> condemned.
>>>
>>> This was not like that though, was it? On systems of that era, you
>>> would typically get something like “DISK ERROR” or “I/O ERROR”. The
>>> plain-language message was no less specific than that.
>>>
>>> Do you want more detail about what went wrong? Perhaps a CRC
>>> validation failure? Sector-addressing failure? Missing address/data
>>> marks? Invalid GCR/RLL encoding?
>>>
>>> That kind of low-level detail might be helpful to somebody (perhaps a
>>> hardware engineer) trying to fix the problem. And perhaps it should
>>> appear in a system log somewhere.
>>>
>>> And it wouldn’t have mattered much in this case, anyway, since it
>>> would have been obvious to anybody‡ sitting or standing in front of the
>>> machine, that the most likely cause was the fact that there was no
>>> disk in the drive.
>>>
>>> ‡Anybody who had made much use of floppy disks on micros, anyway.
>>
>> Iirc, BASIC had a fun error. I cannot remember the damn exact phrase, it
>> was something like expression too complex or something.
> 
> "Who is General Failure and why is he reading my disk?"
> 

:^() Basically. The BASIC was about too complex, and it was a little odd 
to me.
Re: “The end of software secrecy is almost upon us”
#461
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 02:51
5 lines
2193 bytes
On 10/23/2026 8:39 PM, Lawrence D’Oliveiro wrote:
[...]

I was in the linux world for a whiel, along with solaris, etc. But 
Windows, oh my. vcpkg is a big turn.
Re: “The end of software secrecy is almost upon
#459
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 02:57
9 lines
2570 bytes
On 10/24/2026 3:32 PM, Lawrence D’Oliveiro wrote:
> On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:
> 
>> Or what about miniaudio’s ma_engine_get_heap_size plus
>> ma_engine_init_preallocated
> 
> No idea about that, but the same principle would apply.

You sound like you never worked with any of it before?????
Re: “The end of software secrecy is almost upon
#462
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 03:09
11 lines
2607 bytes
On 10/24/2026 3:32 PM, Lawrence D’Oliveiro wrote:
> On Sat, 24 Oct 2026 13:27:30 -0700, Chris M. Thomasson wrote:
> 
>> Or what about miniaudio’s ma_engine_get_heap_size plus
>> ma_engine_init_preallocated
> 
> No idea about that, but the same principle would apply.

Sure you do, or what are you writing about anyway? Really?

You seem like the oracle, right?
Re: “The end of software secrecy is almost upon
#463
Author: Chris M. Thomasson
Date: Tue, 27 Oct 2026 03:16
41 lines
3449 bytes
On 10/26/2026 1:09 PM, Michael S wrote:
> On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)
> 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.
Seems so! Damn it.
Page 8 of 11 • 529 total messages
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads