The invention relates to providing real-time (RT) data processing capabilities to a non-real-time (non-RT) operating system (OS). The invention relates in particular, but not exclusively, to combining a non-RT OS with an RT file system (RTFS).
For RT recording on, e.g., a hard-disk drive (HDD) RT access to the disk is required. The HDD is shared between many processes. Careful scheduling is required if requests for access are guaranteed to get honored under RT conditions. A host OS (HOS) such as Linux provides access to the disk on the basis of “best-effort”, which is not sufficient for RT requirements. A non-RT OS typically has a scheduler that is optimized for high average performance under the condition that each process gets a fair portion of the bandwidth to the disk. On the other hand, RTFS software, which is used to provide RT storage, e.g., for storing video streams, comprises an RT scheduler for re-ordering disk requests in order to guarantee that all video streams are stored and retrieved under RT conditions. The inventors seek to solve the problem of, among other things, achieving RT behavior with a non-RT OS.
U.S. Pat. No. 6,466,962 discloses a system and method for supporting RT computing within a general purpose OS by means of co-resident operating systems. The RT systems technology is allowed to co-exist with commercial, general-purpose (non-RT) operating systems to support applications such as desktop multimedia conferencing. The central processor and other system resources are partitioned into two virtual machines. A first machine runs a largely unmodified general-purpose operating system, and a second machine runs an RT kernel. Access to the physical hardware is multiplexed by the virtual machines. A multiplexer is scheduled in advance to multiplex between the machines at precise periodic intervals, or the multiplexer is operated under control of an interrupt in response to a request of the RT OS to ensure that the RT kernel gets access to the hardware.
The inventors propose a more advantageous alternative to known approaches to merge a non-RT OS with RT data processing. To this end, the invention provides an RT software stack that co-operates with the non-RT OS by intercepting the non-RT OS requests and controlling them in accordance with RT rules. More specifically, the invention relates to a method of implementing RT software co-existing with a non-RT OS to share one of more resources between the RT software and the non-RT OS. The method comprises enabling the RT software to check a queue of one or more pending requests from the non-RT OS for access of the resource; and enabling the RT software to determine when the pending request will be executed.
In the invention, the RT software is allowed to throttle the traffic in the non-RT OS according to RT rules. Requests from the non-RT OS are not executed immediately as they would be in the conventional case. The RT software controls the points in time at which the non-RT OS requests get executed.
For ease of explanation, the term “hook” is reserved in this text to refer to the communication channel between the RT software and the non-RT OS.
An embodiment of RT software co-existing with a non-RT OS according to the invention is one, wherein the RT software runs on the non-RT OS. In another embodiment the RT software runs outside of the non-RT OS. In case the RT-software is running on the non-RT OS, the OS needs to have some limited kind of real-time processing guarantees if the data handling as controlled by the hook is to be real-time guaranteed. Otherwise the RT-software might never have the chance to issue the commands to the hook. The RT-software is therefore preferably to run on a high-priority thread. Only the CPU processing of the OS needs to have such a provision. The hook mechanism leverages this to create real-time guarantees for other processes, e.g., access to an HDD or other resource. The required real-time provision can be fairly coarse-grained because the hook controls coarse-grained processing.
Preferably, the hook can be enabled and disabled at run time. When disabled, the non-RT OS operates as if the hook were absent. This allows booting in the conventional way. The hook recognizes requests from the RT software and lets them pass inmediately. This enables the RT software to use the relevant device driver(s) of the non-RT OS, and ensures that RT requests are executed without delay. The hook intercepts all requests from the non-RT OS, and puts them into a queue. This ensures that the non-RT requests do not interfere with the RT requests from the RT software. The hook further provides information to the RT software about the non-RT requests in the queue. This enables the RT software to determine execution of specific non-RT requests in a way that prevents them from interfering with the RT traffic. For example, the RT software determines the sequence wherein the non-RT requests are executed, so as to optimize resource usage.
Preferably, the hook is enabled to disable itself under specific conditions. For example, the hook disables itself when it detects that the RT software has stopped checking the queue of pending non-RT requests. This allows the system to recover from a state wherein the RT software has stopped working.
The above properties provide the following advantages to a system in the invention. The RT software can use the device drivers of the non-RT OS. The non-RT OS can boot as usual. Access to the hardware via the drivers is under full RT control. The RT software can be independent of the non-RT OS, e.g., the RT software runs outside, or on top of, the non-RT OS. AS a result, a portable RT software stack can be developed.
For disk access, time multiplexing as used in the known system, discussed above, is not advisable due to the relatively coarse granularity of disk requests. The inventors therefore propose a scheme for arbitration based on all available requests. This leads to a very significant difference between the known system and the invention. In the invention the RT disk scheduler determines the order of request execution for both the real-time requests and the non-RT requests. In the known system, this arbitration takes place on the bare processor, i.e., outside both the RT kernel and the general purpose kernel. The multiplexing is purely time-based, with some specific measures taken to solve conflicts between shared resources. Conflicts would otherwise cause the general purpose process to interfere with the real-time process. The invention avoids those conflicts altogether, since the disk scheduler ensures that a request from the general purpose OS is only executed at a time that it does never interfere with requests for real-time streaming.
The invention is explained in further detail, by way of example and with reference to the accompanying drawing wherein:
Throughout the figures, same reference numerals indicate similar or corresponding features.
The invention is explained below by way of example within the context of recording streaming video to, and supplying streaming video from, a memory. The memory comprises, e.g., an HDD, an optical disk drive or a solid state memory. In the example below, it is assumed that the memory comprises an HDD.
HOS 102 comprises a HOS file system 108, a HOS cache 110, and a HOS device driver 112 to operate resource 106. In order to have RT software 104 co-exist with HOS 102, the latter is provided with a software hook 114 that enables communication between HOS 102 and RT software 104. Both HOS 102 and RT software 104 have processes that request access to HDD 106. Hook 114 intercepts all requests from the processes of HOS 102 for access to HDD 106, and puts them into a queue 116. This ensures that the non-RT requests do not interfere with RT requests 118 from RT software 104. Hook 114 further provides information 120 to RT software 104 about the non-RT requests in queue 116. For example, the information comprises disk location and size of the request. This enables RT software 104 to determine the proper time for execution of the pending non-RT requests so that these are prevented from interfering with the RT traffic. Requests in queue 116 get executed only after explicit order 122 from RT software 104. In addition, RT software 104 can determine the sequence wherein the non-RT requests are executed, e.g., to optimize resource usage within system 100. Hook 114 recognizes requests 118 from RT software 104 for access of resource 106 and lets them through immediately so that they get executed without delay. Note that in this manner RT software 104 is enabled to use device driver 112 of HOS 102. A non-RT OS typically uses a request queue to device drivers. Using this queue mechanism in hook 114 simplifies implementation of hook 114.
Number | Date | Country | Kind |
---|---|---|---|
03100418.7 | Feb 2003 | EP | regional |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/IB04/50080 | 2/5/2004 | WO | 8/16/2005 |