comp.lang.ada
 help / color / mirror / Atom feed
From: Wiljan Derks <W.Derks@nl.cis.philips.com>
Subject: Re: GNAT R/T Annex and Win95
Date: 1996/04/20
Date: 1996-04-20T00:00:00+00:00	[thread overview]
Message-ID: <3178FD23.78F0@nl.cis.philips.com> (raw)
In-Reply-To: 96041916380674@psavax.pwfl.com

Marin David Condic, 407.796.8997, M/S 731-93 wrote:
> 
>     Here's an interesting question which we've been thinking about
>     around here a lot:
> 
>     Do you consider Windows NT capable of being a "realtime" operating
>     system? (It doesn't seem to be advertised as such.... yet.)
> ...
>     We need to know things like "If I execute a delay statement, will
>     I wake up and have a deterministic span of time between the clock
>     going off and my code resuming?" Similar questions for interrupt
>     processing and such. Or "will the OS dynamically rescale my task
>     priorities and screw everything up?" Or priority inversions that
>     can occur if a low priority thread uses an uninterruptable OS
>     routine. Lots of things are uncertain about NT WRT its use as a
>     realtime OS.
> 
>     (Of course, you can always buy a processor that executes a
>     quintillion instructions per second and hope the latencies never
>     get big enough to matter! ;-)
> 
>     Opinions? I'd really like to have some best guesses to pass on to
>     the folks here who do these sort of systems.To my opinion NT performs real good when it comes to real-time behaviour.
To demonstrate this I wrote I program that shows this.
The program determines the maximum variation that it takes to be
rescheduled by the kernel.
It gave me a maximum of 800 microsecond variation on a pentium 120.
In the mean time I was copying files and clicking around on the desktop.
This means that the variation of the time between the clock interrupt
and the next procedure call in the waiting program is about 400 microseconds.
Notice that this program runs at real time priority on NT.
It will only run properly when it has the right priviledge.
In practice you also whould need to lock your code into memory to avoid
paging but that is another issue.
But anyway here is the code. I think it shows how NT performs.
When you ant to build the program you need GNAT and the NT bindings.

with ada.text_io; use ada.text_io;
with win32; use win32;
with win32.winbase; use win32.winbase;
with win32.winnt; use win32.winnt;
with interfaces; use interfaces;
with interfaces.C; use interfaces.C;
procedure testnttime is
   failed:exception;
   Counter,Previous,Freq:aliased Large_Integer;
   Min:Longlong;
   Max:Longlong;
   Dif:Longlong;
   First:Longlong;
begin
   if SetPriorityClass(GetCurrentProcess,
                       REALTIME_PRIORITY_CLASS)=win32.false then
      raise failed;
   end if;
   if QueryPerformanceFrequency(Freq'Unchecked_Access)=win32.false then
      raise failed;
   end if;
   Put_Line("Performance Frequency is "&Freq.Quadpart'img);
   loop
      Min:=LongLong'Last;
      Max:=LongLong'First;
      sleep(1);
      sleep(1);
      if QueryPerformanceCounter(Previous'Unchecked_Access)=win32.false then
         raise failed;
      end if;
      First:=Previous.Quadpart;
      for i in 1..1000 loop
         sleep(1);
         if QueryPerformanceCounter(Counter'Unchecked_Access)=win32.false then
            raise failed;
         end if;
         Dif:=Counter.Quadpart-Previous.Quadpart;
         If Dif<Min then
            Min:=Dif;
         End if;
         If Dif>Max then
            Max:=Dif;
         End if;
         Previous:=Counter;
      end loop;
      put_line("Maximum count "&Max'Img&" is "&
               Longlong'Image(Max*1000000/Freq.Quadpart)&" us");
   end loop;
end testnttime;

Wiljan




  parent reply	other threads:[~1996-04-20  0:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-19  0:00 GNAT R/T Annex and Win95 Marin David Condic, 407.796.8997, M/S 731-93
1996-04-20  0:00 ` Robert Dewar
1996-04-27  0:00   ` Dave Wood
1996-04-27  0:00     ` Robert Dewar
1996-04-20  0:00 ` ADA, Windows NT and Real-Time (was GNAT R/T Annex and Win95) Brian K. Catlin
1996-04-21  0:00   ` steved
1996-04-21  0:00     ` Brian K. Catlin
1996-04-20  0:00 ` Wiljan Derks [this message]
1996-04-20  0:00 ` GNAT R/T Annex and Win95 Tom Griest
1996-04-22  0:00 ` Theodore E. Dennison
1996-04-23  0:00   ` Wiljan Derks
1996-04-22  0:00 ` Greg Bond
  -- strict thread matches above, loose matches on Subject: below --
1996-04-23  0:00 Marin David Condic, 407.796.8997, M/S 731-93
1996-04-23  0:00 ` Theodore E. Dennison
1996-04-16  0:00 Greg Bond
1996-04-17  0:00 ` Tom Griest
     [not found] ` <4l2sliINNl7m@ra.dept.cs.yale.edu>
1996-04-18  0:00   ` Dale Pontius
1996-04-18  0:00 ` Robert Dewar
1996-04-22  0:00   ` Greg Bond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox