Is it necessary to code RTOS in C language always? Why can't that be coded in java or some other technology..?? Is that because of the absence of pointer concept in java?
Garbage collection is the big reason against Java being Real Time. JIT is another, but it could be overcome.
In general though, C being effectively portable assembly gives very predicable run-time performance, and that's essential for reliable real-time execution.
Because RTOS developers, most likely, don't know C++ well enough.
C++ in Embedded Systems: Myth and Reality
Some perceive that C++ has overheads and costs that render it somehow unsuited to embedded systems programming, that it lacks the control and brevity of C, or that, while it may be suited to some niche applications, it will never displace C as the language of choice for embedded systems.
These perceptions are wrong. Where compilers and other tools are adequate, C++ is always preferable to C as an implementation language for embedded systems. While doing everything that C does, it offers greater opportunities for expression, encapsulation, re-use, and it even allows size and speed improvements that are impractical in C.
> Why, then, do these perceptions persist? The main reason is that when people form their opinions, they know a lot more about C than about C++. They have read some books, written some code, and are competent at using the features of C++, but they lack the knowledge of what is happening under the hood, the familiarity that allows one to visualize the disassembly while typing source or even while formulating a design.
Guidelines for using C++ as an alternative to C in embedded designs
Embedded software applications are most commonly written in C. For many years, C++ has been seen as the natural successor and has found greater acceptance, but the increase in its usage has been much slower than anticipated.
There are a number of reasons for this. Firstly, embedded developers are quite conservative and prefer to use solutions that are proven rather than novel " "if it ain't broke, don't fix it".
There is also the lesson of experience. Many developers have attempted to use C++ for embedded applications and failed. Such failures may sometimes be attributed to shortcomings in development tools, but most often it is the inappropriate use of the language " treating an embedded system like a desktop computer " that is to blame.
Limitations of C Although C is widely used, it has limitations, as it was not designed for embedded applications or for projects of a scale that is now commonplace. Key limitations include:
1) C is extremely powerful and flexible and can therefore be dangerous.(It has low level capabilities - which are useful for embedded " but also represent many pitfalls for the unwary.)
2) Programmers need to be very methodical and disciplined
3) Programmers need to understand how the program behaves at low and high levels (large projects are thus hard to maintain)
4) Programmers need an expert knowledge of the application
However, C++ has powerful object oriented capabilities which can help significantly with addressing the limitations of C:
1) it encapsulates and hides areas of high expertise from non-experts into "objects;" (A test case will demonstrate the encapsulation of expertise later in Part 2 in this series).
2) Objects can be used intuitively by non-experts to implement conceptual designs at a high-level
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With