From: David Thompson on
On Tue, 10 Jun 2008 02:35:51 -0800, glen herrmannsfeldt
<gah(a)ugcs.caltech.edu> wrote:
<snip about COMMON, SAVE, and the main program>
> Just to complicate things more, some versions of unix have
> the 'sticky bit':
>
> http://en.wikipedia.org/wiki/Sticky_bit
>
> In this case, static storage of a program does not go away
> when the program finishes, but stays around in swap space. If the
> program is run again, previous values for such static data will
> still be available.
>
I don't think so. What wikipedia says, and what I remember, is that
sticky is only for pure text aka code, and possibly pure = readonly
data. But Fortran (standardly) has no way of making _variables_
readonly. PARAMETERs, yes. A compiler might be able to determine that
a particular (initialized!) variable is never (even potentially)
written, and make it readonly, although I'd be surprised if any
bothered to. Thus you could get 'previous' values of static data only
if those are also the 'initial' and 'only' values. As you would expect
for a new program execution = process in Unix.

VMS mapped regions, OTOH, at least certain types of them, could and
did 'remember' between executions and even users. But IIRC you got
such only if the program(s) explicitly asked for it.

- formerly david.thompson1 || achar(64) || worldnet.att.net
From: glen herrmannsfeldt on
David Thompson wrote:

(snip, I wrote)

>>In this case, static storage of a program does not go away
>>when the program finishes, but stays around in swap space. If the
>>program is run again, previous values for such static data will
>>still be available.

> I don't think so. What wikipedia says, and what I remember, is that
> sticky is only for pure text aka code, and possibly pure = readonly
> data. But Fortran (standardly) has no way of making _variables_
> readonly. PARAMETERs, yes. A compiler might be able to determine that
> a particular (initialized!) variable is never (even potentially)
> written, and make it readonly, although I'd be surprised if any
> bothered to. Thus you could get 'previous' values of static data only
> if those are also the 'initial' and 'only' values. As you would expect
> for a new program execution = process in Unix.

It might be that I am remembering another OS with a similar
feature. (Used for things like saving high scores in games.)
The only other OS that I can think of would be TOPS-10.

> VMS mapped regions, OTOH, at least certain types of them, could and
> did 'remember' between executions and even users. But IIRC you got
> such only if the program(s) explicitly asked for it.

So for the unix sticky bit, if a program did modify data
that was stored with code, other executions of that program
wouldn't see the change? It was pretty common for Fortran in
the early days to store data and code together. (Recursion
didn't come until Fortran 90.)

-- glen

From: glen herrmannsfeldt on
David Thompson wrote:
(snip, I wrote)

>>Just to complicate things more, some versions of unix have
>>the 'sticky bit':

>>http://en.wikipedia.org/wiki/Sticky_bit

>>In this case, static storage of a program does not go away
>>when the program finishes, but stays around in swap space. If the
>>program is run again, previous values for such static data will
>>still be available.

> I don't think so. What wikipedia says, and what I remember, is that
> sticky is only for pure text aka code, and possibly pure = readonly
> data. But Fortran (standardly) has no way of making _variables_
> readonly.

Well, I am sure Fortran doesn't have standard ways for two tasks
to share the same storage and properly update shared data.

It seems that it might be TOPS-10 (The DEC OS for the PDP-10)
that I was remembering. I am told that it does have that ability
(and does run Fortran). I don't know if the sticky bit could
be misused for this feature, or not.

-- glen

From: David Thompson on
On Tue, 24 Jun 2008 16:09:48 -0800, glen herrmannsfeldt
<gah(a)ugcs.caltech.edu> wrote:

> David Thompson wrote:

> > I don't think so. What wikipedia says, and what I remember, is that
> > sticky is only for pure text aka code, and possibly pure = readonly
> > data. <snip>

> So for the unix sticky bit, if a program did modify data
> that was stored with code, other executions of that program
> wouldn't see the change?

Right. Any data changes would have to be in the/a writable data
segment, which would be unshared and swapped separately per process
and not saved (hence not reused).

> It was pretty common for Fortran in
> the early days to store data and code together. (Recursion
> didn't come until Fortran 90.)
>
You could do that on Unix with nonpure code+data, but then that code
(and data) couldn't be shared and couldn't be sticky. I don't know if
early Unix Fortrans actually used it this way, as even in the mid70s
it was starting to be frowned on; but I certainly saw it done in asm.

- formerly david.thompson1 || achar(64) || worldnet.att.net