Hylafax will NOT send out a fax if 'setiathome -nice 19' is running .
Sendfax is running, stuck on the fax-modem, and cannot be killed.
But if I kill setiathome, the fax is sent.
I've never seen setiathome interfere with anything else.
--
JP
Jean-Pierre Radley wrote:
I would have to look at Hylafax source to be sure (and I don't have it),
but if this is what I guess it is, setiathome is not at fault. Stop it
and run:
sh -c 'while :; do :; done' &
which is a Bourne shell infinite loop. Now try sending a fax. I
suspect this will block sendfax just as effectively as setiathome does.
... Ok, I got the Hylafax source and it is just as I suspected. In
hylafax-4.1/faxd/ModemServer.c++, we have:
=============================================================================
#elif HAS_POSIXSCHED
/*
* In POSIX (i.e. Linux), a real time priority is
* between 1 (low) and 99 (high);
* for now we conservatively use 1. Priority of 0
* is without real-time application.
*/
#include <sched.h>
static const struct SchedInfo {
int policy;
int priority;
} sched_setschedulerParams[9] = {
{SCHED_OTHER, 0}, // BASE
{SCHED_OTHER, 0}, // RUNNING
{SCHED_OTHER, 0}, // MODEMWAIT
{SCHED_OTHER, 0}, // LOCKWAIT
{SCHED_OTHER, 0}, // GETTYWAIT
{SCHED_FIFO, 1}, // SENDING
{SCHED_FIFO, 1}, // ANSWERING
{SCHED_FIFO, 1}, // RECEIVING
{SCHED_OTHER, 0}, // LISTENING
};
...
struct sched_param sp;
sp.sched_priority = sched_setschedulerParams[s].priority;
if (sched_setscheduler(0, sched_setschedulerParams[s].policy, &sp))
traceServer("sched_setscheduler: %m");
=============================================================================
So Hylafax is calling sched_setscheduler(0, SCHED_FIFO, 1). This is
probably correct for Linux. On OpenServer, the process is volunteering
to be run only when no other process except the CPU idle thread is ready
to run. It is giving itself a fixed priority of just about as low as
possible.
The code assumes that all realtime priorities are higher than all
non-realtime priorities. This is not true on OpenServer, which offers
realtime priorities of 0-127 and traditional Unix priorities of 0-95.
Traditional Unix (SCHED_OTHER) scheduling involves the scheduler
dynamically raising and lowering a process's priority based on recent
CPU usage (more usage -> lower priority, which means that non-CPU-
intensive tasks get quick response when they do need some CPU).
Assigning a "realtime" (SCHED_RR or SCHED_FIFO) priority in the range of
0-95 just means that the process has nailed itself to a particular
position within that range; SCHED_OTHER processes will drift above or
below the realtime process depending on how much CPU they've been using
recently. Only by requesting a realtime priority >95 can a process
guarantee it'll always be more important than SCHED_OTHER processes.
Perhaps Linux offers realtime priorities 0-99 which are all higher than
the SCHED_OTHER priorities; that is, the two types of priority may have
overlapping numeric ranges, but SCHED_RR/0 might still be scheduled with
more priority than SCHED_OTHER/99. The Single Unix Spec v3 says "The
priority ranges for each policy may overlap the priority ranges of other
policies", but does not say anything about whether the _meanings_ of
numeric values in different policies have to correlate in any particular
way. In OpenServer they do.
I know of no runtime way to configure this. One could write a program
to play various sorts of processes off against each other, at various
priorities, and try to guess what the kernel's doing, but that sounds
fragile. Instead, Hylafax's configure script needs to just recognize
the OS and assign suitable priority levels (or skip the priority
diddling entirely -- is it really necessary on modern hardware?)
There are hints in the code that similar problems have been seen on
other systems that implement Posix realtime scheduling. A similar
problem in NTP was fixed a couple of years back.
>Bela<
Thanks for the detailed explanation. I believe this explains a problem
at a client where a PRO/5 process gets in a tight loop (our
bug^H^H^Hfeature, not Basis') and then no one can connect via modems to
diagnose the problem. The remote machines have HylaFAX handling the
modem. This one had me scratching my head.
--
Darryl Krasman
Ideal Computer Group Inc.
Warning... topic drift.
There was some known interaction with adaptec scsi drivers and
floating point operations... This would cause my scsi bus to
hang periodically when setiathome was running. Had to stop
using it (OSR500, adaptec 2940au, 1999). Still running the
same system... It creaks and groans but it just won't die :)
--
Do two rights make | Kevin Smith, ShadeTree Software, Philadelphia, PA, USA
a libertarian | 001-215-487-3811 shady.com,kevin bbs.cpcn.com,sysop
| dvtug.org,kevins--Delaware Valley Transit Users Group