๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #280

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

#280
From: Dan Cross
Date: Sun, 25 Oct 2026 00:28
137 lines
7012 bytes
In article <20261025011151.000038ef@yahoo.com>,
Michael S  <already5chosen@yahoo.com> 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.

First, he's a big boy, and I'm sure he can answer for himself.
But ok then, C++, not C.  The questions still stand.

>Second, while in theory threads can be implemented by C++
>compilers+language  support library, in practice I had never seen it
>done.

This is not saying much about anything aside from the countours
of your own experience, I'm afraid.

>All I had seen is C++ threads implemented in library as thin
>wrapper atop of the OS (or RT executive) implementation.

In the late 1990s, into the early 2000s, most "threads" on
Unix-style systems were implemented in userspace, in the C
library, often by exposing the "normal" system call endpoints
in the library, but making them thin wrappers around equivalent
asynchronous system calls.

There was even a paper about using the Xinu pedagogical system
from Doug Comer to implement something very close to threads on
4.2BSD, with signals and a context saving/restoration primitive
to approximate a timer interrupt.

For a more recent historical example the FreeBSD MP library was
initially implemented this way, as were pre-LinuxThreasd threads
on Linux; Solaris threads up until Solaris 2.6 or so similarly.

Of course, it wasn't a great way to do things because if
something _did_ block...well, there went your concurrency.

Making Unix systems multithreaded was challenging because of
decades of software that was written assuming a single-threaded
userspace environment (the kernel had been "multithreaded" since
very near the start, even if much of the system was written
assuming a single processor; but parallelism is not the same
thing as concurrency), and this was compounded because people
were trying to implement complex M:N threading models; Sun did
this, and FreeBSD tried with their KSEs; the Linux people did
not.  While cool in theory, M:N threading relied on very
specific usage patterns to work well in practice, and almost no
one actually wrote software that way, so you ended up with
userspace threads fighting the kernel scheeduler, and vice
versa.

More recently, the Akaros research system introduced the notion
of a "many-core process" and pushed fine-grained "thread"
scheduling entirely to userspace; the kernel is totally unaware
of how userspace schedules anything.  That system uses an N:C
model, where $C$ is the number of *cores* assigned to a process
(all system calls in Akaros are asychronous by design, to avoid
the pitfalls of user-threads blocking on synchronous kernel
services that beset Unix).

>I can not see while the same can't be done for processes, with
>API modeled on posix_spawn() or Windows CreateProcess().

C, and C++, have had `system()` for as long as I can remember,
if you just want to run a program (note that both `posix_spawn`
and `CreateProcess` take the names of programs to run in that
new process).

>It does not look like variety in this field is bigger than in case of
>threads. More like it is smaller.

Nope.  But if you think differently, see the questions above.

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

POSIX has all of that.  POSIX also has a process model.  Why not
just make POSIX a part of the language, then?  (Answer that and
you may start to understand why this is harder than it looks
for C++ [and C].)

	- Dan C.
Technical Details
Message-ID: <11bjif3$7p0$1@reader2.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
References: <11amvre$15far$1@dont-email.me> <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!panix!.POSTED.spitfire.i.gajendra.net!not-for-mail
From: cross@spitfire.i.gajendra.net (Dan Cross)
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 00:28:19 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <11bjif3$7p0$1@reader2.panix.com>
References: <11amvre$15far$1@dont-email.me> <11bj08r$309uk$1@dont-email.me> <11bj7na$5bt$1@reader2.panix.com> <20261025011151.000038ef@yahoo.com>
Injection-Date: Sun, 25 Oct 2026 00:28:19 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="spitfire.i.gajendra.net:166.84.136.80";
	logging-data="7968"; mail-complaints-to="abuse@panix.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: cross@spitfire.i.gajendra.net (Dan Cross)