🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.folklore.computers
533 messages
533 total messages Page 9 of 11 Started by Johann 'Myrkraverk' Oskarsson Wed, 14 Oct 2026 11:59
Page 9 of 11 • 533 total messages
Re: “The end of software secrecy is almost upon
#403
Author: boltar
Date: Wed, 28 Oct 2026 09:06
25 lines
2371 bytes
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".

Re: “The end of software secrecy is almost upon
#402
Author: boltar
Date: Wed, 28 Oct 2026 09:08
18 lines
2202 bytes
On Mon, 26 Oct 2026 22:09:01 +0200
Michael S <already5chosen@yahoo.com> gabbled:
>On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)
>boltar@caprica.universe wrote:
>> 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.

OK, whats the windows API call thats the equivalent of fork()? I'm not
talking about CreateProcessA() which doesn't even come close.
Re: “The end of software secrecy is almost upon
#404
Author: Blaine
Date: Wed, 28 Oct 2026 14:39
32 lines
2856 bytes
boltar@caprica.universe wrote:
> On Mon, 26 Oct 2026 13:10:46 -0600
> Blaine <cactus_DAC@yahoo.com> gabbled:
>> 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.
> 
> Thats your problem, not mine.
> 
I'm sorry you are unable to do a better job. Oh well, you just suck and 
can't do any better, so it's on me.

-- 
Sometimes I just feel like I need to get away
A place where I can be by myself, all alone
I kinda lay down in the back yard
Watch the leaves fall down on my face
Re: “The end of software secrecy is almost upon
#405
Author: Blaine
Date: Wed, 28 Oct 2026 15:47
36 lines
3181 bytes
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.
> 
Innocent like a lamb for me.
Just make a call to malloc() and probe the GarbageCollector. You've got 
it all wrong, stupid.

-- 
Sometimes I just feel like I need to get away
A place where I can be by myself, all alone
I kinda lay down in the back yard
Watch the leaves fall down on my face
Re: “The end of software secrecy is almost upon
#407
Author: Michael S
Date: Wed, 28 Oct 2026 19:47
56 lines
3528 bytes
On Wed, 28 Oct 2026 09:06:47 -0000 (UTC)
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. 

Actually, if you are creative enough you can do most of the
above-mentioned things. Of course, what you can and what you can't do
depends on capabilities of your default shell.
And of course the way by which you achieve your goals via system() is
VERY OS-dependent.

> Oh, and it also
> fires up the default shell to do the actual execution making it
> hideously inefficient.

It matters only when the work delegated to sub-process is both brief and
done very often.

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

I can't argue about it. Supposedly, it depends on definition of "serious
unix dev". In my book, serious dev is one who knows to peek
correctly-sized tool to the job rather than one who always uses the
most efficient tool.
But that's is off topic.

Pay attention that I agree with you that system() is not suitable as
The Only standard way of support of multiple processes in C++ standard
library, even if my reasons for that are different from yours.




Re: “The end of software secrecy is almost upon
#406
Author: Michael S
Date: Wed, 28 Oct 2026 20:05
35 lines
3177 bytes
On Wed, 28 Oct 2026 09:08:44 -0000 (UTC)
boltar@caprica.universe wrote:

> On Mon, 26 Oct 2026 22:09:01 +0200
> Michael S <already5chosen@yahoo.com> gabbled:
> >On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)
> >boltar@caprica.universe wrote:  
> >> 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.  
> 
> OK, whats the windows API call thats the equivalent of fork()? I'm not
> talking about CreateProcessA() which doesn't even come close.
> 

There is no equivalent for fork(). But nearly all things that Posix
devs achieve by fork() followed by one or another magic incantation and
then followed by exec() can be achived on Windows as well, typically by
means of one or another magic flag in parameters of CreateProcess or
of one of it's more complicated cousins (CreateProcessAsUser,
CreateProcessWithLogon, CreateProcessWithToken, may be others). These
things never fascinated me, so I am not an expert.

Now, there were cases where Unix programmers used fork() without
following it by exec(), but I would think that in the recent 25-30 years
such programming patterns are discouraged in favor of threads.

Re: “The end of software secrecy is almost upon
#408
Author: Chris M. Thomasson
Date: Wed, 28 Oct 2026 21:04
40 lines
3170 bytes
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-wsaduplicatesocketa

DuplicateHandle

etc...

You can have multiple multi threaded processes on windows. Even ones 
with multiple fibers running on the multiple threads per process.

Re: “The end of software secrecy is almost upon
#409
Author: Chris M. Thomasson
Date: Wed, 28 Oct 2026 21:05
40 lines
3136 bytes
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:
>>>>> 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.
> 

Its simple, if you don't like windows, do use the damn pile.
Re: “The end of software secrecy is almost upon
#410
Author: Chris M. Thomasson
Date: Wed, 28 Oct 2026 21:06
42 lines
3301 bytes
On 10/28/2026 2:05 PM, Chris M. Thomasson wrote:
> 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:
>>>>>> 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.
>>
> 
> Its simple, if you don't like windows, do use the damn pile.

Argh! Damn typos! Don't use the damn pile! :^)
Re: “The end of software secrecy is almost upon
#411
Author: Chris M. Thomasson
Date: Wed, 28 Oct 2026 21:09
29 lines
2799 bytes
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.
Re: “The end of software secrecy is almost upon
#412
Author: Chris M. Thomasson
Date: Wed, 28 Oct 2026 21:16
40 lines
4045 bytes
On 10/27/2026 6:43 PM, Lawrence D’Oliveiro wrote:
> 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.
> 
> That’s just an excuse. Other comments of mine, from further back in
> this particular line of this thread:
> 
> * “What if you’re building an object that needs to be returned to the
>    caller?”
> * “The principle applies to Fortran as it does to any language where
>    you have to explicitly manage storage allocations.”
> * “If you have to do cleanup at each level before exiting, then it works
>    perfectly well.”
> 
> 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?

Its actually pretty simple. There are libs out there that allow the 
caller to create the memory it needs. io_uring is just one of them.

DirectX12 is another. The user creates all the memory, aligns it, etc, 
and can update a single frame with a single memcpy.
Re: “The end of software secrecy is almost upon
#414
Author: Michael S
Date: Wed, 28 Oct 2026 22:06
47 lines
3219 bytes
On Wed, 28 Oct 2026 08:58:55 -0000 (UTC)
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:    
> >> >>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.
> 

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.





Re: “The end of software secrecy is almost upon
#413
Author: boltar
Date: Thu, 29 Oct 2026 16:16
43 lines
3612 bytes
On Wed, 28 Oct 2026 22:05:58 +0200
Michael S <already5chosen@yahoo.com> gabbled:
>On Wed, 28 Oct 2026 09:08:44 -0000 (UTC)
>boltar@caprica.universe wrote:
>
>> On Mon, 26 Oct 2026 22:09:01 +0200
>> Michael S <already5chosen@yahoo.com> gabbled:
>> >On Mon, 26 Oct 2026 10:01:55 -0000 (UTC)
>> >boltar@caprica.universe wrote:  
>> >> 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.  
>> 
>> OK, whats the windows API call thats the equivalent of fork()? I'm not
>> talking about CreateProcessA() which doesn't even come close.
>> 
>
>There is no equivalent for fork(). But nearly all things that Posix
>devs achieve by fork() followed by one or another magic incantation and
>then followed by exec() can be achived on Windows as well, typically by
>means of one or another magic flag in parameters of CreateProcess or
>of one of it's more complicated cousins (CreateProcessAsUser,
>CreateProcessWithLogon, CreateProcessWithToken, may be others). These
>things never fascinated me, so I am not an expert.
>
>Now, there were cases where Unix programmers used fork() without
>following it by exec(), but I would think that in the recent 25-30 years
>such programming patterns are discouraged in favor of threads.

Depends how much resilience you need. If the child process needs the state
of the parent but doesn't need to interact with it or any of the other child
processes much if at all and you're not creating dozens of them a second then 
why would you use a thread with all the associated hassle of critical section 
requirements, deadlocks, potential race conditions and one thread crashing
killing the whole application?
Re: Re: “The end of software secrecy is almost upon
#416
Author: boltar
Date: Thu, 29 Oct 2026 16:19
40 lines
3118 bytes
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.
Re: Re: “The end of software secrecy is almost upon
#417
Author: boltar
Date: Thu, 29 Oct 2026 16:20
38 lines
2886 bytes
On Wed, 28 Oct 2026 14:09:32 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
>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.

Thats true. Its been so long since I used it I'd forgotten about that. Makes
it even less useful.
Re: “The end of software secrecy is almost upon
#415
Author: boltar
Date: Thu, 29 Oct 2026 16:22
18 lines
2277 bytes
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!
Re: “The end of software secrecy is almost upon
#418
Author: Chris M. Thomasson
Date: Thu, 29 Oct 2026 19:49
49 lines
3528 bytes
On 10/29/2026 9:19 AM, boltar@caprica.universe wrote:
> 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.
> 

Do we actually need everything, or just a subset?
Re: “The end of software secrecy is almost upon
#420
Author: Michael S
Date: Thu, 29 Oct 2026 20:39
30 lines
2885 bytes
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.
Re: “The end of software secrecy is almost upon
#419
Author: Michael S
Date: Thu, 29 Oct 2026 21:07
59 lines
3704 bytes
On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
boltar@caprica.universe wrote:

> On Wed, 28 Oct 2026 14:09:32 -0700
> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
> >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.  
> 
> Thats true. Its been so long since I used it I'd forgotten about
> that. Makes it even less useful.
> 

Does it block when your command processor is bash and your command
string is "my_subprocess &"? 
Does it block when your command processor is cmd.exe and your command
string "start my_subprocess" or "start /b my_subprocess"?

I almost certainly tried both in the past, but don't remember what
happens in each case. My expectations are that in both cases
caller blocked only briefly. It is not blocked until the finish
my_subprocess.




Re: “The end of software secrecy is almost upon
#421
Author: Peter Flass
Date: Thu, 29 Oct 2026 22:13
32 lines
3084 bytes
On 10/29/26 13:39, Michael S wrote:
> 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.

Just an old idea from OS/360 MVT circa 1965-66. OS calls them tasks.
Re: “The end of software secrecy is almost upon
#422
Author: Scott Lurndal
Date: Thu, 29 Oct 2026 22:25
51 lines
3317 bytes
Michael S <already5chosen@yahoo.com> writes:
>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.
>

The thread design for SVR4 Unix started in the late 80s and
released in 1993.

Digital published "Evolving the UNIX System Interface to
Support Multithreaded Programs" September 28, 1987.
(Paul R. McJones and Garret F. Swart).

The "The Topaz Operating System User's Guide" in that document
describes the thread interface. (DIGITAL Systems Research
Center operating system) for both VAX/Ultrix and the Firefly/Taos
implementation.

Here's a link to the paper published a couple years later:

https://softwarepreservation.computerhistory.org/modula2+/doc/McJones_Swart-Evolving-1989.pdf

And here's a link to the full technical report #21 (including the manual)

https://ftp.zx.net.nz/pub/archive/gatekeeper.dec.com/pub/DEC/SRC/research-reports/SRC-021.pdf
Re: “The end of software secrecy is almost upon
#423
Author: Scott Lurndal
Date: Thu, 29 Oct 2026 22:26
51 lines
3154 bytes
Michael S <already5chosen@yahoo.com> writes:
>On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
>boltar@caprica.universe wrote:
>
>> On Wed, 28 Oct 2026 14:09:32 -0700
>> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
>> >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.  
>> 
>> Thats true. Its been so long since I used it I'd forgotten about
>> that. Makes it even less useful.
>> 
>
>Does it block when your command processor is bash and your command
>string is "my_subprocess &"? 

You might need to do 'nohup my_subprocess &' if my_subprocess
doesn't intercept SIGHUP.
Re: “The end of software secrecy is almost upon
#425
Author: Michael S
Date: Thu, 29 Oct 2026 22:54
62 lines
4000 bytes
On Thu, 29 Oct 2026 22:26:40 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

> Michael S <already5chosen@yahoo.com> writes:
> >On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
> >boltar@caprica.universe wrote:
> >  
> >> On Wed, 28 Oct 2026 14:09:32 -0700
> >> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:  
> >> >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.    
> >> 
> >> Thats true. Its been so long since I used it I'd forgotten about
> >> that. Makes it even less useful.
> >>   
> >
> >Does it block when your command processor is bash and your command
> >string is "my_subprocess &"?   
> 
> You might need to do 'nohup my_subprocess &' if my_subprocess
> doesn't intercept SIGHUP.


You are likely right. Otherwise OS will kill my_subprocess at about the
same time the caller of system() gets control back.
I would not figure it out myself.


Re: “The end of software secrecy is almost upon
#424
Author: Dan Cross
Date: Fri, 30 Oct 2026 02:10
63 lines
3553 bytes
In article <EJPES.62185$BaS5.30884@fx35.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
>Michael S <already5chosen@yahoo.com> writes:
>>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.
>
>The thread design for SVR4 Unix started in the late 80s and
>released in 1993.
>
>Digital published "Evolving the UNIX System Interface to
>Support Multithreaded Programs" September 28, 1987.
>(Paul R. McJones and Garret F. Swart).
>
>The "The Topaz Operating System User's Guide" in that document
>describes the thread interface. (DIGITAL Systems Research
>Center operating system) for both VAX/Ultrix and the Firefly/Taos
>implementation.
>
>Here's a link to the paper published a couple years later:
>
>https://softwarepreservation.computerhistory.org/modula2+/doc/McJones_Swart-Evolving-1989.pdf
>
>And here's a link to the full technical report #21 (including the manual)
>
>https://ftp.zx.net.nz/pub/archive/gatekeeper.dec.com/pub/DEC/SRC/research-reports/SRC-021.pdf

Speaking of.... I have a distinct memory of reading a paper
called something like, "fork mixed with threads considered
harmful"; I could have sworn it was by Luca Cardelli, but I do
not think that is correct, nor can I find it....  At least the
Gatekeeper archive of SRC reports was mirrored.  Maybe it's in
there (it's not the evolving paper, though that touches on the
issues).

	- Dan C.
Re: “The end of software secrecy is almost upon
#426
Author: Dan Cross
Date: Fri, 30 Oct 2026 02:22
114 lines
4677 bytes
In article <20261030005434.00005458@yahoo.com>,
Michael S  <already5chosen@yahoo.com> wrote:
>On Thu, 29 Oct 2026 22:26:40 GMT
>scott@slp53.sl.home (Scott Lurndal) wrote:
>
>> Michael S <already5chosen@yahoo.com> writes:
>> >On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
>> >boltar@caprica.universe wrote:
>> >
>> >> On Wed, 28 Oct 2026 14:09:32 -0700
>> >> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
>> >> >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.
>> >>
>> >> Thats true. Its been so long since I used it I'd forgotten about
>> >> that. Makes it even less useful.
>> >>
>> >
>> >Does it block when your command processor is bash and your command
>> >string is "my_subprocess &"?
>>
>> You might need to do 'nohup my_subprocess &' if my_subprocess
>> doesn't intercept SIGHUP.
>
>
>You are likely right. Otherwise OS will kill my_subprocess at about the
>same time the caller of system() gets control back.
>I would not figure it out myself.

