Yes, you typically want to design your solution so that it does not have dependencies on the rest of the OS. And if it does,
you make sure you work your way around them. You’re probably not going to make file system calls either from a RT thread.
Not every service in the OS needs to respond within a guaranteed timeframe for it to accommodate real-time solutions.
True, but there is a “minor” problem here - although it may all sound fine in theory, in practical terms you are limited, at the very most, to the subset of API that may be called at DIRQL if you want to run your RT tasks within Windows. Even API fnctions that are callable at DISPACH_LEVEL are, apparently, out of your reach because of the possible use of spinlocks that is not adjusted to the RT requirements, behind the scenes. All API calls that are not allowed at elevated IRQL (and, hence, all userland API in existence) are most definitely out of your reach because of the possibility of blocking calls and page faults behind the scenes.
In other words, you don’t seem to have that many practical possibilities if you go this way under Windows OS in its currently existing form, don’t you think.
In any case, you have expressed a reasonable (apparently, for the first time in this discussion) idea that RT apps need a well-defined set of special RT API functions that they are allowed to call, while all other API calls have to be prohibited for them. More on it below
You could have a RT thread responding to interrupts (and DPCs).
Well, in order to be in a position to do so, you need to put ISR and DPC handling under the control of a dispatcher, and to handle interrupts and DPCs in context of dedicated threads, rather than in the one of a hardware/software interrupt that runs out of dispatcher’s control. Now go and read again my very first post on this thread, i.e. the one that you seem to be arguing with, for some reason…
Or a thread which only does a DeviceIoControl periodically
DeviceIoControl() is just a userland function, and, hence, may touch the pageable memory or just go blocking behind the scenes. Therefore, you cannot use it from an app that requires any RT guarantees. The same is true for any other userland API in existence…
Or even a thread which only reads and write to device registers.
This part, indeed, may be done. However, " if(interrupt_occurs) goto statement_above;"
If you need to share or save data, you delegate that work to another CPU+thread. If a normal lock would ever become a problem,
you could simply use a try/lock or even a lock-free structure.
What you really need here is a well-defined set of “RT-to-non-RT-and vice-versa-communication” channels and API functions that may be called by both RT and non-RT tasks, which ensures that RT and non-RT tasks can communicate in such a way that non-RT task cannot ever block the RT one
Sure there are some ways to make GPOS and RTOS coexist on the same machine, and even work alongside one another within exactly the same application. Basically, you have to design a small kernel with its own RT scheduling/synch/etc API that is in full control of interrupts and timers. This kernel have to think about the rest of the OS as of a low-priority task, and give it a chance to run whenever no RT tasks are in sight.
As long as we are speaking about the third-part solutions, this kernel is just a module/driver that does not make any calls to the OS, from the GPOS’s perspective. All its client apps also have to be KM drivers. I am not sure you can do it with Windows these days - in order to do it you need to write your own HAL, and I am not sure HAL Developer Kit is still available. If it came from MSFT, it could be done simply as a kernel extension/modification, i.e. the one that I spoke about in my very first post on this thread. In such case one could, possibly, even expect to do RT programming in the userland. This part would require quite a bit of integration with the existing OS, and, hence, quite a few modifications to the existing kernel would be needed, so that I am not sure it would be reasonable to allow RT tasks to get out of the kernel.
However, you just cannot run your RT tasks within GPOS, and simply pinning tasks to certain CPUs while still relying upon GPOS scheduler and interrupt handling mechanism is not going to help you here in any possible way.
I can take that, for I know who’s saying it.
Well, such a reaction explains quite a lot…
You know, literally the other day I heard a truly brilliant thing from someone. The bloke said “When you speak you are just repeating something that you know already, and, possibly, re-iterating your misconceptions and erroneous beliefs. However, when you listen you may learn something new”…
Anton Bassov