[Alsaplayer-devel] Problems with CPU use, realtime privileges and polling

Robert Bradbury robert.bradbury at gmail.com
Sat Oct 24 18:27:54 BST 2009

I would specifically like to interact with the developers who are
responsible for the code relating to

1) The --realtime switch and the code which set up the SCHED_FIFO priorities
and memory locking.

2) The excessive CPU use by alsaplayer (which may be in part due to improper
"polling" of various file handles).

For problem #1 it looks like the code doesn't appear to output "reasonable"
error messages when either the sched_setscheduler or the mlockall calls
fail.  There also seems to be no attempt to take into account that
non-superusers may be granted both scheduling priority and memory locking
"permissions" using ulimits which in line with those set by the system
admins in /etc/security/limits.conf.  (The code may have been written a long
time ago and never updated to reflect increased abilities of admins to grant
various privileges to certain users/groups.  The only solution I have
currently is to run alsaplayer as root which is highly undesirable.  Using
the "maximum" real time priority should be considered highly dangerous on
most systems.

For problem #2, playing a set of songs (mp3s) off of a hard drive on my
computer using mplayer takes about 3% of the CPU time (measured by top).
Playing the same set using alsaplayer uses anywhere from 15-25% of the CPU.
Which makes the use of alsaplayer highly undesirable for people with "green"
concerns, laptop battery lifetime concerns, etc.  I cannot believe that the
"fancy" graphical display demands 10-20% of the CPU of -- particularly when
it may be "off screen" when the user minimizes it, switches workspaces or
virtual terminals.  I have strace'd an executing alsaplayer and from the
frequency of poll/futex/gettimeofday as well as read calls that do nothing
(return EAGAIN) it seems clear that a lot of work could be done to optimize
alsaplayer to be more efficient.  (Don't feel bad as I'm fairly sure that
all the browsers, firefox, opera, etc. have similar problems.)

Could someone tell me who the responsible people are and if they are still
active working on alsaplayer?  If not, who are the responsible parties to
whom changes should be suggested?

Thank you,
Robert Bradbury (robert.bradbury at gmail.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tartarus.org/pipermail/alsaplayer-devel/attachments/20091024/3bd2c7d9/attachment.htm>

More information about the alsaplayer-devel mailing list