Real-Time OS

Nick Bannon nick at ucc.gu.uwa.edu.au
Sat May 20 23:14:13 WST 2000


On Thu, May 18, 2000 at 04:51:45PM +0800, Leon Brooks wrote:
> Bret Busby wrote:
> > OK, so why is Linux not a "Real Time OS", and, what is the difference?
> 
> Time is a little bit elastic under Linux (under most operating systems).
> It is difficult to guarantee that stuff happens at exactly the right
> microsecond.
[...]

Yes - it's the _guarantee_, rather than the speed that's at issue.
A RTOS lets you build a system in which you can _guarantee_ that a
particular action will take no more than a given time, even in the
worst case.

http://www.faqs.org/faqs/realtime-computing/faq/

Normally, you try to make the average or common cases go fast, but it
doesn't _really_ matter if some call takes a bit longer than expected. A
real time OS usually won't have virtual memory, for example - how can
you guarantee that a particular function gets called every 10ms or so,
if there's a chance it will get swapped out to disk and the system will
have to grind away for at least that long to read it back in?

On some systems (like Irix) you can say that some particular process is
a "real-time" process, which means that if it wants to hold onto the
CPU, it can. This can be useful for, say, CD burning - it reduces the
chance of a buffer underrun. However, the system will freeze whenever
it has to wait for the CD, and if the RT process is buggy and crashes,
it can take the machine down.

On Thu, May 18, 2000 at 01:34:57PM +0800, Scott, Simon wrote:
[...]
> I've always wondered, how is the pre-emptive multitasking maintained? By
> interrupting every n timeframe?

Yes - each time, the kernel selects the next process to run. It starts
it going, with a timer. If the process works for a while then sleeps,
or makes a I/O request that will block, all well and good. If the timer
expires, the process is pre-empted and the next one is selected.

> What happens if I turn interrupts off in a
> routine? When would I use a blocking call as opposed to a non-blocking call?
> Just who is that masked man?

Ah - well on a multiuser system like Linux, normal processes aren't
_allowed_ to turn interrupts off. The kernel can, when it needs to, but
normal processes can't use "privileged" instructions or access memory
that hasn't been allocated to them. (on pain of an exception)

Nick.

-- 
  Nick Bannon  | "I made this letter longer than usual because
nick at it.net.au | I lack the time to make it shorter." - Pascal



More information about the plug mailing list