[comp.os.vms] BOSS 2.4 2/4

KARNEY%PPC.MFENET@NMFECC.ARPA (07/19/88)

+-+-+-+ Beginning of part 2 +-+-+-+
XAt present BOSS only knows about three types of terminals: VT100, ADM3A, and
XUNKNOWN.  The last choice makes minimal assumptions about the terminal, and
Xshould always give a reasonable display.
X2 Process_types
XBOSS deals with two types of processes: subprocesses and top-level
Xprocesses.
X
XSubprocesses are what you get with the DCL command SPAWN.  They inherit
Xsymbols and logical names from the parent process (i.e., BOSS itself) at
Xcreation time.  The resources it uses count against the parent's quotas.
XThe number of subprocesses is governed by your subprocess quota.
XSubprocesses share the job logical name with the parent process.  This gives
Xa way for subprocesses to communicate with one another and with their
Xparent.
X
XTop-level processes acts just like an entirely new login session (as though
Xyou had done SET HOST 0).  Indeed, you have to log in to get the process
Xgoing.  The resources that such processes use do not count against the
Xparent's quotas.  SHOW USERS will show that you are logged in multiple
Xtimes.
X
XWhich type of process should you use?
X
XIn most cases subprocesses are best.  These usually are quicker to get
Xstarted (since you don't have to go through the login procedure again).
XBOSS is able to set the process name and DCL prompt to include the process
Xlabel.  Synchronous switching to another process from a subprocess is
Xpossible using the BOSS$SWITCH and BOSS$STUFF job logical names.
X
XWhen should you use a top-level process?  Here are some cases:
X* You need to log in as someone else.
X* You need to run a large program that uses all of one of your quotas.
X* You need to run with a different CLI. Log in with e.g., /CLI=SHELL.
X* Your subprocess quota is too low to allow you to create subprocesses.
X
XType C-\ C-n a to start subprocess A; type C-\ C-t b to start top-level
Xprocess B.
X2 Output_flags
XEach process has an output flag which may be set by C-\ followed by one of
XC-b, C-o, C-p, or C-w (this sets the flag to b, o, p, or w, resp.).  This
Xflag governs what BOSS does to the output of a process which is not current.
X(The current process always gets its output displayed immediately.)  The
Xmeanings of these settings are
X
X b  Buffer output for this process.  Output is saved in a 4k buffer.  Buffer
X    is output when the process becomes current.  The process hangs when this
X    buffer fills.  This is useful for running a program which dribbles
X    output which you do not want to lose.  In the process list (obtained by
X    C-\ ?), a - indicates that there is output ready to be displayed, and a
X    + indicates that the buffer is full (and the process is probably
X    hanging).
X
X o  Discard output for this process.  Only the most recent write will by
X    output when the process becomes current.  This is useful for running a
X    program which periodically outputs some straightforward information such
X    as ``Processing record 103', where all you care about is the most recent
X    output.  In the process list, + means that there is output available
X    (but the process is continuing to run).
X
X p  Print output from this process.  Output is output to the terminal
X    regardless of whether this is the current process or not.  This is
X    useful if you need to be informed when a program completes.  Also it can
X    be used to display status information periodically on your screen (see
X    subtopic Examples).
X
X w  Stop output from this process.  The process can do a single write which
X    will be accepted and saved by BOSS.  The process will then hang when it
X    attempts to do the next write.  In the process list + means that there
X    is output available (and the process is probably hanging).
X
XThe default output flag is b.  The default can be changed by using the
XDEFAULT_OUTPUT_FLAG qualifier or by issuing one of the flag setting commands
Xwhen there is no current process (i.e., immediately after starting BOSS or
Xafter logging out of a process).
X
XThe best setting of the output flag very much depends on your application.
XYou will probably find the best setting to be b (the default).  If one
Xprocess is attempting to act synchronously with another, it may be necessary
Xto set their output flags to w.  However, if your synchronous switches are
Xall performed via the BOSS$SWITCH mechanism, this isn't necessary since BOSS
Xtemporarily sets the output flag to w on these types of process switches
X(see topic Communicating).
X
XA potential problem with the b setting is that BOSS empties the buffer to
Xyour terminal in a single operation.  This may overflow your terminal's
Xinput buffer (this is not a problem with a Mac running VersaTerm at 9600
Xbaud).  This is not a problem if BOSS is used with the /FLOW_CONTROL
Xqualifier (assuming that your terminal does flow control).
X3 Examples
XSuppose TIME.COM contains:
X    $ esc[0,8]=27
X    $ sc = esc + "7"                    ! Save cursor
X    $ rc = esc + "8"                    ! Restore cursor
X    $ home = esc + "[;76H"              ! cursor to top right of screen
X    $ invert = esc + "[7m"              ! inverse video
X    $ revert = esc + "[m"               ! normal
X    $10$:
X    $ time = sc+home+invert+f$extract(12,5,f$time())+revert+rc
X    $ read/prompt="''time'"/end=43$/error=42$/time_out=0 sys$command dummy
X    $42$:
X    $ wait  ::5
X    $ goto 10$
X    $43$:
X
XThis displays the time at 5 second intervals in the top right corner of
Xthe screen.  If this is running in a process whose output flag is p, the
Xtime will displayed while in other processes.
X2 Communicating
XBOSS and the subprocesses under it can communicate via logical names.  These
Xonly work for BOSS's subprocesses, not for its top-level processes (because
Xonly the subprocesses share the job logical name table with BOSS).  The
Xfollowing are recognized:
X
XBOSS$ID (in process table);  BOSS defines this as the identifying letter of
Xthe process.  This can be used in tailoring the DCL prompt etc.;  e.g.,
X    $ set prompt "boss-''f$trnlnm("boss$id")'>"
XIt can also be used to indicate to a program that it is running under BOSS.
X
XBOSS$SWITCH (in job table); whenever BOSS is writes output to the real
Xterminal, it checks whether BOSS$SWITCH is defined.  If it's defined as a
Xsingle letter, BOSS will switch to that process and delete the logical name.
XIf the process doesn't exist it is created as a subprocess.  Thus a DCL
Xprocedure can initiate a switch to process G with
X    $ define/job boss$switch g
X    $ write sys$error ""        ! do some output to make BOSS wake up
XThe switch takes place synchronously by setting the output flag for the
Xoriginating process to w temporarily (see topic Output_flags).  Both
XBOSS$SWITCH and BOSS$STUFF should be defined as supervisor mode logical
Xnames in the job table.  They may be defined from programs with e.g.,
X    status:=lib$set_logical('BOSS$SWITCH','D','LNM$JOB');
X
XBOSS$STUFF (in job table); whenever a BOSS makes a process initiated switch.
XIt stuffs the definition of BOSS$STUFF into the input stream of the process
Xbeing switched to.  After being used, BOSS$STUFF is deleted.
X3 Examples
XThe following command procedure will do a SHO DEF and leave SHO DEF in the
Xrecall buffer:
X    $ cr[0,8] = 13
X    $ define/job boss$stuff "sho def''cr'"
X    $ define/job boss$switch 'f$trnlnm("boss$id")'
X
XHere's how to switch to process F and have the present job continue
Xrunning:
X    $ define/job boss$switch f
X    $ char[0,8] = 22                    ! control-V
X    $ gosub out_char
X    $ return
X    $!
X    $out_char:                          ! Spit out the character
X    $ read/prompt='char'/end=40$/error=40$/time_out=0 sys$command dummy
X    $40$: return
X
XIf you want the present process to wait, then repeat the ``gosub out_char'
Xthree times.
X
XReturn paths may be implemented via additional logical names.  E.g., the
Xprocedure that runs Emacs under BOSS does the following.
X
XIf Emacs isn't running (boss$emacs undefined) do
X    $ define/job boss$emacs 'f$trnlnm("boss$id")'
Xand start Emacs.
X
XIf Emacs is running (boss$emacs defined) do
X    $ define/job boss$return_switch 'f$trnlnm("boss$id")'
X    $ define/job boss$switch 'f$trnlnm("boss$emacs","lnm$job")'
X    $ gosub out_char
X    $ gosub out_char
X    $ gosub out_char
X
XThe suspend-emacs function in Emacs is redefined to do the equivalent of
X    $ define/job boss$switch 'f$trnlnm("boss$return_switch","lnm$job")'
X    $ deassign/job boss$return_switch
X    ...
X
XSimilarly boss$return_stuff may be used as the string to stuff into the
Xprocess on return.  The edit procedure that is called on a TeX error may
Xset this to the current TeX command line so that on exiting from the
Xeditor the user has the input buffer prepared with the command to re-run
XTeX.  The user then has the option either of accepting the command (by
Xtyping return) or cancelling it (with C-u).
X2 Broadcasts   `032
XWhen running running under BOSS, there is the potential that you will
Xreceive multiple copies of the same broadcast.  In order to understand what
Xis going on, it is useful to distinguish 3 types of broadcast messages:
X
X(1) Broadcasts to a specific process.  E.g., the response of the system to
Xcontrol-t.  These typically are sent to one of the processes under BOSS.
X
X(2) Broadcasts to top-level processes.  E.g., mail notification.  These are
Xtypically sent to the process running BOSS and any top-level processes
Xunder BOSS.
X
X(3) Broadcasts to all terminals (including pseudo terminals).  E.g.,
Xshutdown messages.  These are typically sent to the process running BOSS and
Xall processes under BOSS.
X
XIn order to help manage broadcast messages, BOSS intercepts any broadcasts
Xsent to the process running BOSS, and rebroadcasts them to the current
Xprocess.  The rebroadcasts are of type USER16.  This allows you to shut
Xthese rebroadcast out with SET BROAD=NONE or SET BROAD=NOUSER16.  Control-s
Xalso works to defer broadcasts.  Any broadcast handlers which the current
Xprocess has active will be called to process the broadcast.
X
XIn order to avoid getting multiple copies of the same broadcast, here's what
Xyou should do:
X
XIn each subprocess under BOSS, disable type 3 broadcasts, i.e., do
X    SET BROADCAST=NOSHUTDOWN    ! plus others maybe?
X
XIn each top-level process, disable type 2 and 3 broadcasts, i.e., do
X    SET BROADCAST=(NOSHUTDOWN,NOMAIL,NOQUEUE,NOPHONE)   ! plus others?
XThis assumes that you are logged into the top-level process under the same
Xusername.  If using a different username, then you wouldn't want to disable
Xmost (all?) of the type 2 broadcasts.  For example, we would want to permit
Xmail notification.
X
XIn order to stop broadcasts to a particular process, do
X    SET BROADCAST=NONE
X
XThere are some drawbacks with way BOSS rebroadcasts messages:
X
X* There is no way of determining the original type of the broadcast was
X(MAIL, PHONE, etc.).  For this reason, BOSS rebroadcasts everything as
XUSER16.
X
X* If the rebroadcast fails, because the current process has broadcasts
Xdisabled, then there is no way of getting this information to the original
Xsender.  E.g., if you SET BROAD=NONE is a process under BOSS and someone
Xtries to PHONE you, he will not be notified that you're not getting his
Xconnection requests.
X2 New_features
X(1.7) Incompatible change: C-\ C-n x required to create a new process.  Use
XBOSS/SWITCH_CREATE to get the old behavior (where C-\ x would create process
XX if it doesn't exist).
X
X(1.7) C-\ C-t x creates a process at top level.  See topic Process_types.
X
X(1.8) BOSS accepts various qualifiers when it starts.  These control the
Xcommand character, DCL prompt string, etc.  They also can be used to tell
XBOSS to start various processes.  See topic Qualifiers.
X
X(1.9) Broadcast messages sent to the process running BOSS are trapped and
Xrebroadcast to the current process.  See topic Broadcasts.
X
X(2.0) /DELETE_CHARACTER=num added to allow interchange of some character
Xwith delete.  See topic /DELETE_CHARACTER.
X
X(2.1) Logical name BOSS$TERM looked at to determine terminal type.  See
Xtopic Terminal_types.
X
X(2.2) BOSS fixed to work with new release of pseudo TTY drivers.
X
X(2.4) /FLOW_CONTROL added to allow flow control by the top-level process.
XSee topic /FLOW_CONTROL.
X2 Bugs
XBOSS does single character input.  This is rather slow.  Don't expect it to
Xbe able to keep up with lots of data coming from the terminal.
X
XThe output on some terminals (Visual 550s in particular) at 9600 baud may
Xhave glitches in it.  This is because these terminals need flow control
Xenabled to operate at 9600 baud, but BOSS doesn't react quickly enough to
Xthe control-s sent by the terminal.  The solution is to run at 4800 baud or
Xslower or to use the FLOW_CONTROL qualifier to BOSS.
X
XI have seen various strange bugs occurring when using BOSS.  These are all
Xassociated with VMS running out of some quota.  The symptoms range from BOSS
Xhanging while creating a process (because LIB$SPAWN does not return) to
XSYS$LIBRARY being mis-translated by LINK.  As far as I can tell these
Xproblems occur only because of the additional stress multiple running jobs
Xputs on a users quota's and not because of BOSS problems per se.  The
Xculprits is usually BYTLM (8000 is too low, 40000 is OK).  However PGFLQUO
Xis another quota to check.
X
XOutput gets garbled when using BOSS via SET HOST (i.e., SET HOST followed by
XBOSS).  This happens when you type while output is coming to your terminal.
XThe symptom is that the lines come out in the wrong order.  It's OK to use
XSET HOST while in BOSS (i.e., BOSS followed by SET HOST).
X
XI know of one program SMP (an algebra system) that grabs the entire PGFLQUO
Xon startup.  This obviously interfers with BOSS's other processes.  The
Xsolution is to use a top-level process to run SMP (see topic Process_types).
X
XPC file transfer using the XMODEM protocol (e.g., with MACX) doesn't work
Xthrough BOSS.  Kermit seems to work fine.
X
XAttempting to attach to the process running BOSS from one of its
Xsubprocesses causes a hangage.
X
XControl-\ is used by the Switcher program on the Macintosh.  If you are
Xrunning your terminal emulation program under Switcher, you need to check
X``Disable keyboard switching' in the Options menu item in Switcher.
XAlternatively you can select a different command character with the
XCOMMAND_CHARACTER qualifier.
$ GOSUB UNPACK_FILE
$ FILE_IS = "BOSS.C"
$ CHECKSUM_IS = 1802526355
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X/* BOSS interactive job controller.
XCopyright (c) 1987, 1988 by Charles Karney.  All rights reserved.
X
XWritten by
X    Charles Karney
X    Plasma Physics Laboratory   Phone:   609/243-2607
X    Princeton University        MFENet:  Karney@PPC.MFENET
X    PO Box 451                  ARPANet: Karney%PPC.MFENET@NMFECC.ARPA
X    Princeton, NJ 08543-0451    Bitnet:  Karney%PPC.MFENET@ANLVMS.BITNET
X
XBased on the PHOTO program of Asbed Bedrossian (USC, asbed@oberon.usc.edu).
X
XIt utilizes the Pseudo TTY package of Dale Moore (CMU,
XDale.Moore@PS1.CS.CMU.EDU) and Kevin Carosso (Network Research Co.,
Xkvc@nrc.com, kvc@ymir.bitnet).
X
XDESCRIPTION:
X
XBOSS lets you create up to 8 processes on a VAX/VMS system.  Each process
Xis identified by a single letter (A thru Z).  At most one of these
Xprocesses is ``current'.  What you type is sent to that process, and output
Xfrom that process is sent to your terminal.  A process which is not current
Xcan run but cannot do output.  (Output is saved until you make that process
Xcurrent.)  You usually switch between processes by typing control-\
Xfollowed by the identifying letter.
X
XYou can run any program under BOSS.  For example, you might
X    run Emacs or EVE                   in process E
X    SET HOST to another machine        in process H
X    do a FORTRAN compilation           in process F
X    execute DCL commands               in process D
X    talk to your colleague using PHONE in process P
Xand so on.
X
XINSTALLATION:
X
XCompile and link with
X    $ @boss_build
XInstall with`032
X    $ @boss_install`009`009! This goes in the system startup file
X
XIn order to run BOSS, you will need pseudo TTYs installed on your system.
XContact me if you need a copy of this software.
X
XBOSS can be operated without installing it with privileges (but you will
Xstill need the pseudo TTYs installed).  If BOSS doesn't with PHY_IO
Xprivilege, then it won't be able to set the terminal type of the processes
Xunder BOSS (SHOW TERM will list the device type as UNKNOWN); the terminal
Xtype can be set with SET TERM.  If BOSS doesn't have OPER privilege, then
Xit won't be able to rebroadcast broadcast messages that it receives;
-+-+-+-+-+ End of part 2 +-+-+-+-+-