Newsgroups: comp.realtime,comp.os.qnx,comp.os.ms-windows.advocacy,comp.robotics
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!europa.eng.gtefsd.com!newsxfer.itd.umich.edu!news1.oakland.edu!rcsuna.gmr.com!kocrsv01!news
From: anderson@kosepc01.delcoelect.com
Subject: Re: Real-time systems:  Windows-NT or QNX
Message-ID: <1994Oct18.153809.3407@kocrsv01.delcoelect.com>
Lines: 91
Sender: news@kocrsv01.delcoelect.com (Usenet News Account)
Nntp-Posting-Host: kosepc01.delcoelect.com
Reply-To: anderson@kosepc01.delcoelect.com
Organization: Delco Electronics Corporation, Kokomo, Indiana
X-Newsreader: IBM NewsReader/2 v1.00
References: <FriOct14102309EST1994@eric>
Date: Tue, 18 Oct 1994 15:38:09 GMT
Lines: 92
Xref: glinda.oz.cs.cmu.edu comp.realtime:7228 comp.os.qnx:2272 comp.os.ms-windows.advocacy:40800 comp.robotics:14510

In <FriOct14102309EST1994@eric>, bernie@ecr.mu.OZ.AU (Bernie Kirby) writes:
>[...]
>I understand QNX use a strategy called pre-emptive scheduling where a
>highest priority task runs where as Windows and Windows/NT have a
>different approach called (I think- but dont quite me :-]) threads (I don't
>quite know how they work so if someone could compare the two that would be
>very helpful).  

Pre-emptive multitasking means that the operating system decides what task
is to be run at any time.  A task might be "pre-empted," or suspended, so
that a higher-priority task may execute.  QNX, OS/2, and Windows NT all use
pre-emptive multitasking.  With appropriate assignments of priority to the
tasks, this is a very effective way to get many things done at once.

The other common "multitasking" strategy, used by Macintosh System 7 and
Windows, is called cooperative multitasking.  Each task is responsible for
voluntarily giving up control at intervals in order to allow other tasks to
execute.  This works fine until a task "hogs" the CPU for too long, starving
another task and perhaps causing it to miss a deadline.

"Threads" don't enter into this debate.  They are often described as 
"lightweight processes," meaning that they are executing as separate tasks 
but don't have all the memory allocation overhead of a true process.

>Is "preemption" a good strategy for this type problem? I
>guess it must take some time for tasks to be swapped back to the processor
>so that must be a key-factor, though if I run my servo-loops as interrupt
>service routines that surely would be the overcome any problems  with
>context switching times. Are there any disadvantages of the interrupt
>service routine approach. 

QNX is designed for fast context switches.  That shouldn't be a problem.

>I'd sure be interested to know what people think
>is the most sensible strategy for doing this type of real-time
>programming. Robustness is an important consideration so bearing this in
>mind which scheduling approach is best suited to our problem.

For a true "hard" real-time system, pre-emptive multitasking is so sensible
that considering anything else would be silly.

>[...device drivers...]

QNX has device drivers and device driver templates for I/O of many sorts.
I'll let someone who uses them answer this more fully.

>[...windowing...]

Microsoft Windows is only a "standard" for home and Office Automation
environments.  For higher-end UNIX workstations, the "standard" is more
likely the X-Window System.  The names have *nothing* to do with each
other.  QNX supports X-Window applications.  QNX also has a leaner GUI
called Photon.  Multitasking priorities can be set to make sure the user
interface doesn't keep the system from doing its real work.

>[...hazardous/dangerous issues...]

Sorry, I can't help you much.  I will point out that you have to take into
account both the software and the hardware when discussing reliability!
There *are* computer hardware systems with built-in redundancy and fail-
safe features.  Software is another matter entirely...

>QNX calls isself a real-time operating system whereas Windows and Windows
>NT seem to be much more general and broader operating systems that provide
>facilities for real time control. Is is better to go for the generality
>wide spread applicability and large software base of Windows or do you
>think that QNX is better suited for the type of work we intend to do?

If you've got true real-time requirements, DON'T EVEN THINK OF USING
MICROSOFT WINDOWS.  There are just too many ways for the system to pause
while waiting for something to happen, and too many ways for a misbehaving
task to hang the system completely.  From what I've read, Windows NT eats 
CPU cycles for breakfast, lunch, and dinner, and wants a midnight snack as 
well; you'd better have a *very* fast CPU if you want to get user tasks 
done quickly.

QNX, being POSIX-compliant, is also a general operating system.  It's just
that it's been written to be very good at real-time tasks.  It's a member
of the UNIX family, one of the oldest OS's in use today.

>Any thoughts what-so-ever would be greatly appreciated.

There are other real-time multitasking systems around.  Some, like LynxOS,
are based on UNIX.  Others run in conjunction with MS-DOS or even Windows.
Still others have their own special environment.  The amount of number-
crunching, user interface, process I/O, and mass storage can push you to
one type of system.

=========================================================================
Alan Anderson      || Ignorance can be fixed, but stupidity is permanent.
I speak AT, not FOR, Delco Electronics.  || Ad Astra! (Ad LEO, anyway...)

