The user controls the actions of the Context Switcher with the Context Switcher command system described later in this section.
Space and CPU
Context are therefore the prime tool the user has to allocate his or her space resources. Objects that last a long time should be built in contexts that will last a long time. Objects that are being tested should be built in contexts that can be destroyed. In the extreme case one might use a separate context for each object. In practice contexts are associated with "projects" much like sub-directories are used in UNIX. The important difference between sub-directories and contexts is that context can be used to manage resources as well as to manage the name space.
The root directory of the context may be thought of as a directory with the context name (much as the spacebank is "named"). The initial content of the context directory includes the context SPACEBANK and METER and a key to a directory shared by all contexts created by a single instance of the Context Switcher. This shared directory is called USER. and should not be thought of as the user's root directory because there is no such concept. The context directories are not subdirectories of the USER. directory.
Within the USER. directory can be found keys to more global directories. USER.GROUP. (now known as USER.PUB.) is a key shared by all users administered by a single administrator. USER.SYS. is a subdirectory containing widely available "system" utilities. (asside: SYS. should properly be a sub directory of GROUP. as in USER.GROUP.SYS. which would allow different views of the system for different groups. This is not implemented now but may be in the future.)
It should be clear that directories and contexts are organized differently and each is managed in its natural way. In KeyKOS keys to objects and objects themselves are managed separately. Keys to objects are stored in directories and objects are built from spacebanks. Deleting a key from a directory does not effect the object. However, reclaiming the space of an object by destroying the context it was built in does turn all keys to that object (no matter what directory they are in) into zero datakeys. Copying a key to an object to different directories does not alter the impact of destroying the context in which the object is built but does determine who can access the object (use the key to the object). This allows (and requires) the user to manage these separate concepts differently.
A branch might be thought of as a window on the screen (only one of which can be open at a time in the current implementation) however, one should not think of these windows as vessels. Branches are not allocations of space but simply a named path to a terminal. Each branch initially has a name (each window has a name) that is derived from the SWITCHER key used to obtain the branch. The name of a branch is a concatenation of the context name in which the SWITCHER key was located with some letters beginnning "A" through "ZZ". This name is only a convenience and has no cosmic significance.
A branch is an object. The SIK, SOK, CCK keys refer to this object. The branch object holds a key to a particular multiplexor and the user object that holds the SIK, SOK, CCK keys to that branch object communicate through the multiplexor that the branch object holds a key to. When a branch is obtained from a SWITCHER key, the branch holds keys to the multiplexor used by the Context Switcher managing that multiplexor. The space for the branch object is taken from the context in which the SWITCHER key is found. A branch can be disconnected from a multiplexor and connected to another (or the same) multiplexor using some SWITCHER key. When a branch is moved in this way its name changes based on the SWITCHER key used to connect it but the branch object will be destroyed when the original context is destroyed.
Command systems are simply one object that runs within a context. A user may create other command systems in the same context. All programs in a context have the same authority (the keys in the directory of the context). A user may write his or her own command system in a fashion similar to any other application.
The key USER.SWITCHCMD can be used to select alternate command systems for contexts created after a call to USER.SWITCHCMD.
CO(0;DIRECTORY) a fork.
The command syntax is ill-defined at this point. An attempt has been made to provide compatibilty with the current switcher. This compatibilty issue makes for some rather odd conventions. It is assumed that if this experiment is a success, the command system will be redesigned and maybe even integrated with the "New Command System".
Contexts and branches are time stamped when they are created and the time stamp is printed on the STATUS display.
A bell will sound any time a branch becomes active. This behavior differs from the old switcher.
Nesting of context switchers is not recommended. The SWITCHC key may be used to obtain simple switchers within a context.
In the command descriptions below the short (3 character) version of a command (if it exists) is shown in parenthesis after the command description. When the context-name is shown as optional (between curly brackets) the "current context" is substituted. The current context is the last one active or displayed via "STATUS" or "OUTPUT".
There are seven "alert fields" in the status area (numbered 1-7) and each of these has a corresponding character that displays if the number of branches in alert status designating the numbered field is non-zero. The character disappears when the alert condition for all branches designating the same "alert field" has been cleared. Switching to the branch clears the condition for that branch.
Branches in "alert" status will not be switched to automatically. They must be switched to explicitly. The STATUS command will show a branch in "alert" status and show what the current alert character is for its "alert field"
ALERT FOO.A 5 causes the FOO.A branch to go into "alert" status. When FOO.A has output pending the "alert field" character selected (via the ALERTCHAR command) will be displayed in the 5th alert position of the 3270 status area.
ALERTCHAR 5 M sets the "alert field" display character for field 5 to an M
NOALERT FOO.A restores the branch to the normal automatic switch to active branch mode.
The presence of the ".*" after the context idenifier indicates that the branches and their descriptions are to be listed as part of the information about a context. The dot "." may be replaced by a blank for compatibility with the previous implementation.
If no contexts match the context identifier then a message to that effect is printed.
Slot 1 SOK3
Slot 2 CCK3
Slot 3 SB2 This spacebank is subdivided to provide contexts with their own guarded banks
Slot 5 Context switcher database (record collection)
The records in this record collection are described here. There are 4 types of records. A master record holds a copy of the original parameter node with additional keys, a context record describes each context, a branch record describes each branch, and a BID record exists for each BID assigned. All Names are in ASCII and fixed in length with trailing blanks.
TYPE 2 - Context records NAME=(16,context) STRING=(48,context block)
Slot 0 - The context spacebank]
Slot 1 - The context meter node]
Slot 2 - The context directory]
Slot 3 - Small integer allocator for branch names] Slot 4 - Switcher key NODE for this context] Slot 5 - Key to the node in master record
Slot 0 - The CCK3 key for the branch]
Slot 1 - The ZMK key for the branch]
Slot 2 - THe CCKZ key for the branch]
Slot 3 - Data key with BID
c = 2 SB out of space
The following calls are for the SWITCHER key that is in the directory of the created command system. Its behavior is much like the old switcher key (p2,switcher) with the addition of the "destroy branch", "switcher to branch", and "describe branch" operations.
SWITCHER(0; ==> c,(name);CCK4,SIK4,SOK4) create branch in this context
SWITCHER(2;ZMK ==> c,(name)) attach branch to this context
SWITCHER(3,(name); ==> c) destroy branch
c = other nonzero values mean big trouble
c = 5 branch not found
c = other nonzero values mean big trouble