Originally Posted By: altman
Originally Posted By: mlord
The player software loads it into a malloc'd buffer in RAM. Which means that the Linux kernel reads it into the page-cache (RAM), and them copies it to another location in RAM specified by the player software. Note to software developers: use mmap() instead of read() to avoid the memcpy and 2X memory requirement!!


There were good reasons for this; ISTR they are to do with the player running mlock'ed to prevent any non-explicit disk access that the kernel might think is a good idea when the disks are spun down (which then causes blocking at kernel level, as opposed to us explicitly managing the spin up/down in a disk manager thread). JohnR or Mike can probably elaborate on this.

The actual data volume is pretty small in terms of copy overhead so we didn't delve further into the 2.2 kernel to try and fix this.

Hugo

No complaints on the day -- your little mp3 player is a great machine, Hugo!

But for future designs.. mmap(). It can even play friendly with mlock/mlockall().

Cheers