Re: clocks
Re: clocks
- Subject: Re: clocks
- From: Jeff Moore <email@hidden>
- Date: Mon, 17 Nov 2008 12:26:09 -0800
On Nov 17, 2008, at 12:10 PM, Sam Aaron wrote:
The algorithm you specify was in fact the first approach I took.
However the cumulative effect of what you describe as the scheduling
latency and the high latency of JRuby's message passing (which was
generating and sending MIDI packets) made me believe that there was
a better approach, and perhaps even something already available I
could just pick up and run with.
All the timer support on the system are variations of this algorithm
one way or another. It seems to me that part of your problem is how
long it takes to get from the native thread into the JRuby
environment. As long as you need to keep doing that, you are going to
take a hit on the amount of latency in your clock.
(I had recently assumed that Core Audio Clock might have been that
very thing which led me to this list)
The CoreAudio Clock API is there to help resolve one time-base against
another. It's callbacks are implemented along the lines of this
algorithm, however.
However, from what I understand of what you were describing, all I
need to do is to drop down to a C thread and use more accurate
system calls.
Doing this does not alleviate any of the issues of calling from the
native environment into a JRuby environment. The only way to get out
of those issues is to not call into JRuby and to do all your work in
the native context.
I have heard of mach_absolute_time, however, I don't have much
experience in C thread scheduling. In particular I'm not aware of
what you describe as the 'time constraint policy the scheduler
provides' an understanding of which you say is necessary to ensure
as little scheduling latency as possible occurs. Do you by any
chance have any pointers to documentation/examples of this. In a
similar vein perhaps you might also be so kind as to point me to
documentation/examples of pthread_cond_timedwait_relative_np().
The actual code that runs the HAL's IO thread is the HP_IOThread class
in the HPBase folder in the HAL section of our SDK. Much of the
underlying threading primitives are implemented via the CAPThread,
CAMutex and CAGuard classes in the PublicUtility section of our SDK.
--
Jeff Moore
Core Audio
Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >clocks (From: Sam Aaron <email@hidden>) |
| >Re: clocks (From: Jeff Moore <email@hidden>) |
| >Re: clocks (From: Sam Aaron <email@hidden>) |