Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!maps.cs.cmu.edu!jcd From: jcd@maps.cs.cmu.edu (Jean-Christophe Dhellemmes) Newsgroups: comp.sys.next Subject: NeXT and Real-Time Keywords: real time music mach ualarm paging operating system Message-ID: <8196@pt.cs.cmu.edu> Date: 27 Feb 90 16:48:16 GMT Organization: Carnegie-Mellon University, CS/RI Lines: 68 Real-Time on the NeXT ? ======================= I am interested in real-time applications on the NeXT machine. I know that the current version of Mach for the NeXT doesn't support such capabilities, but I was still hoping I can get good enough performances on the machine for my needs. Until today. I did some simple tests using the Mach system calls to get the real time system clock, and found out that the call to gettimeofday(2) take about 160 microseconds to execute. My timing needs are an accurate as well as stable 1ms resolution clock, so I was confident at this point. I tried to use ualarm(3) to execute a function every millisecond (ualarm let you set up any interval between 1 and ~65000 microsecond) and found out that the NeXT machine can't keep up with that speed and that for any interval smaller than ~65000 (the max, i.e. 65 ms), the process keeps losing interrupts. It's pretty OK for 60ms, or 30ms if I nice(1) the priority to -20 in superuser mode. I get better results too if the main program does a getchar(3s) instead of busy waiting. In any case, those results are far from the accurate 1ms timing I am expecting. I tried the same test programs on a very fast multiprocessor machine, and even though Unix doesn't provide guaranteed low latency task wake-up, I could go down to 500 microseconds without missing interrupts. That is when the NeXT machine will be faster, I'll be able to do it. I haven't used the 1ms timing facilities described in NeXT's Midi Library documentation, and this is the next tests I am going to do. Anyway, Mach is not a real-time system and in the current version will never guarantee that you can execute a function in time. Virtual memory and paging are high-priority kernel funtions and don't have a time limit for execution. So I doubt the NeXT's Midi stuff will give a perfect answer to my problem. Now, a quick comparison with the Comodore Amiga family will bring me to ask questions about NeXT and real-time: I have developped a lot of real-time software on the Amiga's operating system, and even the Amiga 500 (with a 68000) allows accurate 1ms timing in a multitasking environment. This proves that the NeXT's machine hardware should be able to handle such speeds, but Mach hides those capabilities completely. I believe this is due to virtual memory and paging. I think that NeXT has been working for two years on a real-time version of Mach, but hasn't come up with anything yet. I would expect much better real-time functions from a system that contains a DSP and great sound capabilities. This questions the NeXT machine's philosophy. What does need more real-time than musical software ? I can't make use of the DSP and Midi on the NeXT machine, for me they are useless without a real-time operating system, or at least some low level "hacks" to do real-time work. Would it be possible to catch "ultra-high-level" interrupts to implement my own real-time kernel ? I am opened to any suggestions, including solutions that will give me *practical* real-time capabilities, even if they don't guarantee any time limit in the worst case. I guess the people at NeXT read this netnews, and I am asking them what's new to do real-time on the NeXT, and wether I can hope one day to develop SERIOUS musical software on the NeXT. * JCD --------------------------------------------------------------------------- Jean-Christophe DHELLEMMES. e-mail (jcd@maps.cs.cmu.edu) (412-268-8801) Carnegie Mellon University - School of Computer Science. 5000 Forbes avenue Pittsburgh PA 15213. ---------------------------------------------------------------------------