Article View: comp.lang.asm370
Article #62Re: (no subject given)
From: Michael Johnson
Date: Thu, 29 Jun 1989 15:29
Date: Thu, 29 Jun 1989 15:29
56 lines
3041 bytes
3041 bytes
The basic definition of a reentrant program is one that can be executed by two
separate control threads simultaneously without harm. I.e. the program can be
entered, then reentered, without ill effect.
In practical terms what this means is that all of your variables must be in a
free storage area acquired by the program. The address of this storage area
must be in a working register which the program uses as a base register.
For a truly reentrant program, these storage areas must either have a lifetime
only as long as the invocation of the program, or must exist in completely
different address spaces. The "reentrant" code in the CMS nucleus works by this
latter approach. The variables it uses are in the storage of the virtual
machine. Separate invocations of the CMS nucleus (i.e. IPL CMS) address totally
different address spaces, even though the nucleus code itself is being shared
by many virtual machines.
For all practical purposes, programs that you write to run under CMS but which
you want to have be reentrant need only acquire and release dynamic storage to
keep their variables in. If you do this (and don't write self-modifying code)
then you will be writing reentrant programs. Most macros in CMS that build
parameter lists have an MF=L and MF=(E,list) format. The MF=L is used in the
DSECT for your storage area. The MF=(E,list) is used to make the macro build
its actual parameter list in your working storage.
For example, the following code section illustrates:
LA R0,WORKSIZE Get size of work area in dwords
DMSFREE DWORDS=(0),ERROR=NOSTORE
LR R10,R1 Load WORKAREA base address
USING WORKAREA,R10
ST R10,WORKWORD Set USER WORD value
HNDIO MF=(L,HNDIO) Initialize HNDIO plist
.
.
.
HNDIO SET,DEVNAME=RDR1,MF=(E,HNDIO),EXIT=RDREXIT,
DEVICE=00C,UWORD=(R10)
.
.
.
WORKAREA DSECT ,
WORKWORD DS F
WORKSAVE DS 18F
HNDIO HNDIO MF=L
.
.
.
Where I have put in periods there would logically be code to do other things.
I merely have illustrated the major elements of using a macro with MF= to
write reentrant code.
Michael Johnson "We are the Priests of the Temples
University of Maine System of Syrinx. Our great computers fill
Computing and Data Processing Services the hallowed halls." - Neil Peart
Technical Details
Message-ID:
<8907010024.AA16862@jade.berkeley.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!MAINE.BITNET!MICHAELShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!MAINE.BITNET!MICHAEL From: MICHAEL@MAINE.BITNET (Michael Johnson) Newsgroups: comp.lang.asm370 Subject: Re: (no subject given) Message-ID: <8907010024.AA16862@jade.berkeley.edu> Date: 29 Jun 89 15:29:09 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: IBM 370 Assembly Programming Discussion List <ASM370%UCF1VM.bitnet@jade.berkeley.edu> Distribution: inet Organization: The Internet Lines: 56