Categories
rtlinux systems

Comparing VXworks to RTLinux

A couple of years ago, one of our salesmen asked us to comment on a comparison between VxWorks and RTLinux performance that had a prospective customer worried. When we tracked down the article, we were dumbfounded that it was being taken seriously. The article was a student paper from a mid-level class in Networks with some obvious limitations that I’m sure are known to the author. (I am very thankful my undergraduate student papers were written before the Internet so they don’t show up years later.) The paper compares the old RTLinuxFree 3.1 to VxWorks. Here are some curiosities.

  • The author writes:
    “We configured both RTOSes to use round-robin scheduling policy to determine context switch time.” That’s impressive given that RTLinuxFree 3 did not ever support round-robin scheduling.
  • Measurements show RTLinux with better priority inheritance performance! RTLinux has never implemented priority inheritance for reasons described in my paper Priority Inheritance: Hack or Error.
  • There is a comparison of interrupt latency on an MPC8260 that is dubious: we measured RTLinux 3.x with about 1/10 of the latency he shows.
  • He compares the performance of a message receive call, despite the absence of such a call from RTLinux 3.1.
  • and so on …

The paper is available on a server in Korea and it shows up near the top of searches. There is a reason we don’t do that comparison (VxWorks license), but there is no good reason that project teams seriously considering options can’t do the comparison for themselves.

Tags: , .

Categories
rtlinux

Handbook of Networked and Embedded Control Systems

You can find an article on writing real-time control loops in RTLinux inside the giant Hristu-Varsakelis, Levine Handbook of Networked and Embedded Control. The article is by Edgar Hilton, Matt Sherer and myself and covers simple loops, loops with data and control going to the non-real-time “client” and loops using the Interface Kit (XML/RPC).

Categories
rtlinux

Proving Operating Systems Correct:#8

One of the longstanding problems with operating systems is that there is no way to validate their correctness in the same way that engineers can calculate the ability of a beam to carry a weight or a wire to carry a current. Well, the problem is worse than that, because we don’t even have a precise way of stating exactly what we want the OS to do. We have APIs, a good thing, but suppose that you want to show that an implementation of pthread_create is correct. The first question is correct according to what specification and then you start trying to figure out a precise way to state the requirements implied by the man page. Not easy. At least for me. This paper is a start.

Categories
rtlinux software business

The romance of trade and fuzzy slippers

Commerce used to be more fashionable. The French historian Fernand Braudel writes that in the 1630s “ten ships a year from the Indian ocean, from Calicut, Surat, or Msulipatam, and the odd Portugese ship out of Goa were still arriving in Mocha with cargoes of pepper, cinnamon, nutmeg, and cloves“. He quotes a French trader of the 17th century about Cairo: “the number of merchants of the Indies is beyond reckoning, in coffee, incense, gum, aloes of all sorts, senna and tamarind, saffron-bulbs, myrrh, ostrich plumes, fabrics of all kinds of thread and cotton, stuffs and porcelains.” I’d like to believe that 300 years from now, someone will read “real-time operating systems from New Mexico sent for cell phones in Nice, jet engine testers in Hartford, machine tools in Shanghai, network switches in Sunnyvale, and locomotives in Germany” and marvel at the odd commerce of a forgotten age. It does seem unlikely. the software business is just not as romantic as shipping coffee and tamarind via Mocha. But I doubt that those ancient merchants in Mocha could beat us on sheer absurdity of our Internet age world mix of cultures. G. and I went to visit the Japanese owned machine tool company in Shanghai, climbed the stairs to a foyer where, as per Japanese custom, shoes were exchanged for slippers provided by our hosts, and then we tried focus on a serious business discussion, suavely drinking green tea while dressed in suits and ties wearing fuzzy Budweiser-logo slippers on our feet.
I guess it could have been worse.fuzzy slippers

Categories
Uncategorized

Spyware and Security

So an exec from Claria (formerly known as Gator) heads off to the US Government’s . department of Homeland Security. As of today, if you Google “claria spyware” you get 44000 hits. The commercial (and governmental) utility of building security holes into software should never be overlooked. Security holes in software are a combinations of poor engineering and on-purpose engineering. The most straightforward methods of implementing digital rights management and most obvious techniques for automatic download of updates and remote management are to build holes which are invitations for security failures. And companies and governments anxious to gather data about citizens/consumers or to steer them towards favored sites are naturally impelled to exert their ingenuity to exploit and widen those holes.

Categories
rtlinux

RTLinux easy but RT hard.

