The RTLinux patent 5,995,745

lwtalk1
Some papers

lwtalk2

 

The patent claims.

What is claimed is:
1. A process for running a general purpose computer operating system using a real time operating system, including the steps of:

providing a real time operating system for running real time tasks and components and non-real time tasks;

providing a general purpose operating system as one of the non-real time tasks;

preempting the general purpose operating system as needed for the real time tasks; and

preventing the general purpose operating system from blocking preemption of the non-real time tasks.

  1. A process according to claim 1, further including the step of providing a software emulator to disable and enable interrupts from the general purpose operating system.
  2. A process according to claim 2, wherein the software emulator performs the steps of:

preventing the general purpose operating system from disabling hardware interrupts from hardware operating in real time; and

emulating hardware interrupt control to preserve interrupt behavior expected by the general purpose operating system with only minimal changes to the general purpose operating system code.

  1. A process according to claim 3, further including the steps of allocating the hardware interrupts to either real-time tasks and components of the real-time operating system or to the general purpose operating system.

patent25. A process according to claim 4, wherein allocating the hardware interrupts further includes the steps of:

passing control directly to real-time tasks or components when the hardware generates interrupts that are allocated to real-time tasks or to components of the real-time operating system; and

passing control to the software emulator when the hardware generates interrupts that are allocated to the general purpose operating system.

  1. A process according to claim 2, further including the step of maintaining software interrupt control with the software emulator.
  • A process for running a general purpose computer operating system using a real time operating system, including the steps of:

  • providing a real time operating system for running real time tasks and components and non-real time tasks;

    providing a general purpose operating system as one of the non-real time tasks;

    preempting the general purpose operating system as needed for the real time tasks;

    preventing the general purpose operating system from blocking preemption of the non-real time tasks;

    providing a software emulator to disable and enable interrupts from the general purpose operating system;

    marking interrupts as “soft disabled” and not “soft enabled” in response to requests from the general purpose operating system to disable interrupts;

    marking interrupts as “pending” and returning control to an interrupted thread of execution in response to hardware interrupts allocated to the general purpose operating system if either the interrupted thread of execution was a real-time task or component of the real-time operating system or if the interrupt has been marked as “soft disabled”;

    emulating the interrupt in response to hardware interrupts allocated to the general purpose operating system if both the interrupted thread of execution was not a real-time task or component of the real-time operating system and the interrupt has been marked as “soft enabled”; and

    marking interrupts as “soft enabled” and not “soft disabled” and then emulating any soft enabled interrupts in response to requests from the general purpose operating system to enable interrupts.

    1. A process according to claim 7, wherein the software emulator performs the steps of:

    preventing the general purpose operating system from disabling hardware interrupts from hardware operating in real time; and

    emulating hardware interrupt control to preserve interrupt behavior expected by the general purpose operating system with only minimal changes to the general purpose operating system code.

    1. A process according to claim 8, further including the steps of allocating the hardware interrupts to either real-time tasks and components of the real-time operating system or to the general purpose operating system.
  • A process according to claim 9, wherein allocating the hardware interrupts further includes the steps of:

  • passing control directly to real-time tasks or components when the hardware generates interrupts that are allocated to real-time tasks or to components of the real-time operating system; and

    passing control to the software emulator when the hardware generates interrupts that are allocated to the general purpose operating system.

    1. A process according to claim 7, where the step for emulating the interrupt further consists of the steps of:

    marking the interrupt as “soft enabled” and not “soft disabled”;

    passing control to an appropriate interrupt handler of the general purpose operating system; and

    restoring state after the interrupt handler of the general purpose operating system completes the non-real time task.


    Description


    BACKGROUND OF THE INVENTION

    This invention relates to real-time operating systems, and, more particularly, to running a real-time operating system with a general purpose operating system.

    General purpose computer operating systems “time-share” programs to optimize use of the machine or response time, or some other mix of objectives. Such programs cannot be used for control of instruments, robots, machine tools, communication devices, or other machinery that requires operation at “hard” real-time, i.e., precise timing where deadlines cannot be missed, because the systems are designed to optimize average performance of application programs at the expense of predictability. Performing the above tasks requires real-time support in the operating system: an ability to schedule tasks at precise intervals, no matter what other system tasks may be active. But real-time support can only be offered if the operating system can ensure (1) low interrupt latency (fast response) and (2) fully pre-emptive task switching. Low interrupt latency means that whenever a hardware device or the clock signals the processor, the operating system will execute a “handler” program within a short and bounded interval of time. Fully preemptive task switching means that whenever a high-priority real-time task is scheduled, it can be executed no matter what other tasks are currently executing.

    An exemplary need is a controller for an instrument that measures electrical discharges in thunderstorms. It is desirable to read data from the instruments periodically, buffer and then write the data to disk, generate a graphical display of the data either locally or over the network, and possibly accept data from other instruments over the network. Only the first of these tasks requires hard real-time; the remainder are standard programming tasks for which a general purpose operating system is well suited.

    Another exemplary need is the control of a liquid fueled rocket mounted on a test platform. There is a need to sample and display data on numerous channels, update a remote real-time display, accept emergency shutdown commands, and perform routing control operations. Again, most of the requirements are for conventional operating systems services, but there are hard real-time components that need reasonably precise scheduling. For example, the shutdown sequence must be precisely timed and cannot be delayed by lower priority tasks without spectacular and unwelcome results.

    It is possible to design a special purpose operating system to support real-time, but this is an enormously complex, expensive and error-prone process that produces a system that needs a large continuing investment to remain current. In addition, there is substantial ongoing development effort and it is desirable to maintain compatibility with these developments, which are generally done by others.

    Accordingly, it is an object of the present invention to operate a real-time operating system, or executive, and retain the capabilities offered by a general purpose operating system.

    Additional objects, advantages and novel features of the invention will be set forth in part in the description which follows, and in part will become apparent to those skilled in the art upon examination of the following or may be learned by practice of the invention. The objects and advantages of the invention may be realized and attained by means of the instrumentalities and combinations particularly pointed out in the appended claims.

    SUMMARY OF THE INVENTION

    To achieve the foregoing and other objects, and in accordance with the purposes of the present invention, as embodied and broadly described herein, this invention comprises a process for running a general purpose computer operating system using a real time operating system. A real time operating system is provided for running real time tasks. A general purpose operating system is provided as one of the real time tasks. The general purpose operating system is preempted as needed for the real time tasks.

    BRIEF DESCRIPTION OF THE DRAWINGS

    The accompanying drawings, which are incorporated in and form a part of the specification, illustrate embodiments of the present invention and, together with the description, serve to explain the principles of the invention. In the drawings:

    FIG. 1A is a software flow diagram for the process of the present invention.

    FIG. 1B is a software flow diagram for additional routines used in the flow diagram shown in FIG. 1A

    FIG. 2 is a software flow diagram for application of the present invention to the LINUX operating system.

    FIG. 3 is a continuation of the software flow diagram shown in FIG. 2.

    FIG. 4 is a continuation of the software flow diagram shown in FIG. 2.

    FIG. 5 is a continuation of the software flow diagram shown in FIG. 4.

    FIG. 6 is a continuation of the software flow diagram shown in FIG. 4.

    DETAILED DESCRIPTION

    In accordance with the present invention, a real-time operating system, hereinafter called a RT-executive, runs a general purpose operating system as its lowest priority task, preempting it when needed. All operating systems have routines that enable and disable interrupts (or set interrupt levels). These routines are “captured” so that they pass through a small RT-executive and hardware emulator.

    Referring first to FIG. 1A, when the general purpose operating system attempts to disable hardware interrupts in accordance with the present invention, the emulator sets an indicator in software. When interrupts arrive 10, they are captured 12 by the RT-executive. The nature of the interrupt is then determined 14. If the interrupts cause a real-time task to be runnable, that task is started 16. If the interrupts are passed through to the general purpose operating system, the program determines if the software enable indicator is set 18. If the software enable indicator is set, then an interrupt is emulated 22 and the handler in the general purpose operating system is run. A handler is a software routine that processes a particular system interrupt. If the enabled indicator is not set 24 (i.e., is cleared), a software pending interrupt indicator is set. As conventionally used herein, the term “soft” interrupt is used to mean interrupts that are emulated in software by the RT-executive; the term “hard” interrupt means interrupts generated by hardware.

    As seen in FIG. 1B, when the general purpose operating system attempts to enable hardware interrupts 34, the enabled indicator is set 36 and the pending indicator is checked 38. If an interrupt is pending, than an interrupt is emulated 42. If no software interrupts are pending, the request is returned 44. If the general purpose operating system attempts to disable hardware interrupts 26, the enabled indicator is cleared 28 and the request is returned 32. The result is that the real-time tasks are never disabled from the executing, while the general purpose operating system requires only very minimal modifications.

    Thus, a form of emulator is the following routines, where the general purpose operating system uses the routines disable and enable to turn interrupts on and off, and also uses a routine mask to selectively enable and disable interrupts per/device: