fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] Question about running as root


From: Josh Green
Subject: Re: [fluid-dev] Question about running as root
Date: Fri, 06 Apr 2007 16:57:50 +0200

On Fri, 2007-04-06 at 10:23 -0400, Marcus Planet wrote:
> Hi Josh and all,
> 
> My program Wave Harp (http://waveharp.sourcforge.net) is based in
> large part on the great fluidsynth libs and I have some newb
> questions, the first one being:
> 
> It appears that fluidsynth is happier running as root.  That is to
> say, the warning "swapping is possible" comes up when one does not run
> as root.  My program, being based partly on fluidsynth, behaves
> similarly.  Could I hear why it is helpful for fluidsynth to run as
> root?  I have not come across this explanation thus far in my
> informational travels.
> 
> Thank you very much!
> 
> Marc
> 

Hello Marcus,

FluidSynth currently loads all sample data into RAM, rather than
streaming the data from the disk.  Some privileged system calls are used
to ensure that FluidSynth obtains high priority in regards to scheduling
and that the sample data doesn't get swapped to disk (causing potential
sound card underruns when the sample data must be loaded from swapped
hard disk space).

In particular it does the following:

- Calls mlock() on the sample data ("man mlock" for more info)
- Sets SCHED_FIFO scheduling to ensure that FluidSynth obtains high
priority

The Linux kernel has capabilities now which can be used to give
unprivileged users access to features such as mlock and scheduling
changes.  "man 7 capabilities" or:

http://www.die.net/doc/linux/man/man7/capabilities.7.html

In particular CAP_IPC_LOCK allows a process to lock memory and
CAP_SYS_NICE I believe should allow a process to be set SCHED_FIFO.  In
this way Linux could be configured to make running as root un-necessary
for low latency operation.  In reality though, there are lots of other
factors which contribute to a good low latency audio system.  Here is a
Gentoo specific wiki page on getting Jack to run, which covers many of
the areas which need attending to when building such a system.

http://gentoo-wiki.com/HOWTO_Jack

Best regards,
        Josh Green






reply via email to

[Prev in Thread] Current Thread [Next in Thread]