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.

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

SMP support<br />

have startling consequences! Look at the file for a list of helper<br />

functions that ensure atomic operation.<br />

Released versions of <strong>QNX</strong> 4 are strictly single-processor, whereas <strong>Neutrino</strong>, at the<br />

time of this second printing, has support for SMP on the x86 and PPC architectures at<br />

least. SMP is a great feature, especially in an operating system that supports threads,<br />

but it’s also a bigger gun that you can shoot yourself in the foot <strong>with</strong>. For example, on<br />

a single-processor box, an ISR will preempt a thread, but never the other way around.<br />

On a single-processor box, it’s a worthwhile abstraction to “pretend” that threads run<br />

simultaneously, when they don’t really.<br />

On an SMP box, a thread and ISR can be running simultaneously, and multiple threads<br />

can also be running simultaneously. Not only is an SMP system a great workstation,<br />

it’s also an excellent SQA (<strong>Software</strong> Quality Assurance) testing tool — if you’ve made<br />

any “bad” assumptions about protection in a multithreaded environment, an SMP<br />

system will find them eventually.<br />

Porting philosophy<br />

To illustrate just how true that statement is, one of the bugs in an early internal version<br />

of SMP had a “window” of one machine cycle! On one processor, what was<br />

supposedly coded to be an atomic read/modify/write operation could be interfered<br />

<strong>with</strong> by the second processor’s compare and exchange instruction.<br />

Let’s now turn our attention to the “big picture.” We’ll look at:<br />

• Message passing and clients & servers<br />

• Interrupt Service Routines<br />

Message passing considerations<br />

Under <strong>QNX</strong> 4, the way a client would find a server was either:<br />

1 Use the global namespace.<br />

Or:<br />

2 Perform an open() on an I/O manager.<br />

Client/server using the global namespace<br />

If the client/server relationship that you’re porting depended on the global namespace,<br />

then the client used:<br />

qnx_name_locate()<br />

and the server would “register” its name via:<br />

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

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

Saved successfully!

Ooh no, something went wrong!