Why Does iTunes Continuously Read From the Hard-drive?

Discussion in 'Mac Apps and Mac App Store' started by eboyer7, Mar 18, 2009.

  1. eboyer7 macrumors newbie

    Mar 18, 2009
    Hi. I have recently discovered an odd behaviour from iTunes: instead of reading an entire song from the harddrive and storing it in ram during playback, iTunes reads small chunks of data very frequently. For example, when playing a 128Kbps song the HD reads 68KB chunks approximately every 3 seconds, and when playing lossless WAVE files the HD is constantly reading at 200KB/s. I found this out by having iTunes open and playing music while having all other programs closed, and monitoring the disk activity from Activity Monitor (and I'm sure that it's iTunes that was reading from the HD because when the music was paused the HD was idle).

    So, my question is why would iTunes do this? This seems like an extremely inefficient use of the harddrive for several reasons:
    - Constantly reading small chunks from the HD uses much more power than reading large chunks infrequently because idle hard-drives use much less power than active hard-drives
    - This will slow down other applications that need to make heavy use of the HD because iTunes will be constantly interrupting anything else that is using the disk (this is especially true for Photoshop or any other program that uses lots of swapfile space)
    - It puts unnecessary wear on the HD heads
    - It is dangerous for laptops, which can easily get thrown around or bumped. Momentarily reading a large chunk of data and leaving the HD idle for the majority of the time will be much safer for the HD heads
    - Hard-drive-based portable music players read large chunks of data infrequently because it is well-known that this saves power and protects the HD in these devices.

    So... is there any reason that iTunes is exempt from these reasons??


    PS: I originally posted this on the Apple Discussions, but wasn't able to get an answer there.
  2. MisterMe macrumors G4


    Jul 17, 2002
    I take it that you are not familiar with preemptive multitasking operating systems and virtual memory. You are not running System 6 or MS-DOS. The UNIX-based virtual memory system in MacOS X is highly efficient. Conversely, storing everyting in RAM is highly inefficient.

    Answer this question: "If you are not going to play the end of a song until three minutes after you play the beginning of the song, then why would you load the end of the song into RAM when that RAM could be used for data that will be used sooner?"
  3. neonblue2 macrumors 6502a

    Aug 25, 2006
    Port Pirie, South Australia
    This one's very easy to answer. Since 2005 there have been Sudden Motion Sensors in at least the Pro-level laptops that Apple make. If you happen to bump your laptop or drop it to the point that damage could occur, the hard drive heads disengage from the platters. As the user you'd see the whole system just stop momentarily...and then start moving again with no ill effects.

    It's happened to me a few times when I've grabbed the computer a little too quickly. I'll sit down and the computer is unresponsive for a second or two.
  4. eboyer7 thread starter macrumors newbie

    Mar 18, 2009
    I know a thing or two about them, but I've never built one or done much programming for one, so I've never seen the code or algorithms for how they work. I'll take your word that they're efficient.

    I know about the sudden motion sensor. Actually, I've seen it working many times on my MacBook. But nevertheless, parked harddrive heads are safer than SMS-protected one.
  5. sammich macrumors 601


    Sep 26, 2006
    The simple fact is that, where do you decide to load the entire song into memory? After 5 seconds? after 5% of the total play time? What if the song is really a Podcast that's about 2 hours long (say a university lecture). Do you load that monstrously huge file into memory. Or in your case, what if it's a low compression format like AIFF/WAVE or Lossless?

    Maybe a SSD is more suited for you?
  6. Consultant macrumors G5


    Jun 27, 2007
    Actually for DJing purposes loading the whole song or at least more than few seconds of song would be better. Perhaps write to apple.com/feedback or submit a bug developer.apple.com/BugReporter/
  7. eboyer7 thread starter macrumors newbie

    Mar 18, 2009
    Ya, there's definitely a lot of circumstances where loading most of the song would be advantageous. I was going to submit feedback to Apple about this, but thought it'd be better to see what others had to say about it first. I'm guessing that Apple did at least some research to figure out which HD-reading method would be the best.

Share This Page