PN-104 An Overview of RSX-11M __ ________ __ _______ Robert J. Dosen Fermi National Accelerator Lab April 3, 1978 Abstract ________ This note serves as an introduction to the RSX-11M operating system concepts and attempts to summarize the information contained in various RSX-11M manuals. The goal of this document is not to be a user's guide but rather to provide insight into the system design philosophy and to explain the basic facilities and concepts of RSX-11M. Page 2 RSX-11M is a real-time multiprogramming operating system designed for the PDP-11 range of computers. The system was designed to provide quick response to real-time events and to allow real-time activity to be combined with program development and other less time-critical applications. This paper presents an overview of the RSX-11M Executive and File System. RSX-11M was designed to be able to be tailored to individual applications. Therefore, many options are available and system generation is a lengthy process. Some options can exist only on a large system while certain other features are useful in obtaining flexiblilty from a small system. An in-depth discussion of all options and systems concepts is beyond the scope of this document. This paper discusses some Executive options such as disk swapping, checkpointing, and round-robin scheduling which are useful in both large and small systems. Executive interrupt processing is discussed in some detail since it is the heart of the Executive. The I/O system, memory management, CPU scheduling, and the command interface are discussed briefly and the paper concludes with a discussion of the Files-11 on-disk structure. Design Considerations RSX-11M is a small-to-moderate sized real-time multiprogramming system which will execute on all PDP-11 processors except the LSI-11 based systems. The design objectives of RSX-11M were to: 1. provide a real-time system with an 8K Executive running on a minimal 16K system 2. be upward compatible with RSX-11D 3. support all PDP-11 processors, most processor options, and a full line of peripherals 4. support user facilities such as a file system, multiple language processors, and debugging and maintainence tools 5. allow for any number of simultaneously executing user tasks, and 6. avoid using processor priority to synchronize access to shared system data bases. Page 3 The Executive The RSX-11M Executive is a priority driven, multiprogramming, real-time operating system whose function is to coordinate the sharing of resources among competing tasks. The multiplexing of resources is made possible by the interrupt system of the hardware which causes control to be taken away from user tasks and given to the Executive. It is during this period of interrupt control that the Executive makes its decisions on granting the use of shared resources. In RSX-11M, executable programs are called tasks. A task is one or more source programs assembled or compiled into an object format, then built into a task image by the linker utility called the Task Builder. The Task Builder combines object modules, creates overlays, and sets up the basic task attributes that determine the task's resource requirements. The user makes a task known to the Executive by a process known as task installation. When the user installs a task, the system records a number of task parameters in a memory resident structure called the System Task Directory (STD). The parameters include the name and length of the task, the disk address of the task image, and the name of the memory partition in which the task is to run. An installed task is neither resident in memory nor competing for system resources. The Executive considers it to be dormant until a running task or a terminal command requests the Executive to activate it. Thus the Executive recognizes two states for installed tasks: 1. Dormant. A dormant task is one which has an entry in the System Task Directory, but has not been requested to run. 2. Active. An active task is an installed task which has been requested to run. It remains active until it exits, terminates, or is aborted, when it returns to the dormant state. An active task can be in one of two substates. 1. Ready-to-run. A ready-to-run task competes with other tasks for CPU time on basis of priority. The highest priority ready-to-run task gets the CPU. 2. Blocked. A blocked task is unable to compete for CPU time for synchronization reasons or because a needed resource is not available. A dormant task uses little memory but can be introduced into active competition for system resources quickly because the Page 4 Executive has access to all the parameters it needs to retrieve the requested task. The System Task Directory (STD) is composed of one Task Control Block (TCB) entry, ordered by priority, for each user task in the system. A second link through the list, which links active tasks, is pointed to by the active task list pointer to allow fast dispatching of user tasks. See Figure 1. Sample Task Control Block (TCB) STD pointer Task Name Task List Link Active Task List pointer Active Link TCB TCB Figure 1. System Task Directory and Active Task List Active tasks compete for system resources on the basis of priority and resource availablilty. The priority of a task is determined by a number assigned to the task when it is built, when it is installed, or when it is running. The number is in the range 1 to 250 where a higher number indicates a higher priority. The Executive dispatches user tasks based on the highest priority user task which is ready to run. When a task becomes blocked, such as to wait for an I/O completion, the Executive gives the CPU to the next highest priority task which has access to all the resources it needs. Page 5 Executive Interrupt Processing The RSX-11M Executive coordinates the control of two states: system state and user state. Each state is associated with a stack: a user stack and the system stack. A single word, the stack depth indicator, is used to recognize the current state of the system. When the stack depth indicator is equal to 1 the system is running in user state; when equal to zero or less, it is in system state. External interrupts can occur within the system from either of the two states. Processor traps (requests for Executive service) basically occur only in the user state. While in the user state a single interrupt causes transfer into the system state where the system remains until the interrupt is processed. But while in system state, repeated interrupts can occur. This implies a fixed interrupt depth of one for the user stack and implies a variable interrupt depth for the system stack. Once the Executive is entered via an interrupt (regardless of the state it is in when the interrupt occurs) it will not return to the user state until all system related processing for that interrupt has been completed. In other words, the user state is never in control unless the Executive has nothing to do (is idle). Processor traps are used to implement requests for Executive service. Only one request for Executive service can be pending in the system at one time. Since processor traps can occur only from user state, i.e. a user program has the CPU resource, entrance to the Executive occurs only when the Executive is idle. While in system state, only external interrupts can occur. If processor traps occur, either they are valid exceptions, or the system has faulted and will shut down. Once a vaild processor trap is pending, it will be processed to completion before any other system routine is given access to any shared system data base. When an external interrupt occurs, the interrupt routine will execute at priority 7, the highest possible PDP-11 hardware priority, and thus is non-interruptible. The previous state of the system is saved on the current stack and the Executive enters system state. By an RSX-11M system convention, no process should run in a non-interruptible mode for more than 100 microseconds. If processing can be completed in this time, the interrupt service routine simply returns from the interrupt. The interrupt has been processed with minimal overhead. This convention ensures prompt attention to interrupting real-time events. Along any given interrupt path however, more processing is often required than the goal of non-interruptible code sequences permits. Most interrupt routines then drop from priority 7 to a lower priority, usually that of the interrupting source. A second RSX-11M Page 6 system convention is that processing at this partially interruptible level should not exceed 500 microseconds. If an interrupt routine requires more processing time, system convention then calls for the routine to run at priority level zero and thus be interruptible. In RSX-11M, the mechanism for achieving this split between non-interruptible and interruptible processing is called Fork Processing. This is an important concept in the Executive since this is also the means by which access to shared system data bases is controlled. FORK is an internal Executive subroutine which serializes access to system data bases. An associated list, the Fork List, which is processed FIFO, is used as the serializing structure. Along an interrupt path, control can be taken from a routine only by a higher priority interrupt pending in the hardware. By the nature of the PDP-11 hardware, these interrupts are kept track of on the system stack. When an interrupt service routine needs to transfer from a non-interruptible to an interruptible state, or modify a system data base, it must call FORK. FORK saves a snapshot of the process and queues this snapshot on the Fork List. The Fork List is a list of system routines waiting to complete their processing. When a fork has worked its way to the front of the Fork List, the process is restored to its previous state and is unaware that there has been a pause of indeterminate length. The Executive's strategic objective is to return equilibrium (its idle state) as fast and efficiently as possible. The RSX-11M system achieves this by servicing all routines on the system stack first. These routines are usually running at some intermediate CPU priority level. When the system stack is cleared of pending requests, the Executive then services the pending requests on the Fork List. In effect the Fork List is a secondary interrupt queue which is processed FIFO only if the system stack is empty. When both the Fork List and the system stack are empty, the Executive will either return to the user state, or if no task is active, drop into the Null Task, the system idle task. The I/O System In RSX-11M, external devices are controlled by I/O drivers, which are part of the Executive. An I/O driver is an asynchronous process (not a task as in RSX-11D) that calls and is called by the Executive to service an external I/O device or devices. As a system generation option, memory space can be saved by making some drivers loadable, thus the driver need only be loaded into memory when its device is to be used. A driver performs the following functions: Page 7 1. receives and services interrupts from its I/O device(s) 2. initiates I/O operations when requested to do so by the Executive 3. cancels in-progress I/O operations, and 4. performs device-specific functions upon power fail and device timeout. A driver possesses its own context, allows or disallows interrupts, and synchronizes its access to shared data bases. The I/O services provided by the Executive consist of a single I/O call, the QIO directive, and a collection of subroutines used by the drivers to obtain I/O requests, facilitate interrupt processing, and handle I/O completion. These Executive subroutines centralize common driver functions and eliminate duplicate code sequences in drivers. Every I/O driver has five entry points: 1. device interrupt 2. I/O initiation 3. device timeout 4. cancel I/O 5. power fail The first entry point is entered by hardware interrupt; the other four are entered by calls from the Executive. The user interface to the RSX-11M I/O system consists of logical unit numbers (LUNs) and the single I/O directive QIO. Each time a task makes an I/O request, the Executive performs a series of validity checks. If the checks are successful, the Executive generates a data structure called an I/O Packet. The Executive then inserts the packet into a device-specific, priority-ordered list of packets called the I/O Queue. Each I/O queue's list head is located in another data structure for each device called the Status Control Block. When a device driver needs work, it asks the Executive to dequeue the next I/O packet. Because of the extensive use of the Executive I/O subroutines, the driver itself has little to do other than set up the status registers and issue the request. Memory Organization The PDP-11 addressing mechanism allows a program to directly address only 32K words of memory. The use of memories larger than 32K requires the use of the KT11 memory Page 8 management unit. RSX-11M supports both systems with the KT11 and those without. Systems which support the KT11 are called 'mapped' systems. The user memory area of RSX-11M is divided into partitions. In 'unmapped' systems, tasks are bound to a specific partition and must execute from that partition. The base address of the partition in which the task is to run is specified at task build time. In mapped systems, tasks may be installed and subsequently executed in any partition as long as the partition is large enough. RSX-11M supports two types of task partitions: system-controlled and user-controlled. Space in a system-controlled partition (mapped systems only) is dynamically allocated by the operating system to as many tasks as will fit simultaneously in the partition. This allocation may involve shuffling resident tasks to arrange available space into a contiguous block large enough for a requested task. Memory allocation will be discussed in more detail in the memory management section. A user-controlled partition (supported in both mapped and unmapped systems) is allocated to only one task at a time. A user-controlled partition, which is a main partition, can be subdivided into as many as seven subpartitions. The main attribute of a user-controlled main partition or subpartition is that only one task can be executing in the partition at once. This can lead to a waste of memory resources but gives the user absolute control over system activity. The subpartitions can execute in parallel. The purpose of subpartitioning is to reclaim large memory areas in unmapped systems. Partitions are defined at system generation time and are described by a data structure called a Partition Control Block (PCB). A pointer in the system common area points to the first PCB. From this PCB are linked the PCB's for any subpartitions defined for this main partition. All PCB's defining other partitions and subpartitions are similarly linked. Task Control Blocks (TCB's) of tasks waiting to occupy either the main partition or a subpartition are always linked from the main partition's PCB. The TCB's are ordered by priority. Page 9 Partition PCB TCB TCB TCB List Head Main PCB Sub. PCB Sub. PCB TCB TCB Main PCB Sub. PCB TCB Main Figure 2. Partition Data Structure Memory Management Tasks are granted memory on the basis of priority. In a user-controlled partition, when a task is activated it is placed on a queue of tasks waiting for memory in the partition. When the partition is freed, the highest priority task is granted control of the partition. In a system-controlled partition, as many tasks as will fit are allowed to run simultaneously. The tasks are allocated contiguous memory and are relocated with the memory management hardware. When a task is activated to run in a system-controlled partition, it is placed on a priority-ordered queue of tasks waiting to be loaded into the partition. The Executive determines if enough contiguous space exists to load the highest priority task in the partition wait queue. This is done by examining a list of allocated areas in the partition and calculating the size of gaps which exist between allocated areas. The first gap which is large enough is allocated to the task. If a big enough gap cannot be found, Page 10 the Executive will attempt to checkpoint (roll-out to disk) neighboring tasks of lower priority. If the task cannot be brought in by checkpointing, the Executive will request the shuffler task to attempt to compact memory. Memory compaction and checkpointing are options available at system generation time. Each time a task exits and frees memory, the partition wait queue is examined and an attempt is made to allocate memory to the highest priority waiting task. RSX-11M supports checkpointing in both user-controlled and system-controlled partitions. To be checkpointed, a task must have been built as checkpointable and checkpointing must be enabled. Checkpointing will occur in a user-controlled partition when: 1. a task requires the user-controlled main partition and is of a priority higher than any task currently occupying it or any of its subpartitions. 2. a task requires a subpartition and the main partition or subpartition is occupied by a lower priority task. When a memory allocation failure occurs in a system-controlled partition, a list of allocated areas in the partition is examined to see if a free space of sufficient size can be formed by checkpointing one or more neighboring tasks. The list is scanned from the beginning looking for a series of tasks, possibly separated by gaps of free space, where each task has a lower priority than the requested task. If the sum of the memory occupied by the lower priority tasks and free space is enough to satisfy the requirement for the higher priority task, the tasks are checkpointed and the higher priority task is allocated the released memory. If a series of checkpointable tasks cannot be found and the system includes memory compaction support, the Executive will request the memory compaction task, called the shuffler, to attempt to bring in the highest priority waiting task by a combination of memory compaction and checkpointing. The shuffler uses a two-pass algorithm to attempt to compact memory. In the first pass, the shuffler starts at the beginning of the partition and attempts to move all tasks which are located above a gap of free space down to the base of the free space. During this pass it will also checkpoint any tasks which are waiting for terminal input. When the shuffler has completed its first pass, all free space in the partition has been merged into one hole at the top of the partition. There may be additional holes below tasks which cannot be shuffled. Some examples of tasks which cannot be shuffled are loaded device drivers and tasks with long-outstanding I/O. If the shuffler completes Page 11 its first pass and tasks are still competing for memory, it executes its second pass. The shuffler creates an assending, priority-ordered list of tasks in the partition. It then uses this list to see if the size of the waiting task is less than the sum of the free space and the size of one or more of the lower priority tasks in the partition which may be checkpointed. The shuffler then restarts its first pass to accumulate the freed-up space and allocate it to the waiting task. If the partition is fragmented by tasks which cannot be shuffled, the second pass is executed once for each fragment of the partition. If the shuffler still cannot find space in the partition for the waiting task, it searches for the next system-controlled partition to compact and exits if there are none. Extended Logical Address Space In the PDP-11, a task can only directly address up to 32K words. One method to avoid limiting the size of a task because of this addressing restriction is to use overlays defined at task build time. An overlayed task is divided into segments. The root segment is always in memory while the other segments are read into memory from disk as required. The RSX-11M Executive provides memory management directives to allow task segments in memory to exceed 32K words. The directives use the memory management hardware to map task addresses to different logical areas within the task. RSX-11M defines three kinds of address space: 1. Physical address space. This is the physical memory in which tasks reside and execute. 2. Logical address space. This space is the total amount of physical address space to which the task has access rights. 3. Virtual address space. Virtual address space corresponds to the 32K addresses that the task can specify in a 16-bit word. Using the memory management directives, a task can map its virtual addresses to different parts of its logical address space. A task can also expand its logical address space dynamically or map its virtual addresses to the logical areas that belong to another task (provided it has access rights). One application of this is a means of inter-task communication. Page 12 Scheduling RSX-11M is an event driven operating system. The system will recognize certain occurrences called significant events. A significant event is a change in system status which will cause the Executive to re-evaluate the eligiblilty of all active tasks to run. When a significat event occurs, the Executive scans the queue of active tasks and runs the highest priority ready-to-run task. Significant events include: 1. an I/O completion 2. a task exit 3. removal of a task from the clock queue 4. execution of certain Executive requests 5. execution of the round-robin scheduling algorithm. The Executive allocates CPU and memory resources on the basis of priority. Two system generation options, round-robin scheduling and swapping, are provided to allow tasks of equal (or close) priority to share the CPU and memory. When tasks have equal priorities, the Executive tends to give CPU time more often to tasks that appear first in the queue. When round-robin scheduling has been included in a system, the scheduling algorithm attempts to time-slice the CPU by periodically rotating tasks of equal priority in the active task list. A typical time-slice is 100 milliseconds. The round-robin scheduler does not affect processor competition by tasks of different priorities. The actual algorithm used by RSX-11M is to locate the first task within each priority class that is not blocked from executing and move that task to the end of its priority class. Compute-bound tasks tend to be rotated while I/O bound tasks tend to stay at the front of their priority class. A task cannot normally cause the Executive to checkpoint another task with the same or slightly higher priority. Swapping enables the Executive to checkpoint tasks with similiar priorities in and out of memory and thus distribute resources more evenly. The Executive adds a 'swapping priority' to a task's normal running priority. The swapping priority does not affect CPU scheduling or the basic checkpoint algorithm. At each swapping interval (a typical interval is 500 milliseconds or five times the CPU round-robin time-slice) the swapping priority is decremented and eventually becomes negative. If the sum of the decremented swapping priority and the task's running Page 13 priority causes the running task to have an actual priority less than that of a competing task, the Executive will checkpoint the running task. The Executive will place the rolled-out task at the end of the active task queue. Executive Services A system directive is a request from a task to the Executive to perform an operation. System directives are used to control the execution and interaction of tasks. Most significant events are caused, either directly or indirectly, by issuing a system directive. The system directives affect the way the Executive shares system resources among active tasks. System directives are provided for the following functions: 1. obtain task and system information 2. measure time intervals 3. perform I/O functions 4. communicate with other tasks 5. manipulate a task's logical and virtual address space 6. suspend and resume task execution 7. exit 8. perform operations using event flags, and 9. use the system trap facility. Event flags are one means by which tasks recognize specific events. A task can issue a system directive to associate an event flag with a specific event. When that event occurs, the Executive sets the associated event flag. By testing the state of the flag, a task can determine whether or not the event has occurred. Sixty-four event flags are available to each task. The first 32 flags are local to each task while the second 32 flags are common to all tasks. A task can use the common flags to communicate with other tasks. System traps are transfers of control (software interrupts) that provide another means of responding to events. The Executive initiates system traps when certain events occur. The trap will transfer control to the task service routine associated with the event. There are two kinds of system traps: Page 14 1. Synchronous system traps (SST's). SST's detect events associated with instructions. They always occur at the same point in the program if the instructions are repeated. As an example, SST's can detect illegal instructions or invalid addresses. 2. Asynchronous system traps (AST's). AST's detect events that occur asynchronously to the task's execution. The main purpose of an AST is to inform the task that a certain event has occurred. As an example, the completion of an I/O transfer can cause an AST to occur. A task can issue system directives to establish system trap service routine entry points. When a trap occurs, the task automatically enters the appropriate routine. SST's are caused by activities internal to the task, while AST's occur as a result of an external event. The Executive keeps track of all AST's, queues them FIFO, and is aware that the task is executing an AST. The Executive, having initiated an SST, cannot determine that the task is in the SST service routine. An SST service routine can be interrupted by another SST or an AST. Command Interface The operator communicates with the RSX-11M system by entering commands at a terminal. The terminal driver collects the commands and queues them to the Monitor Console Routine (MCR) processor. The MCR processor either executes the command itself, or activates a system or user task to service the command. MCR commands allow an operator to: 1. start up the system 2. manage peripheral devices 3. control task execution 4. obtain system and task information, and 5. activate system or user tasks. In RSX-11M, a variable number of terminals can operate concurrently. Each terminal operates independently of the others. As a system generation option, the system can include multiuser protection. This requires a user to log onto a terminal before commands can be entered into the system. A user identification code is assigned to each user and determines the user's privilege. Users are either privileged or non-privileged. Commands which directly Page 15 affect system performance are privileged commands and can only be issued from privileged terminals. The File System Files-11 is the general purpose file system supported by the RSX-11 family of operating systems. The basic medium which supports a Files-11 structure is a volume. A volume is defined as an ordered set of logical blocks. A logical block is an array of 512 8-bit bytes. The logical blocks in a volume are consecutively numbered from 0 to n-1, where the volume contains n logical blocks. The Files-11 structure is theoretically capable of describing volumes of up to 2**32 blocks in size. Currently, volumes of 2**24 blocks are supported. The design of Files-11 specifies that the logical blocks of a volume must be randomly addressable and the volume must allow transfers of any length up to 65K bytes, in multiples of four bytes. When a transfer is longer than 512 bytes, consecutively numbered logical blocks are transfered until the byte count is satisfied. When only part of a block is written, the contents of the remainder of that logical block are undefined. A file is an ordered set of virtual blocks, where a virtual block is an array of 512 8-bit bytes. The virtual blocks of a file are consecutively numbered from 1 to n, where n blocks have been allocated to the file. Each virtual block is mapped to a unique logical block in the volume by Files-11. Each file on a volume is uniquely identified by a three word File ID. The first word of the File ID, the file number, is used to locate the header of the file. The second word, the file sequence number, is used to verify that the file header is in fact the header for the desired file. The third word is currently not used. The File ID is supplied by the file system when the file is created and must be supplied by the user (either directly for fast access or indirectly by the file system) whenever the user wishes to reference a particular file. The access request is denied if the file sequence number does not match the corresponding field in the file header associated with the specified file number. Each file on a Files-11 volume is described by a file header. The file header is a block that contains all the information necessary to access the file. It is not part of the file, rather, it is contained in the volume's index file. The significance of the index file will be discussed later. The header block is organized into four areas; the header area, ident area, map area, and the end checksum. Page 16 The header area contains the File ID and the ownership and protection codes of the file. The first word of the File ID, the file number, is used to calculate the virtual block number of that file's header block in the index file. The ident area contains the creation name of the file, its creation date and time, and a revision count, date, and time. The map area describes the mapping of virtual blocks of a file to the logical blocks of a volume. The mapping data consists of a list of retrieval pointers. Each retrieval pointer describes a consecutively numbered group of logical blocks which are part of the file. Retrieval pointers are composed of two fields. The count field of a retrieval pointer contains the value m which represents a group of m+1 logical blocks while the logical block number field contains the logical block number of the first logical block in the group. The map area also contains the linkage to the next extension header of the file, if the file cannot be completely described by the mapping space in the header block. The last two bytes of the file header contain a 16 bit additive checksum of the file header. It is verified every time the header is read, and is recomputed every time the header is written. The file system maintains a directory whose purpose is to associate filename strings with File ID's. A directory is a file consisting of 16 byte records. Each record is a directory entry. Each directory entry contains a File ID, a filename, file type, and version number. Since a directory is a file with no special attributes, it may list files that are in turn directories. The current implementation of Files-11 supports a two level directory hierarchy which is tied in with the user identification mechanism of the operating system. Each user identification code (UIC) is associated with a user file directory (UFD). Each UFD contains a list of all files for that user. References to files that do not specify a directory are defaulted to the UFD associated with the user's UIC. All UFD's are listed in the volume's master file directory (MFD) under a filename constructed from the UIC. Figure 3 shows an RSX-11M directory structure. Page 17 MFD [0,0] UFD UFD UFD [1,1] [1,2] [1,3] file1 file2 file3 file4 file5 file6 file7 file2 Figure 3. RSX-11M directory structure When a user attempts to access a file, protection checks are performed to determine if the user is eligible to access the volume and file. A protection mask is associated with each volume and file. The protection mask specifies the types of access allowed to four defined user groups. The four types of access are read, write, extend, and delete. The four user groups, defined according to the user identification code associated with the user, are: 1. System. All system tasks and users that have a priviledged UIC. 2. Owner. Tasks that run under the same UIC as the files owner. 3. Group. Any task that is running under the same UIC group number (the first number of the UIC) as the file's owner. 4. World. All other tasks and users. Files-11 maintains five files on a volume which it uses to control the file organization. The files are created when a new volume is initialized and the File ID's of these files are known constants. The files are: the index file, the storage bitmap file, the bad block file, the master file directory, and the core image file. Page 18 The index file is the root of the Files-11 structure. It provides the means for identification and initial access to a Files-11 volume, and contains the access data for all files on the volume including itself. Virtual block one of the index file is the volume's bootstrap block. If the volume is a system device, the boot block contains the bootstrap program for the RSX-11M operating system. If the volume is not a system device, the boot block contains a small program to output a message on the system console to inform the operator to that effect. Virtual block two on the index file is the volume's home block. The purpose of the home block is to identify the volume as Files-11, establish the specific identity of the volume, and to serve as an entry point into the volume's file structure. The home block contains the index file bitmap size and the starting logical block number of the bitmap. The index file bitmap is used to control the allocation of file numbers (file headers). It is simply a bit string of length k where k is the maximum number of files permitted on the volume. The rest of the index file contains all the file headers for the volume. The first 16 file headers are logically contiguous with the index file bitmap to facilitate their location; the rest are allocated wherever the file system sees fit. Thus the first 16 file headers may be located from data in the home block while the rest must be located through the mapping data in the index file header. The file header for file number i is located at virtual block 2+j+i where j is the number of blocks in the index file bitmap. The storage bitmap file is used to control the available space on a unit. It contains a storage control block which contains summary information about the unit, and the bitmap itself, which lists the availability of individual blocks. The bad block file is a file used to record all the known bad blocks on a volume. Virtual block one of the bad block file is the bad block descriptor for the volume. It is located on the last good block of a volume. The format of the bad block data is similiar to the map area of a file header. The master file directory is the root of the volume's directory structure. It lists the five known files plus whatever the user chooses to enter. The master file directory contains entries for all user directories. The core image file provides a file of known File-ID for the use of the operating system. This file is used by the RSX-11M Executive as a checkpoint file. Page 19 Boot Block Home Block Index File Bit Map Index File Header Storage Map Header Bad Block File Header MFD Header Checkpoint File Header UFD Header 1 [1,1] UFD Header 2 [1,2] UFD Header n [200,200] PROG.FTN;1 Header TASK.TSK;1 Header MFD UFD 1 [1,1] UFD 2 [1,2] PROG.FTN;1 TASK.TSK;1 Figure 4. RSX-11M disk structure RSX-11M supplies a group of subroutines called File Control Services (FCS) which enable the user to perform record-oriented and block-oriented I/O operations and to perform additional functions required for file control, such as open, close, wait, and delete operations. The FCS routines are linked with the user program at task-build time from a resident system library or a system object module library. FCS supports both sequential and random access to files. The sequential access is device-independent and thus can be used for both record-oriented and file structured devices. FCS allows a user to read or write virtual blocks of data from and to a file without regard to logical records in a file. Block I/O operations provide an efficient means of Page 20 processing file data, since such operations do not involve the blocking and deblocking records within a file. When block I/O is used, the number of the virtual block to be processed is specified as a parameter in the I/O call. The virtual block specified is processed directly in a buffer reserved by the program in its own memory space. Block I/O operations are performed asynchronously, that is, control can be returned to the user program before the requested I/O operation is completed. The user is responsible for synchronizing all block I/O operations. Such synchroniziation can be coordinated by an event flag specified in the call. The event flag is used by the system to signal the completion of a specified block I/O transfer. FCS provides support for processing record-oriented files. FCS performs the necessary blocking and deblocking of records within the virtual blocks of a file. The blocking operations are performed in an area of memory called the file storage region which the user must allocate in his program. The user must specify the format of the records such as fixed or variable length, the carriage control information if any, etc. For sequential access files, operations can be performed for both fixed and variable length records. For direct access files, operations can be performed only on fixed length records. In contrast to block I/O operations, all record I/O operations are synchronous. Control is returned to the user program only after the requested I/O operation is completed. Because record-oriented operations process logical records within a virtual block, only a limited number of record operations result in an actual I/O transfer, that is, when the end of a data block is encountered. Device Independence Using the File Control Services, a task performs I/O on Logical Unit Numbers (LUN's). The task, the Task Builder, or an operator assigns them to specific devices before the task actually uses the LUN's. This allows a task to be written independently of the specific physical characteristics of devices. An operator can subsequently issue a command to change the physical device used for I/O. The command will redirect all I/O intended for one device to another device. The redirection has no effect on LUN assignments and the change in device characteristics is transparent to the task. Logical devices provide another means of associating LUN's with physical devices. A task can assign a LUN to a logical device. The operator can then issue a command to associate the logical device name with a physical device. Page 21 Bibliography ____________ 1. Cutler, David N., Echhouse, Richard H. Jr., and Pellegrini, Mario R., The Nucleus of a Real-time ___ _______ __ _ _________ Operating System, Presented at ACM 76, Session _________ ______ 'Operating Systems for Minicomputers'. 2. Goldstein, Andrew C., Files-11 On-Disk Structure ________ _______ _________ Specification, Dec internal document _____________ 130-958-032-01, June 1975. 3. Introduction to RSX-11M, Digital Equipment Corporation, DEC-11-OMIEA-B-D, November 1976. 4. PDP-11 Software Handbook, Digital Equipment Corporation, 1975. 5. RSX-11M Executive Reference Manual, Digital Equipment Corporation, DEC-11-OMERA-C-D, November 1976. 6. RSX-11M Guide to Writing an I/O Driver, Digital Equipment Corporation, DEC-11-OMWDA-C-D, November 1976. 7. IAS/RSX-11 I/O Operations Manual, Digital Equipment Corporation, DEC-11-OIORA-B-D, December 1976. 8. RSX-11M Operator's Procedures Manual, Digital Equipment Corporation, DEC-11-OMOGA-C-D, November 1976. 9. RSX-11M System Generation Manual, Digital Equipment Corporation, DEC-11-OMGIA-C-D, January 1977.