Subject: Re: ps hangs?
To: Bert Driehuis <>
From: Perry E. Metzger <>
List: current-users
Date: 11/07/1995 12:01:31
Doesn't sysctl lock the kernel data structures to allow you to avoid
such things? If so, a sysctl based ps would be a win...

Bert Driehuis writes:
> Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU> wrote:
> >I've seen it on x86 machines, but only when they're under very heavy
> >load.  It's likely due to the fact that the kernel data structures that
> >'ps' uses can change when ps is running, and ps doesn't (can't) get
> >them atomically.  Were ps more careful, it might be able to avoid the
> >infinite(?) loops, but that's not entirely clear.
> The simple (yet ugly) workaround is to limit the number of fetches for
> process structs to maxprocesscnt, and warn if that limit is exceeded. If
> memory serves me, this is what BSDI did. The problem will manifest itself
> for sure if you have scripts from cron that use ps output on a Web server.
>                                         -- Bert Driehuis
> ------
> Bert Driehuis                 God, grant me the serenity to accept the things
>        I can't change, courage to change the things I
>                               can, and the wisdom to know the difference.