On Tue, Nov 26, 2019 at 1:21 PM Seymour J Metz <[email protected]> wrote:

> What makes your program non-reentrant is failing to serialize shared data.
> Long ago in a galaxy far away IBM actually shipped reentrant code that
> modified itself; AFAIK they have cleaned up that abomination.
>

I agree that it's an abomination. But I have done it for a shared
subroutine in a multitasking system. It was reentrant. What was modified
was a 4 byte address. The code looked to see if the area was zero. If it
was, I would do a GETMAIN. I would then update the address area using a CS
to serialize the update. If the CS "succeeded", I would build a R/O table
in that area. If the CS "failed", I would do a FREEMAIN of the storage.
After this, I picked up the address and used it. This is reentrant
according to the defination in Wikipedia:
https://en.wikipedia.org/wiki/Reentrancy_(computing)

====
In computing <https://en.wikipedia.org/wiki/Computing>, a computer program
<https://en.wikipedia.org/wiki/Computer_program> or subroutine
<https://en.wikipedia.org/wiki/Subroutine> is called *reentrant* if
multiple invocations can safely run concurrently. The concept applies even
on a single processor system, where a reentrant procedure can be
interrupted in the middle of its execution and then safely be called again
("re-entered") before its previous invocations complete execution. The
interruption could be caused by an internal action such as a jump or call,
or by an external action such as an interrupt
<https://en.wikipedia.org/wiki/Interrupt> or signal
<https://en.wikipedia.org/wiki/Signal_(computing)>. The previous
invocations may resume correct execution before the reentered invocation
completes, unlike recursion
<https://en.wikipedia.org/wiki/Recursion_(computer_science)>, where the
previous invocations may only resume correct execution once the reentered
invocation completes.

====

Of course, in the latest z/OS code marked RENT (or is it REFR?) I think is
loaded into key 0 storage and my code will fail, just like it does if it's
loaded into LPA. I know of vendors in the past who demanded that their code
be loaded into MLPA to avoid the "no store here". I have seen other code
actually go key 0, change the protection on an LPA page to R/W, updated it,
then change the protection back to R/O.

All of the above is poor coding in today's environment. Today, I would use
some some of Name/Token to "anchor" a data area.



>
> In the case of WTO, use of MF=L in the CSECT does not keep the code from
> being reentrant if, as you describe later, the only use made of it is to
> initialize dynamic storage. Used that way there are no shared data, hence
> no need serialize.
>
>
> --
> Shmuel (Seymour J.) Metz
> http://mason.gmu.edu/~smetz3
>
> send email to [email protected] with the message: INFO IBM-MAIN
>


-- 
People in sleeping bags are the soft tacos of the bear world.
Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to