Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've noticed this today - my entire system froze up solid, clock is frozen, nothing responds to clicks and key presses, and my time machine animation stopped going. While repartitioning my boot drive. I also had iTunes open, which happily kept on playing music. How does iTunes manage to keep playing media if the entire OS is frozen up solid? No other OS X media player I've seen can do this, and I'd love to know how this is possible.


share|improve this question

migrated from Jun 11 '11 at 5:32

This question came from our site for professional and enthusiast programmers.

I think it's always a good question to ask how one can make one's program more responsive! – Yuji Jun 11 '11 at 4:08
That's true. I can not stand un-responsive programs! – Tristan Seifert Jun 11 '11 at 4:58
up vote 5 down vote accepted

I believe iTunes uses real-time threads, which is a certain type of threads which are given constant fraction of time whatever happens on the machine. See this apple doc for a short discussion. You can find more info in the OS X Internal book. The book is a bit dated (it mainly discusses 10.4 Tiger) but the kernel internals haven't drastically changed.

I think other media players don't operate as real-time threads; these days the computers are quite powerful and the music doesn't stop even under the standard scheduling policy, unless you do an extremely kernel-intensive task.

share|improve this answer
Thanks for the links, I've never known that OS X had more than one type of thread. I figure this must be what iTunes uses. Thanks for the response! – Tristan Seifert Jun 11 '11 at 4:58

My guess is that when you select a song to play in iTunes, iTunes will push almost all of the raw data for the song into a DMA. Because of the way that I/O devices talk to the CPU, each device has it's own memory address. Once the CPU has finished pushing data to that address, the I/O device can use the data there withou the CPU having to babysit it. So iTunes moves the data for the song to the sound device's memory address and the sound device starts playing it. When the CPU locks up while you're playing a song, the sound device hasn't realized the CPU stopped, and just keeps using the data from its memory address, playing the song.

share|improve this answer
Heh, I figured that iTunes must be doing some low-level funness. But a secure OS would NOT allow (non-root) user-space applications to access memory/hardware directly now, would it? – Tristan Seifert Jun 11 '11 at 4:57
Nope, that's not how iTunes works -- interesting theory, though! – duskwuff Jun 11 '11 at 5:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .