Better Computing through FCS Resident Libraries Joseph Sventek Computer Science & Mathematics Department Lawrence Berkeley Laboratory Berkeley, CA 94720 FCS - File Control Services 1. A set of routines provided in SYSLIB which permit tasks to manipulate files and record oriented devices in a device-independent manner. FCS is the main interface between tasks and the file system. 2. The code for FCS routines operate on control blocks provided by the user and pointed to by the general purpose hardware registers. In this way, these routines are re-entrant - i.e. contain only pure code and pure data. 3. The FCS impure storage area is pointed to by a fixed virtual address in the task header, ".FSRPT". In this way, the re-entrant modules can be written in a position-independent way, allowing them to be linked at any virtual address desired by the programmer. FCSRES Tutorial FCSRES - FCS Resident Library FCSRES is a resident library consisting of FCS modules which is permanently installed in memory in a partition named FCSRES. All programs linked to FCSRES use the single physical copy of the FCS code. Reasons for using FCSRES: 1. Reduce memory contention - if all tasks use the single copy of FCS modules in FCSRES, less memory is used for a given set of tasks => less checkpointing. 2. Reduced disk storage for task images, since the code for the FCS routines does not have to be included in each image. 3. Increased execution speed in heavily overlaid tasks, since the FCS routines reside in the root, and do not need to be read for individual overlays. FCS Routines .ascpp Convert ASCII Directory String to Binary UIC .aslun Assign Logical Unit Number .close Close File .ctrl Device Control Routine .delet Delete File .dlfnb Delete File by Filename Block .enter Insert Directory Entry .extnd Extend File .find Locate Directory Entry .get Get Next Record .gtdid Insert Default Directory Information in FNB .gtdir Insert Directory Information in Filename Block .mark Save Positional Context of File .mrkdl Mark Temporary File for Deletion .open Open File .opfid Open by File ID .opfnb Open by Filename Block .parse Fill in All Filename Information .point Position File to Specified Byte .posit Return Positional Information for FCSRES Tutorial Specified Record .posrc Position File to Specified Record .ppasc Convert UIC to ASCII Directory String .prsdi Fill in Directory Identification Information Only .prsdv Fill in Device and Unit Information Only .prsfn Fill in Filename, File-type and Version Only .put Put Next Record .rdfdr Read $$FSR2 Default Directory String Descriptor .rdffp Read $$FSR2 Default File Protection Word .rdfui Read Default UIC .read Read Next Block .remov Delete Directory Entry .renam Rename File .rfown Read $$FSR2 File-Owner Word .trncl Truncate File .wait Wait for Block I/O Completion .wdfdr Write New $$FSR2 Default Directory String Descriptor .wdffp Write New $$FSR2 Default File Protection Word .wdfui Write Default UIC .wfown Write New $$FSR2 File-Owner Word .write Write Next Block .xqio Queue I/O Function FCSRES Tutorial Building FCSRES >set /uic=[g,m] >pip *.*=[200,200]fcsres.mac >mac fcsres,fcsres/-sp=fcsres >tkb TKB>fcsres/-hd/mm/pi,fcsres/-sp,fcsres=fcsres TKB>/ TKB>stack=0 TKB>par=fcsres:0:20000 TKB>// >set /uic=[1,1] >pip lb:*.*=[g,m]fcsres.tsk,fcsres.stb By default, FCS modules are assembled into PSECT $$RESL. Since all of the FCS routines will NOT fit into one 4096 word segment, it is necessary to leave a few of them out of the resident library. If it is necessary for a task to use one of these entry points in addition to those found in FCSRES, one is forced to not link with the resident library as it now stands. This is due to the fact that the taskbuilder will attempt to extend the PSECT $$RESL to include the extra entry point, which it will be unable to do. The problem can be solved by renaming the PSECT in which the taskbuilder thinks that the FCSRES modules reside. FCSRES Tutorial The following ZAP dialogue does the trick: >run $zap ZAP>fcsres.stb/ab _24% 000:000024% $$R _26% 000:000026% ESL _26/ 000:000026/ 021104 _21103 _26% 000:000026% ESK _x > Now the task builder will permit linkage to FCSRES as well as to the other entry points in SYSLIB. Linking your task to FCSRES >TKB TKB>file,file,file=file TKB>file1 TKB> . TKB> . TKB> . TKB>filen TKB>/ TKB>option=value TKB> . TKB> . TKB> . TKB>option=value TKB>libr=fcsres:ro[:apr] TKB>// FCSRES Tutorial Drawbacks to using FCSRES: 1. Whenever a new system is generated (and a new FCSRES), all tasks which were linked to FCSRES must be re-taskbuilt, since the location of the entry points in the resident library may have changed. 2. In overlaid tasks which rely upon task extension for work areas, such as TKB, the inclusion of FCSRES reduces the amount of virtual address space available for such extension. Non-FCSRES FCSRES -------------------- -------------------- Name Disk Inc=0 Total Disk Inc=0 Total ==== ==== ===== ===== ==== ===== ===== mac 77 54000 70000 57 46500 62500 tkb 163 37600 70000 147 33100 63300 bro 25 26100 26100 15 14400 14400 bye 16 15500 15500 12 11600 11600 cda 159 43300 43300 114 41000 41000 cmp 50 25500 50000 29 23600 46100 cot 24 14600 14600 12 11100 11100 crf 36 24500 40000 24 20100 33400 dmp 55 36400 40000 40 27500 31100 erl 30 26300 26300 16 15400 15400 flx 129 40000 40000 106 36700 36700 iox 99 44000 44000 79 37400 37400 lbr 72 27200 40000 52 26000 36600 pat 45 15100 30000 25 14300 27200 pip 68 34300 40000 50 32000 35500 pse 54 27000 40000 33 15300 26300 slp 48 37200 40000 30 32100 32700 sye 176 40100 70000 155 35000 64700 vfy 56 31600 60000 39 22600 51000 vmr 143 40000 40000 123 33400 33400 zap 38 36100 40000 25 22000 23700