๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #291

Re: โ€œThe end of software secrecy is almost upon

#291
From: David Brown
Date: Sun, 25 Oct 2026 09:45
119 lines
6989 bytes
On 25/10/2026 00:11, Michael S wrote:
> On Sat, 24 Oct 2026 21:24:58 -0000 (UTC)
> cross@spitfire.i.gajendra.net (Dan Cross) wrote:
> 
>> In article <11bj08r$309uk$1@dont-email.me>,
>> Peter Flass  <Peter@Iron-Spring.com> wrote:
>>> On 10/24/26 09:41, Dan Cross wrote:
>>>> In article <11bhppd$2lpkc$1@dont-email.me>,
>>>> <boltar@caprica.universe> wrote:
>>>>> On Fri, 23 Oct 2026 20:45:27 -0000 (UTC)
>>>>> cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
>>>>>> In article <11bf4d1$skul$1@dont-email.me>,
>>>>>> <boltar@caprica.universe> wrote:
>>>>>>> On Thu, 22 Oct 2026 16:22:30 -0000 (UTC)
>>>>>>> cross@spitfire.i.gajendra.net (Dan Cross) gabbled:
>>>>>>>> In article <11bd7rg$2cvfs$1@dont-email.me>,
>>>>>>>> <boltar@battlestar.co.uk> wrote:
>>>>>>   
>>>>>>>>> You need an OS to do threading properly too. Theres a reason
>>>>>>>>> green threads in java were a joke.
>>>>>>>>
>>>>>>>> Weird that you think you need a operating system for threads,
>>>>>>>> yet you want C to standardize processes which also ... need an
>>>>>>>> operating system.  I mean, POSIX already does an ok job of
>>>>>>>> standardizing the sorts of process-y things you would expect
>>>>>>>> from, you know, an operating system.
>>>>>>>
>>>>>>> I'm simply pointing out the inconsistency in having a threading
>>>>>>> library but not a process library. Its perfectly possible to
>>>>>>> simulate a multiprocess enviroment.
>>>>>>
>>>>>> So write a simulator in your language of choice.  You don't need
>>>>>> the language to standardize a process model for that.
>>>>>
>>>>> Ditto threads. So why does C++ have a threading library?
>>>>>
>>>>> Take your time...
>>>>
>>>> What, pray tell, do you think that a _thread_ is?  And how is it
>>>> different from a _process_?  For that matter, what do you think
>>>> that a _process_ is?
>>>>
>>>> Please, take all the time you need to answer.
>>>
>>> Threads share resources such as address space, files, etc. A process
>>> runs in its own address space. (at least these days, before virtual
>>> memory, who knows?)
>>
>> Indeed, but I'm hoping Mr Boltar will chime in with his answers,
>> so that we can understand why thinks that a language like C
>> should introduce a *process* model, and how threads are similar.
>>
>> 	- Dan C.
>>
> 
> First, he was talking about C++. Unlike me, he does not appear to care
> about C.
> Second, while in theory threads can be implemented by C++
> compilers+language  support library, in practice I had never seen it
> done. All I had seen is C++ threads implemented in library as thin
> wrapper atop of the OS (or RT executive) implementation.
> I can not see while the same can't be done for processes, with
> API modeled on posix_spawn() or Windows CreateProcess().
> It does not look like variety in this field is bigger than in case of
> threads. More like it is smaller.
> 

No one is suggesting that the threads themselves are implemented in 
pure, standard, portable C++.  You need an underlying OS or support of 
some sort if you are going to have preemptable threads.  It's the same 
principle as IO and file access.

But the difference between threads and processes is very simple from the 
viewpoint of C and C++.  Suppose you have a global (i.e., external 
linkage) variable :

	int x;

Two threads that have "int a = x;" see the same "x" (ignoring data races 
and synchronisation).  Two processes see completely different "x".

With threads, you are still within the same program execution - the same 
code, the same data.  Thus it is appropriate that the language can 
describe the threads, and provide an execution model that can describe 
what is safe and unsafe for sharing the data.  It is then highly useful 
for the programmer to have some standard data types and functions for 
doing this safe access, and wrappers around common OS functions for threads.

With processes, you have two separate programs.  Usually it is different 
code and data (with a spawn), sometimes it is the same code and a copy 
of the data (with a fork).  But the programs are separate.  C and C++ 
model programs, not systems of programs.  It is not more part of C and 
C++ than details of the filesystem.

Of course the standard library could provide some standard wrappers for 
spawn, fork, and related process control functions.  But what use would 
they be?  Many of the details are OS-specific - for example, you'd 
either have to say that C++ programmers on Linux don't get "fork", or 
that C++ programmers on Windows get "fork" without realising the massive 
overheads involved in emulating it.

It would be possible, of course, to have some standard library classes 
and functions here - with optional parts to make it useable on common 
OS'es.  But it is very different from threading, which is integral to 
the execution model of C++ and C (since C++11 and C11) - it is that 
model that makes threading integration important.  Wrappers around 
common OS calls is unlikely to give programmers anything significant.


> Now, would it be the first thing I would want like addition to C++
> standard library? No it would not be.
> The first thing would be IPv4 communication, sockets, poll etc...
> 

That's more realistic, and potentially more useful.  And it is in 
progress.  (I haven't tracked the progress for the networking TS - but 
it seems to be a lot more work than originally anticipated.)

Technical Details
Message-ID: <11bkj49$3fber$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11amvre$15far$1@dont-email.me> <11bhppd$2lpkc$1@dont-email.me> <11bin3i$ma9$1@reader2.panix.com> <11bj08r$309uk$1@dont-email.me> <11bj7na$5bt$1@reader2.panix.com> <20261025011151.000038ef@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: rec.arts.sf.written,comp.lang.fortran,comp.lang.c++,alt.comp.lang.rust,alt.folklore.computers
Subject: Re: โ€œThe end of software secrecy is almost upon
Date: Sun, 25 Oct 2026 10:45:45 +0100
Organization: A noiseless patient Spider
Lines: 119
Message-ID: <11bkj49$3fber$1@dont-email.me>
References: <11amvre$15far$1@dont-email.me> <11bhppd$2lpkc$1@dont-email.me>
 <11bin3i$ma9$1@reader2.panix.com> <11bj08r$309uk$1@dont-email.me>
 <11bj7na$5bt$1@reader2.panix.com> <20261025011151.000038ef@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 25 Oct 2026 09:45:46 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3648987"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/L617vBin3J6o0hIPje1vyDfjVqCMdLRQ="; posting-host="eed3bac6b2a2e8ba1c1cf78e4c9c64c2"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:/gGuwuq7axRU8bLQM4cSqJVhkRQ= sha256:DMLl/kSDFFu1Iwu7oF84fdU8agT/3Ab7TN6/FknWzuI=
	sha1:6q1zLJtWNfRdPoGBXWarEix+fRU= sha256:XeKQA1IIK5TXQSbusx48TE6mTAtj0DFfbdXtykh4PTQ=
In-Reply-To: <20261025011151.000038ef@yahoo.com>
Content-Language: en-GB