Thursday, May 24, 2012

What is Hard Real Time OS?

There is no particular specification for Hard Real-Time OS kernel. But, it can be defined as "a Real-Time OS kernel which can be used to build a Hard Real-Time System". What is a Real-Time System? Hard Real-Time System is a combination of Hardware plus Software which has been designed so that it will meet all of its deadlines even when the system is loaded to the maximum. 

As a simple example, you have an hardware target board in which you run TCP application which just downloads the data at High priority. And, it has a periodic Task at Low priority which blinks the status LED at 1 second interval. If you can make the status LED to stop blinking by downloading a big amount of data, then it is not a Hard Real-Time system. If you have designed the system so that the LED never stops blinking even if you download a big amount of data continuously, that is called Hard Real-Time System. It does not matter whether you use an RTOS or not, whether you use an Single core or Multi-core. If an RTOS kernel can help such a system, then it can be called Hard Real-Time OS kernel. So, what are all the requirements to be met to help to build such a system? You can say a OS is a Hard Real-Time OS, if

① The execution time of each and every system call of the kernel, interrupt latency and the task switching time have been defined/measured accurately. They are predetermined.

② Priority-based pre-emptive kernel. The Kernel always runs the tasks, interrupt service routines according to the priority. At any point of time, it runs the highest priority task or ISR of the current moment.

③ The system never gets into deadlock. Priority inversion has been implemented by Mutex.

The application should be designed according to the Rate Monotonic Algorithm to be Hard Real-Time.


Finally, I can define a Hard Real-Time OS as follows. The requirements are as specified above:

A Real-Time OS Kernel which facilitates to build an application that can meet all of its deadlines even when the system is loaded to the maximum is called a Hard Real-Time Operating System.
 
------
1) Rate Monotonic Scheduling Algorithm
It is about two things. One is about priority assignment. Second is total CPU utilization.
 
a) the shorter cycle duration is, the higher is the job's priority
 
Assume you will have enough time to complete all tasks. But, if you finish the job, who will come to you first, it will be safe. So, whose deadline is shorted, finish it first.
 
b) Overall CPU utilization has to be maximum of 69.3 % to meet all deadlines assuming infinite number of tasks.
 
This assumes all the tasks are periodic, Ti specifies the cycle period and Ci specifies the worst-case execution time. So, utilization specifies howmany percentage in one second is utilized by each task. Addition of all specifies the total utilization.
 
U = C1/T1 + C2/T2 + C3/T3 +....

No comments: