From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dfedbe83126d2210 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-27 01:28:07 PST Sender: sjw@galadriel.frlngtn.gecm.com Newsgroups: comp.lang.ada Subject: Re: Anyone using Ada with Real-Time Linux? References: <8QcM7.77531$XJ4.41637211@news1.sttln1.wa.home.com> <3c034fbb.1313812@News.CIS.DFN.DE> From: Simon Wright Date: 27 Nov 2001 09:19:03 +0000 Message-ID: Organization: Alenia Marconi Systems, ISD, Farlington X-Newsreader: Gnus v5.5/Emacs 20.3 NNTP-Posting-Host: galadriel.frlngtn.gecm.com X-Trace: 27 Nov 2001 09:16:12 GMT, galadriel.frlngtn.gecm.com Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!btnet-peer1!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!galadriel.frlngtn.gecm.com Xref: archiver1.google.com comp.lang.ada:17029 Date: 2001-11-27T09:19:03+00:00 List-Id: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) writes: > On Sun, 25 Nov 2001 20:50:12 GMT, "DuckE" > wrote: > > >I have an application that acquires data at 1 msec intervals, processes the > >accumulated data and transmits a summary of the data across a network every > >330 msec. The application is currently written in C and runs on VxWorks. > >Moving the application to a different target, still under VxWorks means > >shelling out another $30K to Wind River, plus $200 per target (at least). > >If I can come up with a less expensive choice using Ada, ths may provide an > >opportunity for a swithc. > > A question to wise men. Is above achievable under "normal" Linux, > provided that only Ada application is running and tasks are > dispatched by Ada RTS? Will hard disk I/O be a problem? TCP/IP > socket I/O? The main problem is the 1ms period. Under Linux 2.2 you can set the kernel jiffy down to 0.5 ms by altering HZ to 2000 in asm/param.h, alter linux/kernel/sched.c:sys_nanosleep to remove the busy-wait on short delay requests up to 2 ms, and rebuild the kernel. You really ought to rebuild the standard library too, since Linux doesn't have a complete sysconf, but it seems to work pretty well (we've not used this in production work yet, just in a testbed). The reason for setting HZ to 2000 is that GNAT uses nanosleep to implement delay, and nanosleep delays for 1 more jiffy than you expected so that it can be sure to delay for at least the time requested. The final trick is to run your tasking Ada program as root. This puts it into the SCHED_FIFO real-time dispatching class (to borrow a Solaris-ism). There is a way to get SCHED_RR instead (under 3.14a1, anyway; I expect it's one of the configuration pragmas if it's anything like Solaris). Whether this would fit the requirement I don't know; there might be unavoidable delays, as Dmitry says.