26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>QNX</strong> 4 and <strong>Neutrino</strong><br />

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG.<br />

• portable architecture; currently supports MIPS, PPC, SH4 and ARM processors as<br />

well as x86<br />

• supports SMP<br />

• more documentation<br />

While some of these improvements are “free,” meaning that there are no compatibility<br />

issues (for example, POSIX pthreads weren’t supported under <strong>QNX</strong> 4), some things<br />

did require fundamental changes. I’ll briefly mention the classes of changes that were<br />

required, and then we’ll look in detail at the compatibility issues caused as well as<br />

suggestions on how to port to <strong>Neutrino</strong> (or keep your code portable between the two).<br />

Embeddability<br />

<strong>Neutrino</strong> totally redesigned the way that the operating system was embedded. Under<br />

<strong>QNX</strong> 4, in the original release, it was marginally embeddable. Then <strong>Neutrino</strong> came<br />

along, designed to be embeddable. As a bonus, <strong>QNX</strong> 4 underwent some changes as a<br />

result of the experience gained in <strong>Neutrino</strong>, and now <strong>QNX</strong> 4 is vastly more<br />

embeddable than it had been. In any event, embedding <strong>QNX</strong> 4 versus embedding<br />

<strong>Neutrino</strong> is almost like night and day. <strong>QNX</strong> 4 has no real support for things like:<br />

• kernel callouts (interrupt, timer)<br />

• startup configurability<br />

• image filesystem<br />

whereas <strong>Neutrino</strong> does. The definitive book on that subject is QSS’s Building<br />

Embedded <strong>Systems</strong>.<br />

Thread support<br />

<strong>QNX</strong> 4 had a function called tfork() that let you use “threads” by creating a process<br />

<strong>with</strong> its code and data segments mapped to the same memory locations as the creating<br />

process. This gave the illusion of a thread by creating a process, and then changing the<br />

characteristics of the newly created process to make it look like a thread. While there<br />

is a thread library available for <strong>QNX</strong> 4 on QSS’s update system, the kernel itself<br />

doesn’t support threads directly.<br />

Under <strong>Neutrino</strong>, the POSIX “pthread” model is used for all threading. This means that<br />

you’ll see (and have seen in this book) familiar function calls like pthread_create(),<br />

pthread_mutex_lock(), and others.<br />

Message passing<br />

While the impact of threads on message passing may seem minimal, it resulted in a<br />

fundamental change to the way message passing was done (not to the fundamental<br />

concepts of message passing, like SEND/RECEIVE/REPLY, but to the<br />

implementation).<br />

Under <strong>QNX</strong> 4, messages were targeted at process IDs. To send a message, you simply<br />

found the process ID of the target and did your Send(). For servers to receive a<br />

288 Appendix: A • <strong>QNX</strong> 4 to <strong>Neutrino</strong> April 30, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!