USING MULTIPLE INTERACTIVE PROGRAMS

Dec. 28, 2011

TOPS-20 allows you to use multiple interactive programs simultaneously
from a single login session. For example, in the middle of editing a
document you can run other programs or commands, lookup help files,
refer to e-mail messages, etc., and then return to your editing
session in the same state you left it.

(Multiple non-interactive programs can be run using the TOPS-20 batch
facility. See the TOPS-20 User's Guide[1] chapter 10 "Using Batch".)

The functions described in this tutorial are equivalent to those on
Unix systems invoked with the Ctrl-Z key and commands like fg, jobs,
etc.

There are two ways to run multiple interactive programs[2] in TOPS-20:

1. Push/Pop: From an interactive session you run another program, then
   return to the first program when the called program is complete.

2. Multiforking: You run two or more interactive programs in parallel
   and switch among them as needed, preserving the program session
   state from the last time you visited the program.


PUSH/POP

This method involves starting a new EXEC command level subordinate to
your login EXEC. The state of your original program is preserved in
your login EXEC while you run one or more programs in the child EXEC
level. When done, you terminate the child EXEC and return to your
original program.

	*^C			! Return from program session to EXEC
	^C			! (only single ^C will echo).

	@PUSH			! Start child EXEC instance.

	 TOPS-20 Command processor 7(4168)-1
	@MM                     ! Start a program in the child EXEC.

	...			! Use program then exit.

	@POP			! Terminate child EXEC and return to
				! parent EXEC.

	@CONTINUE[3]		! Return to original program session.
	*			! Depending on the program you may 
				! continue entering commands or
				! refresh the display.


MULTIFORKING

With multiforking, you run multiple programs in the same EXEC by
forking a separate address space to maintain each program's state. You
can then move between the forks and their corresponding programs at
will. You do not need to end a program before returning to a
previously used program session, and may revisit any of the forked
programs multiple times preserving each program's session status.

	*^C			! Return from program session to EXEC
	^C			! (only single ^C will echo).

	@KEEP			! Create separate address space for
				! new program.

	@MM                     ! Start new program.

	...			! Use program.

	MM>^C			! Return from second program to EXEC.

	@INFORMATION FORK-STATUS[3]
				! List forks in current EXEC.
				! (Current fork marked with "=>".)

	    TECO (1): Kept, ^C from IO wait at TYI+3, 0:00:00.0
	 => MM (2): ^C from IO wait at $COMND+3, 0:00:00.0

	@FORK TECO		! Switch to original program's fork
				! ("TECO").

	@CONTINUE		! Return to original program session.

	...			! Use original program.

	*^C			! Return to EXEC.

	@INFORMATION FORK-STATUS 
	 => TECO (1): Kept, ^C from IO wait at TYI+3, 0:00:00.0
	    MM (2): ^C from IO wait at $COMND+3, 0:00:00.0

	@FORK MM		! Switch to second program fork ("MM").

	@CONTINUE		! Resume second program session.


MORE INFORMATION

More information can be found in TOPS-20 User's Guide[1] sections 8.6
"Running Programs Without Destroying Memory" and 8.7 "Running Multiple
Programs".


NOTES

[1] TOPS-20 User's Guide. Available on Twenex.org in file 
    DOC:USERS.MEM or on the WWW at http://tilt.twenex.org/.

[2] It is only necessary to use these methods when you wish to use two
    or more user programs at the same time. Running a user program
    from EXEC without first running PUSH or KEEP will overwrite the
    user program address space and destroy the session state of the
    previously running program. However, EXEC commands generally do
    not disturb user program address space. You can halt an active
    program (with ^C^C), run several EXEC commands (e.g. DIRECTORY,
    HELP, TYPE), and return to your original program (with CONTINUE)
    in the state you left it.

[3] EXEC commands and options may be abbreviated to the minimum unique
    prefix, for example: 

	CONTINUE		=> CONT
	INFORMATION FORK-STATUS	=> IN FO