delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/18/06:04:55

Date: Tue, 18 Aug 1998 12:56:17 +0200 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
To: russell DOT thamm AT dsto DOT defence DOT gov DOT au
cc: djgpp AT delorie DOT com
Subject: Re: Realtime & DJGPP
In-Reply-To: <6r8bu2$ce9$1@nnrp1.dejanews.com>
Message-ID: <Pine.A32.3.91.980818124113.73468A-100000@ieva05.lanet.lv>
MIME-Version: 1.0


On Mon, 17 Aug 1998 russell DOT thamm AT dsto DOT defence DOT gov DOT au wrote:

> I am currently evaluating djgpp as a real-time development environment.
> Due to real-time constraints, I am only considering an environment without
> virtual memory and of course plain dos (no windows), so I am using
> CWSDPR0 for DPMI.
> 

I have used DJGPP for tasks that requires small interrupt latencies,
however the frequency of these interupts is not so high. My experience shows
that DJGPP compiled programs is only slightly worse than similar 16 bit
Borland C++ compiled program. 

However there will always be some time required for mode switching.
Also drivers for many devices for DOS may be not nice for such tasks

(Even if this maybe not nice to say this in DJGPP mailing list) I can 
suggest to try out Linux (more exactly modification of Linux for hard real
time tasks: rt-linux)

http://rtlinux.cs.nmt.edu/~rtlinux/

You will not lose any service provided by normal Linux kernel and at the
same time You'll additionally get support for real time tasks that 
are scheduled usually with only some (or some tenths) of microseconds
latency even under rather heavy system load.

DOS as I think is not the best environment for such tasks. Also Windows
is perhaps worse. To add real-time fuctions to Linux kernel, one should
patch it, that includes override of cli() and sti() macros used in kernel
to use soft interrupt enable flag instead of CPU's one. Only real time
subsystem really uses real sti and cli. Such way is not available for
Micro$oft products as Bill Gates will not release sources.

Andris

> I am using the timer interrupt (at 1kHz) to execute the real-time task.
> This gives me two levels of priority (interrupt and foreground).
> 
> I would like to implement pre-emptive scheduling, but it appears
> that real-mode is going to be a major problem.
> Ideally, I would like to prevent the timer interrupt from occuring
> while the processor is in real-mode.
> 
> Apparently CLI and STI don't work as expected. For instance, if the foreground
> task executes in a loop as follows:
> {
>   ...
>   asm("cli");
>   printf(......);
>   asm("sti");
> }
> 
> the timer interrupt still goes off in real mode. On the other hand, if
> I redirect the output of my program to a file  (xxx > xxx.lis), the
> timer interrupt does NOT appear to go off in real-mode. wierd huh.
> 
> How can I implement critical sections if cli/sti doesn't work?
> 
> BTW, I can tell whether the interrupt goes off in real-mode because
> the DS doesn't match my program's DS and selects an entry in the GDT
> not the LDT. (All other segment registers (except CS) are also changed).
> 
> I presume that I can avoid real-mode for screen I/O since the video
> memory is accessible from protected mode.
> 
> Some of my programs need access to network cards. Currently, I use packet
> drivers. I can use these from protected mode, but of course, the packet
> drivers are real-mode programs. This is potentially a worse problem
> since you never know exactly when a packet might arrive.
> 
> Are there any protected mode network card drivers available for djgpp?
> 
> I'd be grateful for any advice
> Russell Thamm
> 
> 
> 
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum
> 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019