I wrote a chapter for an academic book recently and the publisher sent me a “copyright assignment” form ( don’t even start) that asked me, among other things, to provide a warranty that it was perfectly safe to use the methods I described. Well, to be plain – it’s not. Real-time software gives you a plethora of opportunities for causing damage (there was that programmer in Jersey, not using RTLinux, who discovered his mistake when the placer robot started tossing 50Kg blocks of steel at him). So please let’s not have a “real-time programming for dummies” anytime soon. dummies But it’s a lot easier to write correct real-time software, even for smart and well educated people, if the operating system is not making things unnecessarily complex. In fact, that’s a good description of our mission at FSMLabs: rooting out and destroying unnecessary complexity in real-time systems. The PSDD system by Barabanov is pretty impressive at that, but here’s how to write a simple data acquisition loop in vanilla RTLinux courtesy of the “main” system mostly due to Cort Dougan. This is a quantum jump over the original “Linux module” stuff we had in the old days and it opens up many new improvements. Note that standard out even works! Proof that “simple” and “raw” are different.

The basic loop looks like”while(running){ input data; forward data; wait until next period;}. A RTLinuxPro application to implement this consists of a Linux/BSD executable dot-rtl program and some Linux or BSD post processing. The dot-rtl program usually has the form ” thread; main(){}” where the main routine initializes data and starts the thread. A simple version would output to standard out. Then you could use a command line “myprogram.rtl > logfile” or “myprogram.rtl | postprocess”to log or postprocess the data. Here is an example running at a period of 200 microseconds with data consisting of a single 32bit value and a count that can be used as a kind of timestamp. Just add some error checking and go.

#include
#include
#include

pthread_t thread;
int running = 1;
extern void get_input(int *);

void *loop(void *t)
{
unsigned int data;
unsigned long count = 0;
struct timespec next;
rtl_clock_gettime(CLOCK_REALTIME, &next);

while ((volatile int) running) {
get_input(&data); //you write this one.
printf("%ul %un", count, data);
count++;
timespec_add_ns(&next, 500 * 1000);
rtl_clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &next, NULL);
}
return NULL;
}

int main(void)
{
rtl_pthread_create(&thread, NULL, loop, (void *) 0);
rtl_main_wait(); //wait for stop from user
running = 0; // not really necessary, but it seems cleaner to me.
rtl_pthread_cancel(thread);
rtl_pthread_join(thread, NULL);
return 0;

}

Categories
rtlinux

Embedded productivity and engineering skills

I was at some trade show wandering around with a cynic who was pointing out that every booth advertised productivity improvements. How many improvements we’ve made to productivity, and this has gone on for years” he said,“By now, we must be able to make incredible things with no effort.” In the embedded world, productivity is, of course, not incredible – or at least not incredibly good – but this can change. Using Linux or BSD as platforms in embedded development is a huge step although the Legacy RTOS (LRTOS) vendors and the 16bitters are fighting all the way. Our customers who come from the LRTOS world are often amazed to discover that many complex problems (like: display a graphical window on a remote machine) are trivial on a modern POSIX operating system. And the productivity gains of hardware platform independence are also big: You mean I can start software development now on a PC or reference board and just run the same software on our hardware when (or if) our hardware is ready? You mean we don’t have to start six months late?

A standard data acquisition program on RTLinuxPro is so easy it’s hard to believe.
See the post on control loops

Categories
operating systems

Synchronization blues

Synchronization is hard in real-time applications, but not as hard as people imagine. If you follow a few simple rules you can make it manageable.

  1. Never force priority and mutual exclusion to fight each other. You can’t mean “Task A is more important than TaskB” and “TaskB should be able to lock TaskA out of some data structure as long as it want” at the same time.
  2. Long critical sections are sure signals of bad design. Use a simpler data structure or a client/server architecture or something.
  3. Stick to two or three mechanisms. If semaphores and RT-Fifos don’t do the trick, then maybe you should simplify your design.

See my paper for more details.

Categories
software business

Class and lack thereof

From the always readable Joel on Software:

Attention, FogBugz competitors: a court has ruled that you are welcome to continue to advertise your products when people search for FogBugz on Google. I actually don’t think there’s anything wrong with this although it does show a certain lack of class, mm, don’t you think? You don’t see Wal*Mart advertising when you search for Tiffany.

Type “rtlinux” in Google. RTLinux is a registered trademark of FSMLabs. Actually, the number of companies on the right has declined over the last year.

Categories
Uncategorized

Soft real-time and software costs

Imagine designing an automobile with a motor that runs really well on a demonstration frame, with none of those heavy panels or safety devices, and only tested on a short flat track. Imagine an engineering team designing an automobile or truck deciding that since high torque is only needed rarely, they don’t have to worry about it. Imagine that team being surprised to find that as they add more to their prototype vehicle and start testing it on hills, it starts to fail more and more often. And imagine the management team who enthusiastically endorsed the use of a very low cost engine and similar tactics on project after project, complaining about the low margins and high cost of development in their industry where so many projects fail or need massive redesigns!