After the advent of windows on ARM/Windows Phone 8, there is always a concern among the windows CE community on the future of Windows CE. When compared to windows on ARM/windows phone 8 there are many reasons to believe that windows CE is here to stay, in this blog I compare one of the interrupt handling features - priority inheritance mechanism, of Windows CE that determines its real-time capability.
How predictable and reliable a system is, on reacting to an interrupt, defines its real-time effectiveness. When a common resource is shared among 3 tasks using Mutex there is a possibility of a situation where the high priority task had to wait for the lower priority task to release the shared resource. In this case the high priority task remains blocked, causing a priority inversion situation where high priority task is indirectly pre-empted by a low priority task, effectively "inverting" the relative priorities of the two tasks, meaning the high-priority task has to wait for the completion of the lower priority task before it can resume execution.
There is no such thing as a perfect design that would avoid priority inversion, an RTOS should nevertheless have the capability to recover from such a situation. It was a priority-inversion problem that rendered the Mars Pathfinder inoperable.
Windows CE has implemented the priority-inheritance mechanism to recover from such a situation. During a priority-inversion situation, priority inheritance mechanism boosts the lower priority thread's priority to that of the higher priority thread, so that the lower priority thread continues to work and releases the Mutex. As soon as the Mutex is released the system restores the thread's priority levels and the higher priority thread continues its execution.
Windows Phone 8 follows Windows NT architecture where there is no concept of priority inheritance. The bottom end of interrupt handling is done by
deferred procedure calls (DPCs) which can't be preempted and hence the potential of blocking real-time tasks is large. Windows phone 8 with windows NT kernel, has been designed for a different market segment and windows CE is a distinct operating system designed to cater to a market segment where real-time behavior is a major concern, for example; Industrial automation, Medical devices, instruments etc.
For more than a decade Sasken has been closely working with leading SOC developers and device manufacturers in developing Windows CE board support packages and bringing up windows CE on their devices and tuning its real-time performances.
Authored by Chakrapani Krishnamoorthy