[wdmaudiodev] Re: very low latency audio and a C# UI?

  • From: "Voelkel, Andy" <andy.voelkel@xxxxxxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 26 Feb 2009 12:56:32 -0800

I'm not sure you are right about the way the gc manages threads. I've
read more than once that when it runs, it "suspends all threads".
Assuming that is right, I'd have to have a way to letting it know that a
thread doesn't execute managed code. That's where all this gets hairy
and it becomes difficult to get information. And of course there is the
chicken and the egg problem - I don't want to spend the time to become
and expert if it won't pay off, but I may have to become an expert to
know if it will pay off.


Thanks for the help. I'm really quite surprised that is so hard to find
stuff on this. It seems that folks writing low latency audio apps are
just continuing to write in C++. That it a lot of extra work (if you can
solve gc problem).


- Andy



From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Tim Roberts
Sent: Thursday, February 26, 2009 11:48 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: very low latency audio and a C# UI?


Voelkel, Andy wrote: 


Thanks. That helps, just to know it is possible. One of the things I
don't know how to do create an "unmanaged threads". I was under the
impression that threads themselves aren't managed or unmanaged, only
code was.

You're quite right; I spoke too loosely.  What I really meant was
"threads that execute unmanaged code".

And therefore I don't know how to arrange it so that the gc knows that
my low latency thread doesn't contain unmanaged code and thereform
doesn't suspend it".

As I understand it, the garbage collector doesn't force a thread to be
suspended.  It merely "borrows" a thread at a convenient time, when the
thread has made some managed call that involves memory.  Do you remember
writing Win16 applications?  There were certain API calls that could
cause your application to yield its time slice to another application,
otherwise you never gave up the CPU.  It's the same concept here.  If
you have a thread that never makes any .NET calls, then it will never
enter the garbage collector.

At least, that's my understanding.  Although I have written a fair
amount of C# code, there are still a lot of things about .NET where I am
quite fuzzy.  I do know that DirectShow works very well when driven by a
C# app, and that couldn't work if the threads were suddenly being yanked

Remember, after all, that Windows Media Center is a C# managed
application with a DirectShow core.

Do you have any book or other reading recommendations that would
enlighten me on such issues?

I've heard good things about Richter's "CLR via C#", and very good
things about Cwalina's "Framework Design Guidelines: Conventions Idioms,
and Patterns for Reusable .NET Libraries."  I don't have any good
references on mixing managed and unmanaged code, although Google has a
lot of hits for that phrase.

Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.

CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or 
previous e-mail messages attached to it, may contain information that is 
confidential and/or legally privileged. If you are not the intended recipient, 
or a person responsible for delivering it to the intended recipient, please DO 
NOT disclose the contents to another person, store or copy the information in 
any medium, or use any of the information contained in or attached to this 
transmission for any purpose. If you have received this transmission in error, 
please immediately notify the sender by reply email or at 
mailto:privacy@xxxxxxxxxxxxxxx, and destroy the original transmission and its 
attachments without reading or saving in any manner.  

 For further information about Plantronics - the Company, its products, brands, 
partners, please visit our website www.plantronics.com.

Other related posts: