*BSD News Article 9686


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6293 ; Thu, 07 Jan 93 19:02:41 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!zaphod.mps.ohio-state.edu!malgudi.oar.net!caen!uwm.edu!ogicse!pdxgate!jrb@rigel.cs.pdx.edu
From: jrb@rigel.cs.pdx.edu (James Binkley)
Newsgroups: comp.unix.bsd
Subject: setitimer bug revisited/signal question/midi/mpu
Message-ID: <6679@pdxgate.UUCP>
Date: 8 Jan 93 22:59:07 GMT
Article-I.D.: pdxgate.6679
Sender: news@pdxgate.UUCP
Lines: 54

I've been trying to figure out why the "real timer" in
setitimer was "unreal"; i.e., you couldn't do better
than 10Hz.  You should be able to.  The real timer
works correctly on BSDI and sun boxes with the code
I posted before. On 386bsd, you could never get
better than 10hz; i.e., 10 interrupts per second.
You should be able to get somewhere up to around 100hz
(but not quite).  I also discovered that the same
thing was true for the other two setitimer timers,
profiling, and virtual (limited to 10hz).  The problem seems to be based
on the fact that code in kern/kern_sig.c/psignal()
has changed (say from 4.2 BSD) 
so that in a lot of circumstances, need_resched() is
*not* called. In the past, I believe any signal would cause
rescheduling to occur. Here it won't occur until the 
round-robin daemon runs at 10 times a second... So to quote
a long departed political leader: "what is to be done?"  

As an experiment, I tried blatantly toggling want_resched
like so in realitexpire() in kern/kern_time.c. 

/* kern/kern_time.c
*/
realitexpire(p)
....
{

	extern int want_resched;

	want_resched++;
	psignal(...);
	...

This routine
is called as a timeout routine by setitimer(2) when the
"real timer" is started. The result was the real interval
timer worked correctly.  Here's a possible suggestion
as to one approach (what do other people think?).  I think
psignal should be altered so that when any of the 3 signals
used by setitimer are called, need_resched is called.  I need
to look at the kern/kern_sig.c code a little more.  

And now for the midi/mpu part.  I've been working on a "sequencer" --
trying to port it to UNIX from dos.  I have a simple mpu401 driver
if anybody wants it, and I'll get around to getting the sequencer
put out someplace for ftp'ing in a bit.  (It needs some aging
and I've got some curses work to do first).
The cute part was that I just played Bach's Fugue #9 from the Art of the Fugue
on a UNIX box. I've always maintained that music wasn't very real-time.
Of course, I wasn't hooked to a network and wasn't running sendmail
in the background... it worked fine.

				Jim Binkley
				jrb@cs.pdx.edu