Tuesday, May 1, 2012

Comparing the real time scheduling policies of the Linux kernel and an RTOS

I published this article in EE Times magazine.


Sy Tran said...

Good job in comparing Linux scheduling policies. I just have a few feed backs on some of the statements you mentioned in the article.

"In the RTOS scheduler, Thread1, with higher priority, always runs. Thread2 with lower priority never has a chance to run"

If you use rate-monotonic scheduling and if all your task loads never push the CPU to 100% then thread2 will eventually run. A thread in an RTOS while it is being the highest priority, it will generally run until completion then it switch out the context, thread stack, and CPU time to the lower priority thread. The rate-monotonic scheduling ensure that there will be CPU time allocated to other lower priority threads.

Checkout page 36, slide 2-8 in this document.

Keep up the good work with your blogs.

Sy Tran

Lê Trung Thắng said...

Thanks for your comments.

Unless highest priority task gives up controlling CPU ( wait for event, for example...), then there is no chance to it moving out off the context.

A task usually is designed to run on an endless loop, so there is no "completion" concept except you intend to do it but it is unusual design.