• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CLI producer code cycle starvation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CLI producer code cycle starvation


  • Subject: Re: CLI producer code cycle starvation
  • From: Kurt Revis <email@hidden>
  • Date: Thu, 20 Jun 2002 08:10:08 -0700

When I run the audio player from the command line, leaving the rest of
the system quiescent, the audio file plays to completion. But if I grab
a window on the screen with the mouse, and wave the window about vigorously,
the IOProc empties the ring buffer before the decompressor gets scheduled
again, based on diagnostic printout of buffer indices and the like.

I've been through the same thing recently. Check the archives for the thread with subject "More thread scheduling observations", around May 5th.

The basic idea is that you want to increase the priority of your feeder thread a little bit, and set it to not be scheduled using the timeshare policy (so its priority will not be adjusted dynamically).

Here is some code which implements this:
http://www.snoize.com/Code/PlayBufferedSoundFile.tar.gz
See QTSoundFilePlayer.m, especially the -setThreadPolicy method.

Also, my understanding is that the window-dragging thing is considered a bug, which will supposedly be fixed in Jaguar.

c) just for my curiousity, why is the scheduler (almost) *never* scheduling
the producer process? Is it because the program itself is scheduled every
time there's a call to the audio IOProc, and so by the scheduler's lights,
the player is getting its share of cycles?

It isn't getting any time because the window server (which is what handles the window drag) is running with a very high priority, and is starving out other timeshare threads. Non-timeshare threads (like your audio IO threads) still get a chance to run, though.

As I understand it, the scheduler mostly treats threads as independent entities, regardless of what task they belong to. So the scheduler won't deny a thread some time just because it recently gave another thread in that task some time. (This is undoubtedly an oversimplification, though...)

Hope this helps.

--
Kurt Revis
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >CLI producer code cycle starvation (From: Jim Snyder <email@hidden>)

  • Prev by Date: Re: problem writing OS X audio driver
  • Next by Date: Re: CLI producer code cycle starvation
  • Previous by thread: CLI producer code cycle starvation
  • Next by thread: Re: CLI producer code cycle starvation
  • Index(es):
    • Date
    • Thread