sched_ule performance on single CPU

Oliver Fromme olli at lurza.secnetix.de
Fri May 23 16:16:25 UTC 2008


Unga <unga888 at yahoo.com> wrote:
 > Idle-prio process which generates lot of I/O is
 > understandable.
 > 
 > But when you either record or playback audio as
 > realtime-prio and you opened up a pdf document as
 > normal-prio, can the pdf rendering in normal-prio
 > breaks down the realtime audio process? I don't think
 > pdf rendering is I/O intensive.

I think it can.

Opening a PDF causes quite a lot of I/O.  The viewer
application has to be paged in from disk, all the
libraries and configuration files it uses, possibly
even parts of the X server have to be paged in,
depending on what features of the X protocol and
which extensions the viewer application uses.
And of course the PDF itself has to be loaded (which
might be not small), and finally all fonts used by
the PDF have to be loaded by the viewer application.

On the other hand, the default buffer space of the
audio driver is quite small (the reason for that is
to reduce latency for sound effects in games).  So
even a very short I/O congestion can cause an audible
hiccup in audio playback or recording.

 > Using a faster processor or multi-core may solve this
 > problem,

No, faster I/O hardware will solve it, or hardware
that better supports concurrent access.  It's also
quite possible that improvements in FreeBSD's disk
system might solve the problem, i.e. by reordering
disk access in a more efficient manner, but this is
very non-trivial.  But all of that is not a matter
of the process scheduler.

Anotehr solution is to use more aggressive buffering
by either the audio application or the audio driver.
The latter can be set via sysctl. The former is a
matter of your audio application.

I use mpg123 for mp3 playback on a 3-year old UP
machine.  It has a buffer option which I use.
E.g. "mpg123 -b5000" will use 5 MB buffer; that's
enough for half a minute of audio.  I do not use
renice, idprio, rtprio or anything, but still
audio playback works perfectly fine, even during
a buildworld.  Or when opening a PDF.  No hiccups.

Best regards
   Oliver

-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"With sufficient thrust, pigs fly just fine.  However, this
is not necessarily a good idea.  It is hard to be sure where
they are going to land, and it could be dangerous sitting
under them as they fly overhead." -- RFC 1925


More information about the freebsd-stable mailing list