Only if you intended to close the TTY the programs were started
on.  Otherwise, I don't see why it would be necessary:

```
term% cat a.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

int
main(void)
{
        struct tm *t;
        time_t now = time(NULL);
        printf("Starting child, time is %s", asctime(gmtime(&now)));
        sleep(5);
        now = time(NULL);
        printf("Bye bye, now is %s", asctime(gmtime(&now)));
}
term% cat b.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

int
main(void)
{
        time_t now = time(NULL);
        printf("Parent starting, time is %s", asctime(gmtime(&now)));
        system("./a &");
        printf("./a started in background\n");
        sleep(2);
        now = time(NULL);
        printf("Ahhh!!! time is %s", asctime(gmtime(&now)));
        return 0;
}
term% make a
cc -O2 -pipe    -o a a.c
term% make b
cc -O2 -pipe    -o b b.c
term% ./b
Parent starting, time is Fri Oct 30 02:21:06 2026
./a started in background
Starting child, time is Fri Oct 30 02:21:06 2026
Ahhh!!! time is Fri Oct 30 02:21:08 2026
term% Bye bye, now is Fri Oct 30 02:21:11 2026
```

	- Dan C.
Re: “The end of software secrecy is almost upon
#427
Author: Michael S
Date: Fri, 30 Oct 2026 08:59
123 lines
5514 bytes
On Fri, 30 Oct 2026 02:22:43 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) wrote:

> In article <20261030005434.00005458@yahoo.com>,
> Michael S  <already5chosen@yahoo.com> wrote:
> >On Thu, 29 Oct 2026 22:26:40 GMT
> >scott@slp53.sl.home (Scott Lurndal) wrote:
> >  
> >> Michael S <already5chosen@yahoo.com> writes:  
> >> >On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
> >> >boltar@caprica.universe wrote:
> >> >  
> >> >> On Wed, 28 Oct 2026 14:09:32 -0700
> >> >> "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:  
> >> >> >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.  
> >> >>
> >> >> Thats true. Its been so long since I used it I'd forgotten about
> >> >> that. Makes it even less useful.
> >> >>  
> >> >
> >> >Does it block when your command processor is bash and your command
> >> >string is "my_subprocess &"?  
> >>
> >> You might need to do 'nohup my_subprocess &' if my_subprocess
> >> doesn't intercept SIGHUP.  
> >
> >
> >You are likely right. Otherwise OS will kill my_subprocess at about
> >the same time the caller of system() gets control back.
> >I would not figure it out myself.  
> 
> Only if you intended to close the TTY the programs were started
> on.  Otherwise, I don't see why it would be necessary:

What happens when caller is GUI-style application?

> 
> ```
> term% cat a.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <time.h>
> #include <unistd.h>
> 
> int
> main(void)
> {
>         struct tm *t;
>         time_t now = time(NULL);
>         printf("Starting child, time is %s", asctime(gmtime(&now)));
>         sleep(5);
>         now = time(NULL);
>         printf("Bye bye, now is %s", asctime(gmtime(&now)));
> }
> term% cat b.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <time.h>
> #include <unistd.h>
> 
> int
> main(void)
> {
>         time_t now = time(NULL);
>         printf("Parent starting, time is %s", asctime(gmtime(&now)));
>         system("./a &");
>         printf("./a started in background\n");
>         sleep(2);
>         now = time(NULL);
>         printf("Ahhh!!! time is %s", asctime(gmtime(&now)));
>         return 0;
> }
> term% make a
> cc -O2 -pipe    -o a a.c
> term% make b
> cc -O2 -pipe    -o b b.c
> term% ./b
> Parent starting, time is Fri Oct 30 02:21:06 2026
> ./a started in background
> Starting child, time is Fri Oct 30 02:21:06 2026
> Ahhh!!! time is Fri Oct 30 02:21:08 2026
> term% Bye bye, now is Fri Oct 30 02:21:11 2026
> ```
> 
> 	- Dan C.
> 

Re: Re: “The end of software secrecy is almost upon
#428
Author: boltar
Date: Fri, 30 Oct 2026 11:21
13 lines
2025 bytes
On Thu, 29 Oct 2026 12:49:55 -0700
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> gabbled:
>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?

That will depend entirely on the application. There could be a boatload of
startup config in memory plus all the enviroment variables.
Re: “The end of software secrecy is almost upon
#429
Author: Dan Cross
Date: Fri, 30 Oct 2026 11:25
124 lines
5773 bytes
In article <20261030105900.000020ce@yahoo.com>,
Michael S  <already5chosen@yahoo.com> wrote:
>On Fri, 30 Oct 2026 02:22:43 -0000 (UTC)
>cross@spitfire.i.gajendra.net (Dan Cross) wrote:
>
>> In article <20261030005434.00005458@yahoo.com>,
>> Michael S  <already5chosen@yahoo.com> wrote:
>> >On Thu, 29 Oct 2026 22:26:40 GMT
>> >scott@slp53.sl.home (Scott Lurndal) wrote:
>> >
>> >> Michael S <already5chosen@yahoo.com> writes:
>> >> >On Thu, 29 Oct 2026 16:20:39 -0000 (UTC)
>> >> >[snip]
>> >> >Does it block when your command processor is bash and your command
>> >> >string is "my_subprocess &"?
>> >>
>> >> You might need to do 'nohup my_subprocess &' if my_subprocess
>> >> doesn't intercept SIGHUP.
>> >
>> >
>> >You are likely right. Otherwise OS will kill my_subprocess at about
>> >the same time the caller of system() gets control back.
>> >I would not figure it out myself.
>>
>> Only if you intended to close the TTY the programs were started
>> on.  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".  Why would it be any different?

SIGHUP is the "hangup" signal, and _usually_ generated by the
kernel when a process loses its controlling terminal, though it
_can_ be sent from the command line (or a program) using the
`kill` command or one of its many imitators (basically, anything
that invokes `raise()` or the `kill()` system call).

The classic example of its use was a dial-in terminal line that
recognized modem status and reacted to a "carrier detect" signal
dropping; the kernel would clean up by SIGHUP'ing the process
group of anything associated with that terminal; one can see
this readily in early Unix kernel sources.  This is a reason why
SIGHUP is one of the few signals a shell will actually honor.

Nowadays, this most often happens when an interactive session
associated with a pseudoterminal is closed; this could be window
in a terminal emulator program, or it could be a network login
via e.g. `ssh` that closes.

For programs that are not associated with a TTY at all, this
won't happen; this is why traditionally Unix daemons often
overloaded SIGHUP to force reloading a config file or similar:
since daemons are not generally associated with user ttys (or
often any TTY at all, including the console), the kernel will
never automatically send them a SIGHUP to terminate, so it's a
"safe" signal to pick for administrative control.

Crucially, using `system()` to invoke a program, even one that
is backgrounded, does not usually allocate a new terminal, nor
does it necessarily close one (though I suppose one could use it
to invoke something like, `kill -9 -1` to zap all of one's
processes; you could even background that if you wanted, but
that seems silly).

GUI programs are no different in this regard.  Many of them may
not even be associated with a tty device at all, and may receive
their "session has ended" notification some other way.

So I go back to my original statement, "only if you intended to
close the TTY the programs were started on."  IF you intend to
start some long-running program in the background and you won't
stay logged in after doing that, then sure, use `nohup`.  But
if you don't care about that, then you don't need to bother.
The OS will not kill your program when the shell started by
`system` exits or anything; nor will the shell itself.

	- Dan C.

>> ```
>> term% cat a.c
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <time.h>
>> #include <unistd.h>
>>
>> int
>> main(void)
>> {
>>         time_t now = time(NULL);
>>         printf("Starting child, time is %s", asctime(gmtime(&now)));
>>         sleep(5);
>>         now = time(NULL);
>>         printf("Bye bye, now is %s", asctime(gmtime(&now)));
>> }
>> term% cat b.c
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <time.h>
>> #include <unistd.h>
>>
>> int
>> main(void)
>> {
>>         time_t now = time(NULL);
>>         printf("Parent starting, time is %s", asctime(gmtime(&now)));
>>         system("./a &");
>>         printf("./a started in background\n");
>>         sleep(2);
>>         now = time(NULL);
>>         printf("Ahhh!!! time is %s", asctime(gmtime(&now)));
>>         return 0;
>> }
>> term% make a
>> cc -O2 -pipe    -o a a.c
>> term% make b
>> cc -O2 -pipe    -o b b.c
>> term% ./b
>> Parent starting, time is Fri Oct 30 02:21:06 2026
>> ./a started in background
>> Starting child, time is Fri Oct 30 02:21:06 2026
>> Ahhh!!! time is Fri Oct 30 02:21:08 2026
>> term% Bye bye, now is Fri Oct 30 02:21:11 2026
>> ```
Re: “The end of software secrecy is almost upon
#431
Author: boltar
Date: Fri, 30 Oct 2026 11:25
36 lines
3126 bytes
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.
Re: “The end of software secrecy is almost upon
#430
Author: Michael S
Date: Fri, 30 Oct 2026 13:23
14 lines
1692 bytes
On Fri, 30 Oct 2026 11:25:01 -0000 (UTC)
cross@spitfire.i.gajendra.net (Dan Cross) wrote:


> The OS will not kill your program when the shell started by
> `system` exits or anything;
> 

Good to know.

> nor will the shell itself.

That part I guessed myself.
Re: “The end of software secrecy is almost upon
#432
Author: boltar
Date: Fri, 30 Oct 2026 16:07
18 lines
2079 bytes
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  <already5chosen@yahoo.com> wrote:
>>> Only if you intended to close the TTY the programs were started
>>> on.  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".  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.
Re: “The end of software secrecy is almost upon
#433
Author: Chris M. Thomasson
Date: Fri, 30 Oct 2026 18:05
42 lines
3725 bytes
On 10/30/2026 4:25 AM, boltar@caprica.universe wrote:
> 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.
> 

Multi process with shared memory can be tricky indeed. Step one, you 
need to ponder on making it "robust". Threads do not need to be robust. 
Well, you should not have a thread up and die anyway. Now, for multi 
process, that should be handled. There are many different ways.
Re: “The end of software secrecy is almost upon
#435
Author: Jeroen Belleman
Date: Fri, 30 Oct 2026 19:37
26 lines
2751 bytes
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  <already5chosen@yahoo.com> wrote:
>>>> Only if you intended to close the TTY the programs were started
>>>> on.  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".  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!

Jeroen Belleman
Re: “The end of software secrecy is almost upon us”
#437
Author: Lawrence D’Oliveiro
Date: Fri, 30 Oct 2026 22:35
31 lines
3049 bytes
On Fri, 30 Oct 2026 20:37:14 +0100, Jeroen Belleman wrote:

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

Back in the 1990s, threading was seen as the answer to everything.
Some even tried multithreaded GUIs.

The trouble with threading is its “default-shared-everything” model,
as opposed to separate processes, which are “default-shared-nothing”.
It is all too easy to forget to synchronize access to shared objects,
lock things properly etc, and end up with hard-to-diagnose bugs that
tend to hide themselves when you try to go look for them (see
“Heisenbug”).

The trend nowadays is to revive the old coroutine concept, in a new
guise called “stackless” coroutines. These give you support for async
operations, but with transfers of control being made explicit at
“await” 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.

Threading is still definitely useful, mainly for performance, where
the bottleneck is in CPU usage. But if a program is spending most of
its time waiting for I/O over the network, or for a user to initiate a
GUI action, or something external and relatively slow like that, then
coroutines keep things simpler.
Re: “The end of software secrecy is almost upon us”
#436
Author: Charlie Gibbs
Date: Sat, 31 Oct 2026 04:14
20 lines
2163 bytes
On 2026-10-30, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:

> Threading is still definitely useful, mainly for performance, where
> the bottleneck is in CPU usage. But if a program is spending most of
> its time waiting for I/O over the network, or for a user to initiate a
> GUI action, or something external and relatively slow like that, then
> coroutines keep things simpler.

I've always tried to avoid the complexities of threading; in most cases
I can get away with round-robin scheduling.  But I found that some servers
are very slow to respond, and even when trying to do a non-blocking setup
of a TCP/IP connection, the connect() API would unavoidably block.  I had
to spin that part off into its own thread to keep the rest of the program
(including other connections) from hanging.

-- 
/~\  Charlie Gibbs                  |  In this world there are
\ /  <cgibbs@kltpzyxm.invalid>      |  two kinds of people:
 X   I'm really at ac.dekanfrus     |  1. Those who can extrapolate
/ \  if you read it the right way.  |  from incomplete data.
Re: “The end of software secrecy is almost upon us”
#438
Author: Lawrence D’Oliveiro
Date: Sat, 31 Oct 2026 05:37
32 lines
3247 bytes
On Sat, 31 Oct 2026 04:14:05 GMT, Charlie Gibbs wrote:

> I've always tried to avoid the complexities of threading; in most
> cases I can get away with round-robin scheduling. But I found that
> some servers are very slow to respond, and even when trying to do a
> non-blocking setup of a TCP/IP connection, the connect() API would
> unavoidably block. I had to spin that part off into its own thread
> to keep the rest of the program (including other connections) from
> hanging.

Here’s 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.

From the ERRORS section of <https://manpages.debian.org/connect(2)>:

    EINPROGRESS
        The socket is nonblocking and the connection cannot be
        completed immediately. (UNIX domain sockets failed with EAGAIN
        instead.) It is possible to select(2) or poll(2) for
        completion by selecting the socket for writing. After
        select(2) indicates writability, use getsockopt(2) to read the
        SO_ERROR option at level SOL_SOCKET to determine whether
        connect() completed successfully (SO_ERROR is zero) or
        unsuccessfully (SO_ERROR is one of the usual error codes
        listed here, explaining the reason for the failure).

I’m not sure about doing this sort of thing from other libraries that
wrap socket connections (e.g. SSL/TLS libraries); for these, the usual
fallback is still available, as you say, by turning a blocking call
into a nonblocking one by pushing it off to a separate thread.
Re: Re: “The end of software secrecy is almost upon
#439
Author: boltar
Date: Sat, 31 Oct 2026 09:38
30 lines
2768 bytes
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  <already5chosen@yahoo.com> wrote:
>>>>> Only if you intended to close the TTY the programs were started
>>>>> on.  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".  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.
Re: “The end of software secrecy is almost upon
#440
Author: boltar
Date: Sat, 31 Oct 2026 09:45
30 lines
2297 bytes
On Fri, 30 Oct 2026 22:35:05 -0000 (UTC)
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> gabbled:
>The trend nowadays is to revive the old coroutine concept, in a new
>guise called “stackless” coroutines. These give you support for async
>operations, but with transfers of control being made explicit at
>“await” points, rather than unpredictably as with full preemptive
>threading. This greatly reduces the opportunity for race conditions.

Coroutines are just a complicated way to re-implement a function with a load
of statics.

eg:

void myfunc()
{
	static int i = 0;
	for(;;++i)
	{
		[do something based on value of i]
		[return when some condition met]
	}
}

Also the C++ implementation is so bad its unusable.

>Credit to Microsoft for pioneering this, but nowadays you see the idea
>popping up in JavaScript and Python and who knows where else.

Python nailed it - you just call "yield", job done.
Re: “The end of software secrecy is almost upon
#441
Author: boltar
Date: Sat, 31 Oct 2026 09:47
13 lines
2161 bytes
On Sat, 31 Oct 2026 05:37:23 -0000 (UTC)
Lawrence =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> gabbled:
>Here’s 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.

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 which is their main raison d'etre, but on unix they're a
very powerful tool. For simple servers with a low workload they can allow
single threaded development simplifying the code immensely.
Re: “The end of software secrecy is almost upon
#443
Author: Michael S
Date: Sat, 31 Oct 2026 17:56
24 lines
2520 bytes
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 =?iso-8859-13?q?D=FFOliveiro?= <ldo@nz.invalid> gabbled:
> >Here’s 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.  
> 
> 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 

On what planet?

> which is their main raison d'etre,
> but on unix they're a very powerful tool. For simple servers with a
> low workload they can allow single threaded development simplifying
> the code immensely.
> 

Re: “The end of software secrecy is almost upon
#442
Author: Chris M. Thomasson
Date: Sat, 31 Oct 2026 20:11
37 lines
3151 bytes
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  <already5chosen@yahoo.com> wrote:
>>>>>> Only if you intended to close the TTY the programs were started
>>>>>> on.  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".  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?
Re: “The end of software secrecy is almost upon
#444
Author: Chris M. Thomasson
Date: Sat, 31 Oct 2026 20:14
278 lines
8367 bytes
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  <already5chosen@yahoo.com> wrote:
>>>>>> Only if you intended to close the TTY the programs were started
>>>>>> on.  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".  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.
> 

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:





So, I have the most recent version and coded up my old multex algo. It 
100% dead lock free and allows a thread to locks multiple objects in any 
order and lock them. All of the lock ordering is taken care of in the 
finalize function. Basically a thread seeds its per thread lock indices 
with addresses to objects it wants to lock. Calls finalize, then locks 
them. Does its thing and then unlocks them. Fwiw, here is my Relacy test 
output:

struct ct_multex_relacy_test_v000
65% (65536/100000)
iterations: 100000
total time: 9390
throughput: 10649


D:\ct_dev\ct_msvc\projects\ct_relacy_test\x64\Debug\ct_relacy_test.exe 
(process 13356) exited with code 0 (0x0).
Press any key to close this window . . .


Any my 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;
}



/*
#include <relacy/relacy.hpp>
#include <iostream>


int
main()
{
     std::cout << "ct_relacy_test\n";
     std::cout << "____________________________________________" << 
std::endl;

     {

     }

     std::cout << "____________________________________________" << 
std::endl;
     std::cout << "ct_relacy_test fin! :^)\n";

     return 0;
}

*/


Re: “The end of software secrecy is almost upon
#445
Author: boltar
Date: Sun, 01 Nov 2026 08:32
22 lines
2418 bytes
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
>> >initiated, and you can monitor its subsequent progress from your
>> >event loop. =20
>>=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.
Re: Re: “The end of software secrecy is almost upon
#446
Author: boltar
Date: Sun, 01 Nov 2026 08:33
43 lines
3249 bytes
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  <already5chosen@yahoo.com> wrote:
>>>>>>> Only if you intended to close the TTY the programs were started
>>>>>>> on.  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".  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.
Re: Re: “The end of software secrecy is almost upon
#447
Author: boltar
Date: Sun, 01 Nov 2026 08:34
22 lines
2180 bytes
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
Re: “The end of software secrecy is almost upon us”
#448
Author: Charlie Gibbs
Date: Sun, 01 Nov 2026 19:40
45 lines
3528 bytes
On 2026-10-31, Lawrence D’Oliveiro <ldo@nz.invalid> wrote:

> On Sat, 31 Oct 2026 04:14:05 GMT, Charlie Gibbs wrote:
>
>> I've always tried to avoid the complexities of threading; in most
>> cases I can get away with round-robin scheduling. But I found that
>> some servers are very slow to respond, and even when trying to do a
>> non-blocking setup of a TCP/IP connection, the connect() API would
>> unavoidably block. I had to spin that part off into its own thread
>> to keep the rest of the program (including other connections) from
>> hanging.
>
> Here’s 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.
>
> From the ERRORS section of <https://manpages.debian.org/connect(2)>:
>
>     EINPROGRESS
>         The socket is nonblocking and the connection cannot be
>         completed immediately. (UNIX domain sockets failed with EAGAIN
>         instead.) It is possible to select(2) or poll(2) for
>         completion by selecting the socket for writing. After
>         select(2) indicates writability, use getsockopt(2) to read the
>         SO_ERROR option at level SOL_SOCKET to determine whether
>         connect() completed successfully (SO_ERROR is zero) or
>         unsuccessfully (SO_ERROR is one of the usual error codes
>         listed here, explaining the reason for the failure).
>
> I’m not sure about doing this sort of thing from other libraries that
> wrap socket connections (e.g. SSL/TLS libraries); for these, the usual
> fallback is still available, as you say, by turning a blocking call
> into a nonblocking one by pushing it off to a separate thread.

I was already setting the socket to non-blocking before calling
connect() - and yet there were times when the API blocked anyway.
I never did figure out why, and we had a customer getting impatient,
so I just spun off another thread and moved on to other things.

-- 
/~\  Charlie Gibbs                  |  In this world there are
\ /  <cgibbs@kltpzyxm.invalid>      |  two kinds of people:
 X   I'm really at ac.dekanfrus     |  1. Those who can extrapolate
/ \  if you read it the right way.  |  from incomplete data.
Re: “The end of software secrecy is almost upon
#449
Author: Michael S
Date: Sun, 01 Nov 2026 19:59
32 lines
2916 bytes
On Sun, 1 Nov 2026 08:32:42 -0000 (UTC)
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 initiated, and you can monitor its subsequent
> >> >progress from your event loop. =20  
> >>=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.
> 

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.
Re: “The end of software secrecy is almost upon
#451
Author: Johann 'Myrkraverk' Oskarsson
Date: Sun, 01 Nov 2026 22:17
21 lines
2399 bytes
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?  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!
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;
Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Re: Structured Programming (was Re: “The end of software secrecy is almost upon us”)
#450
Author: Lawrence D’Oliveiro
Date: Sun, 01 Nov 2026 23:38
142 lines
6736 bytes
Anyway, to get the discussion back on track:

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.

Problems I am trying to address:

  * Leaking memory: allocating something and forgetting to dispose of
    it
  * Double-free: the opposite problem, trying to free a memory block
    that has already been freed

The basic structured-programming pattern I follow is:

  1: Initialize a pointer variable to `NULL`
  2: Allocate memory for the pointer (this might fail)
  3: Correctly free the pointer memory, regardless of allocation
     success/failure

This project uses the implementation of a Python extension module as a
specific example, since Python itself is a highly dynamic language,
and so code that is written in a lower-level-language like C for
interfacing to Python typically has to deal a lot with allocation and
management of Python objects and other dynamic memory.

In more concrete terms, the code pattern looks like this:

    PyObject * obj = NULL; /* step 1 */
    do /*once*/
      {
        ... possible other stuff ...
        allocate obj; /* step 2 */
        if (PyErr_Occurred())
            break;
        ... possible other stuff using obj ...
      }
    while (false);
    Py_XDECREF(obj); /* step 3 */

Assuming there are no `goto`s in the “...” parts (or `return`
statements, or shenanigans like `setjmp`(3)/`longjmp`(3)), it should
be clear that, regardless of what happens in those parts (provided
they don’t free or reallocate `obj`), any memory allocated to `obj`
will be correctly freed.

Key to this pattern is the fact that `Py_XDECREF` is a noop (and
raises no error) if it is passed a `NULL` pointer. This is also the
semantics of the `free`(3) routine in the C standard library, and I
recommend that any memory-disposal routine you create implement the
same behaviour. It saves checking for unallocated storage in the
cleanup code: just unconditionally dispose of everything temporary
that might have been allocated.

The above basic structure scales easily. For example, coping with
multiple objects needing allocating:

    PyObject * obj1 = NULL;
    PyObject * obj2 = NULL;
    do /*once*/
      {
        ... possible other stuff ...
        allocate obj1;
        if (PyErr_Occurred())
            break;
        ... possible other stuff using obj1 ...
        allocate obj2;
        if (PyErr_Occurred())
            break;
        ... possible other stuff using obj1 and obj2 ...
      }
    while (false);
    Py_XDECREF(obj1);
    Py_XDECREF(obj2);

Nested blocks:

    PyObject * obj1 = NULL;
    do /*once*/
      {
        ... possible other stuff ...
        allocate obj1;
        if (PyErr_Occurred())
            break;
        ... possible other stuff using obj1 ...
          {
            PyObject * obj2 = NULL;
            do /*once*/
              {
                ... even more possible stuff using obj1 ...
                allocate obj2;
                if (PyErr_Occurred())
                    break;
                ... possible other stuff using obj1 and obj2 ...
              }
            while (false);
            Py_XDECREF(obj2);
          }
        if (PyErr_Occurred())
            break;
        ... yet more possible stuff using obj1 ...
      }
    while (false);
    Py_XDECREF(obj1);

Allocation within loops:

    for (ssize_t i = 0;;)
      {
        if (i == nr_items)
            break;
        PyObject * const item = PyTuple_GetItem(items, i);
        if (item == NULL)
            break;
          {
            PyObject * key = NULL;
            PyObject * value = NULL;
            do /*once*/
              {
                ... construct key ...
                if (PyErr_Occurred())
                    break;
                ... construct value ...
                if (PyErr_Occurred())
                    break;
                if (PyDict_SetItem(tempresult, key, value) < 0)
                    break;
              }
            while (false);
            Py_XDECREF(key);
            Py_XDECREF(value);
          }
        if (PyErr_Occurred())
            break;
        ++i;
      } /*for*/
    if (PyErr_Occurred())
        break;

Etc, etc.
Re: “The end of software secrecy is almost upon
#452
Author: Chris M. Thomasson
Date: Mon, 02 Nov 2026 02:03
49 lines
3678 bytes
On 11/1/2026 1:33 AM, boltar@caprica.universe wrote:
> 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  <already5chosen@yahoo.com> wrote:
>>>>>>>> Only if you intended to close the TTY the programs were started
>>>>>>>> on.  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".  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.
> 

Ummm. I think you are the one that does not know what the heck they are 
talking about.
Page 9 of 11 • 533 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