Inter-Office MemorandumToDistributed ComputingDateNovember 26, 1979updatesJune 9, 1980FromGlenn KrasnerLocationPalo Altoupdated by Tim Diebert (CSL)SubjectTape Server SoftwareOrganizationPARC/SSLXEROX Filed on: [IVY]Docs>TapeServerSoftware.memo, .pressOverviewThis document is an explanation of the software written to implement the Tape Server Protocol(TSP) as outlined in [IVY]Docs>TapeServerProtocol.press. For related files, see[IVY]Docs>TapeServerSoftwareOverview.press.The tape server software is a program written in BCPL that implements the TSP for an Alto the hasthe Alto Tape Controller Hardware. It can support up to four drives simultaneously (currently thelimitation is for 2 tape units), each being a 1600 bpi phase-encoded drive running at 45 ips or 125 ips.Currently it has been used on Mohawk and Kennedy drives, but should work on any drive that canbe attatched to the Hardware.The tape software consists of four parts: the tape controller microcode, the tape controller software,the pup package software and the tape server software. Only the latter is described here; forinformation about the other four, see the overview document.The tape server software allows multiple TSP (which uses BSP) connections controlling multipledrives. The details of this are outlined below.StructureThe tape server software source code lives on three files: TSP.decl, TapeServer.bcpl andTSPDOs.bcpl. TSP.decl contains the declarations of constants and structures used by the software.TapeServer.bcpl contains the main-body code, and TSPDOs.bcpl contains the command/messageprocessing routines.In TSP.decl are the constant and structure declarations. Constants include the size of the sharedRead/Write block (rwBlockLength), the size of a typical command record (cmdBlockLength), themaximum number of servers and drives (maxServers and maxDrives), the "well-known" socketnumber for rendezvous in this protocol (tapeSocket) and the number of the current version ofserver software (currentVersion). Also included in the constants are the numbers assigned to eachmessage (command) type (spelled cmd***) and for numbers assigned to each No message type.Structures include the structure for a Service block (see below) and a structure for each message inthe TSP protocol.In TapeServer.bcpl are the static variable declarations, the initialization code and the code that isexecuted by each Server instance. Static variables include the shared Read/Write block (rwBlock),the key to use of that block (rwKey), the key to use of the operator's console (kbdKey), a vector ofpotential id numbers (usedidnos), a vector of potential drives (useddrives) the string describing thecurrent version (currentVersionString), a vector of BSP sockets to be used (bspSockets) and a vectorof server blocks, one used per Server instance, (serviceBlocks).]gpi c8q]rX-q7Br-aq7Br ]q]r -q7Br]\wqF rX Wq]r-q 7BrSsr M? Gt Dr7& C@D A7 >I = 5q ;r&$ :U 8 5U>) 3F 2L< /!8& -0 *rt 'Fr$T% %Q $>,- " *8  /- 4$  R ~"@ @ v&>  S CW F ;-8 J 3@ D >_62In TSPDOs.bcpl are the routines that are run in response to a user message (command). There isone routine per message, plus a few utility routines for common message and message parts. Eachmessage routine parses its own messages. The routines are named "Do" for the givenmessage. (e.g. DoOpenDrive handles an Open Drive message) Also in TSPDOs.bcpl are the replyingroutines ReplyYes, ReplyNo and ReplyStatus (the latter is used when returning device endingstatus).How it WorksThe tape server system is a multi-process system that consists of a connector process, a disconnectorprocess and zero or more active instances of server processes. The connector process watches outfor attempts by users to establish a BSP connection. When one is established, an instance of aserver process is activated and the connector goes back to looking. The disconnector processmonitors potentially open connections for disconnections. When one is caught, its correspondingserver instance is killed. This catches normal as well as abnormal disconnections. Each serverprocess waits for a TSP Version message block. Once a Version message is received, the serversends a Version reply and waits for another message. When a message is received, the server runsthe corresponsding Do*** routine to process that message and then waits for the next.Server instances consist of a BCPL process running the Server() routine and pointing at a data blockcalled a Service block which holds the data unique to this server. Included in the Service block area unique id number for this server (>>Service.idnumber), a BSP socket and corresponding stream(>>Service.bspSoc and >>Service.bspStr), a pointer to a block to be used by all commands exceptReads and Writes (>>Service.cmdblock), a pointer to a tape block (>>Service.tape, see XEOS tapedocumentation), the drive, if any, that this instance is using (>>Service.drive), the number of retriesand the tape speed.The routine StartServing() initializes the tape server system. It loads the microcode, allocatesService blocks, command blocks, process contexts and BSP structures and opens the low level BSPto listen to the "well-known" socket. It then passes control to the other processes.Connector() is the connector process routine. When a packet is heard at the rendezvous "well-known" socket, it checks to see if it is a good request for connections. Conditions that cause badconnection requests are broadcast packets, duplicate connection requests, or lack of available servers(current number of servers = maxServers). If none of these conditions holds, then InitializeServer()is called to initialize the Service block for a server, and that server is activated. DisConnector() looks down the list of used idnumbers to see which have activated servers. Foreach, the BSP connection is checked to see if it is open. When one is found that is not open, theserver's keys are returned, its tape closed if open, its BSP stream closed and its server deactivated.As mentioned above, Server() is the routine that handles each server instance, waiting for a Versioncommand and then dispatching to the appropriate Do** routine to parse and respond to the rest ofthe commands. MiscellaneousIn this section are listed some peculiarities about the server software that may be worth noting.Unfortunately they are in random order.The Read/Write block is shared by all server instances. This allows the software to staticallyallocate one 16k-word block to handle the largest expected record. In the future, we may wanteither dynamic allocation or a smaller non-shared block statically allocated for each server.Message replies attempt to correspond to the messages. For example ReadRecord will reply No ifEnd of File is seen, but WriteEOF will not. I will not list here who replies how; if you areinterrested, either read the code, see me, or force me to include it here.Nfr b;$ `Z _R ] uqr' \= Z W^t T3r50 RI Q+Q O O N#)7 L(8 KK IR HU DL CcB# AH @[_ >:% =Sg ; 8&; 7_ 5U 2p@ 0T /hS -;* ,_V )4"< '02 &,Y ##A !}X  t rB ' H n:$ ] %: ;M JF p>\S3The only status parameters allowed to be changed are number of retries and drive speed. Thismeans that there is no software write protection or other such feature.The "well-known" socket number is 44b. This was assigned to Tapes from the keeper of the keysin Webster. Major changes to this assignment should go through there.Messages are responded to in order. The length field of a message received from a user determinesthe length of data until a new message block is expected. There is no provision for getting backinto synch with a bad user. The only known way is for the user to allow its BSP connection to timeout, and to establish a new connection.Building Your OwnBelow is the command line used to link up the TapeServer.run file for the tape server software. Tobuild one's own mutation of the system, one should edit and compile the corresponding .bcpl file,and have the other .br files around to link and load in. I have not described every .br file in thelist, it should be clear from the TapeServerSoftwareOverview document which files do what.bldr/f 470/w TapeServer TSPDOs TapeIO LoadRam TapeTfsSwat Pup1b Pup1Init Pup1OpenClose PupAl1a PupAlEthaPupAlEthb PupAlEthInit altobyteblt altoqueue altotimer PupBSPa PupBSPBlock PupBSPOpenClose PupBSPProtPupBSPStreams context contextinit PupDummyGate interupt intiniterupt PupNameLookup PupRoute PupRTPPupRTPOpenClose TapeMicrocodeXM CommentsI am willing to make changes to the system at least for the next while, at least until there are somefrequent users. Please send me any comments, questions or problems you have with this document or with thesystem.Nfr b0- `G ]nU [F XB W;/2 U%> T3' Qt Mr&= LX7* J@$ IPT FHq.; E (J) CF!GA Blr ?At <r` : 7f; 5X 5=2p TIMESROMAN  TIMESROMAN TIMESROMAN LOGO TIMESROMAN  TIMESROMAN Zj/l4TapeServerSoftware.memoDiebertJune 9, 1980 5:10 PM