[comp.unix.questions] Process stopped with negative priority

barmar@think.com (Barry Margolin) (04/23/91)

In SunOS 4.1.1 on a Sun-4/370:

From time to time I notice the load on our system seems high (steadily
over 1), even though "top" doesn't show any processes running heavily.
When I do a "ps l" I notice a line like the following:

       F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN    STAT TT  TIME COMMAND
200080201691 23038 19853  0  -5  0 152    0          TW   p9  0:00 e

This completely idle process drives the load up artificially, because the
load average includes any processes with negative priority (why? are they
actually kept on the run queue?).

If I send the process a SIGCONT, it immediately stop again, but this time
with a non-negative priority:

       F UID   PID  PPID CP PRI NI  SZ  RSS WCHAN    STAT TT  TIME COMMAND
200080211691 23038 19853  0   3  0 152  104          T    p9  0:00 e

Does anyone know what causes processes to get into this state?  What
possible meaning could there be having a negative priority while stopped?

Actually, I did come up with one hypothesis: "e" (another name for "vi", I
think) has to catch SIGTSTP so it can reset the terminal modes, and then
sends itself a signal to actually stop itself.  Maybe there's a race
condition in the kernel that causes this to stop the process while it's
still in the kernel, so its priority gets stuck.

It's almost always the program "e" (which, given the users I've seen this
happen to, I think may be getting typed by accident), although I think I've
seen it with other programs, but I can't remember any in particular.
--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar