Real-Time Posix: an Overview
Total Page:16
File Type:pdf, Size:1020Kb
REAL-TIME POSIX: AN OVERVIEW Michael González Harbour1 Departamento de Electrónica Universidad de Cantabria Avda. los Castros s/n 39005 - Santander SPAIN E-mail: [email protected] Abstract Table I. List of POSIX Base Standards The POSIX standard defines a portable interface for UNIX- POSIX.1 System Interface (basic reference standard)a,b based operating systems. The goal of this increasingly POSIX.2 Shell and Utilitiesa important standard is source-level portability of applications. In this paper we discuss the real-time extensions to POSIX and POSIX.3 Methods for Testing Conformance to POSIXa how these extensions address the needs of applications with real-time requirements. POSIX.4 Real-time Extensions POSIX.4a Threads Extensions I. INTRODUCTION POSIX.4b Additional Real-time Extensions POSIX is the acronym for Portable Operating System POSIX.6 Security Extensions Interface. It is a proposed operating system interface standard based on the popular UNIX2 operating system; its main goal is POSIX.7 System Administration to support application portability at the source-code level. It is POSIX.8 Transparent File Access being standardized by the Computer Society of IEEE as the IEEE standard P1003, and also by ISO/IEC, as the POSIX.12 Protocol Independent Network Interfaces international standard ISO/IEC-9945. POSIX.15 Batch Queuing Extensions POSIX is an evolving group of standards, each of which POSIX.17 Directory Services covers different aspects of the operating systems. Some of these standards have already been approved, while others are a Approved IEEE standards b currently being developed. They can be grouped in three Approved ISO/IEC standard categories: 1) Base Standards: They define system interfaces related to different aspects of the operating system. The standard Table II. Additional POSIX Base Standards specifies the syntax and semantics of system interfaces so that application programs can directly invoke the operating P1224 Message Handling Services (X.400) system services. The standard does not specify how these P1224.1 X.400 Application Portability Interface services are to be implemented, just their semantics; system implementors can choose their implementation as long as P1238 Common OSI Application Portability Interface they follow the specification of the interface. Initially, the P1238.1 FTAM OSI Application Portability Interface base standards were developed for the C language, but now they are being specified as language-independent interfaces. P1201.1 Windowing Application Portability Interface Table I and Table II list the base standards that are P1201.2 Recommended Practice on Driveability currently being standardized under POSIX. 1 This work was supported in part by the Comisión Interministerial de Ciencia y Tecnología of the Spanish Government, under grants ROB91-0288 and ROB91-1553-E. 2 UNIX is a trademark of AT&T 2) Language bindings: These standards provide the actual Because of the need to achieve application portability for interfaces for different programming languages. The real-time systems, a real-time working group was established languages that are currently being used are C, Ada, in POSIX. This group is developing standards to add POSIX Fortran 77, and Fortran 90. Table III lists the POSIX (or UNIX) the OS services that are needed by real-time language bindings that are currently under development. applications. The charter of the POSIX Real-time Working Group is to "develop standards which are the minimum Table III. List of POSIX Language Bindings syntactic and semantic changes or additions to the POSIX standards to support portability of applications with real-time POSIX.5 Ada Bindingsa requirements." a POSIX.9 Fortran 77 Bindings Many real-time applications, such as small embedded POSIX.16 C Language Bindings systems, have special physical constraints that demand for operating systems with a reduced set of functionality. For POSIX.19 Fortran 90 Bindings example, many systems exist which cannot have a disk drive, POSIX.20 Ada Bindings to Real-time Extensions do not have a hardware memory management unit, and have a small amount of memory. For these systems it is necessary a Approved IEEE standards that the standard allows implementations to only support a particular subset of the POSIX functions. The subsets necessary for real-time applications are also being addressed by 3) Open Systems Environment. These standards include a the Real-time Working Group, which has specified four real- guide to the POSIX environment, and application profiles. time application environment profiles: for small embedded An application profile is a list of the POSIX standards that systems, real-time controllers, large embedded systems, and are required for a certain application environment, along large systems with real-time requirements. with the options and parameters of these standards whose support is required for that application environment. According to these requirements, the Real-time Working Application profiles are a very important means of Group is currently developing four standards, that we will achieving a small number of well-defined types of review in this paper: operating system implementations appropriate for particular application environments. Table IV shows the list POSIX.4: of standards that are being developed in this group. Real-time extensions. Defines interfaces to support the portability of applications with real-time requirements. Table IV. List of POSIX Application Environment Standards POSIX.4a POSIX.0 Guide to POSIX Open System Environment Threads extension. Defines the interfaces to support multiple threads of control inside each POSIX process. POSIX.10 Supercomputing Application Environment Profile POSIX.4b POSIX.11 Transaction Processing Application Additional real-time extensions. Defines interfaces to Environment Profile support additional real-time services. POSIX.13 Real-time Application Environment Profiles POSIX.13 POSIX.14 Multiprocessing Application Environment Real-time application environment profiles. Each profile Profile lists the services that are necessary for a particular application environment. POSIX.18 POSIX Platform Application Environment Profile The following sections discuss the most relevant aspects of each of these standards. The discussion is based on the status The POSIX standard is necessary because, although UNIX of these standards at the time this paper is being written. This is a de-facto standard, there are enough differences among the status corresponds to Draft 13 of POSIX.4 [10], Draft 6 of different implementations to make applications not be POSIX.4a [11], Draft 6 of POSIX.4b [12], and Draft 5 of completely portable. But, while a UNIX application may need POSIX.13 [13]. Since all these standards are still being some changes to be ported to a different platform, portability developed, changes made to them could affect the discussions of real-time applications is far more difficult, since there exist in this paper. However, we believe that the spirit of most of a large variety of real-time operating systems. UNIX is not a what is discussed here will apply to the final standards. real-time operating system, and there is no de-facto standard for these applications. II. REAL-TIME EXTENSIONS C. Process Synchronization This section discusses some of the most important features POSIX.4 defines functions to manage process of POSIX.4 [10], which is the part of POSIX that defines synchronization with counting semaphores. These semaphores system interfaces to support applications with real-time are identified by a name that belongs to an implementation- requirements. POSIX.4 is very near to its approval as a defined name space. This name space may or may not coincide standard. with the file name space. The counting semaphore is a common synchronization mechanism that allows mutually A. Real-time Process Scheduling exclusive access to shared resources, signaling and waiting among processes, and other synchronization requirements. One The base POSIX.1 standard [9] defines a model of of the most common uses of semaphores is to share data concurrent activities called processes, but does not specify any among processes, and this can be accomplished in POSIX.4 by scheduling policy nor any concept of priority. For real-time using shared memory objects (see Section II.D) together with applications to be portable it is necessary to specify some semaphores. scheduling policy suitable for real-time. POSIX.4 specifies three scheduling policies. Each process has a scheduling Unfortunately, the counting semaphores specified in attribute that can be set to any of the three policies: POSIX.4 do not prevent unbounded priority inversion [6]. Priority inversion occurs when a high priority process has to • SCHED_FIFO: This is a fixed-priority preemptive wait for a lower priority process to complete some action. scheduling policy, in which processes with the same Using appropriate protocols, priority inversion can be bounded priority are treated in first-in-first-out (FIFO) order. At by the duration of critical sections, that is, sections of code least 32 priority levels must be available for this policy. during which the process reserves a particular resource for exclusive use. However, with conventional semaphores • SCHED_RR: This policy is similar to SCHED_FIFO, but unbounded priority inversion may occur; this means that the uses a time-sliced (round robin) method to schedule delay experienced by high priority tasks is not bounded by the processes with the same