*BSD News Article 16316


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!cs.utexas.edu!uunet!mcsun!sun4nl!tuegate.tue.nl!svin09.info.win.tue.nl!wzv.win.tue.nl!gvr.win.tue.nl!guido
From: guido@gvr.win.tue.nl (Guido van Rooij)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: ps not reporting all procs?
Date: 20 May 1993 12:21:03 GMT
Organization: Eindhoven University of Technology, The Netherlands
Lines: 32
Distribution: world
Message-ID: <1tft3f$doi@wzv.win.tue.nl>
References: <1t3acc$8sh@wzv.win.tue.nl> <1tbbjr$1ar@umd5.umd.edu>
NNTP-Posting-Host: gvr.win.tue.nl

mark@roissy.umd.edu (Mark Sienkiewicz) writes:

]In article <1t3acc$8sh@wzv.win.tue.nl> guido@gvr.win.tue.nl (Guido van Rooij) writes:
]>When you execute a command like: ps|grep <string>
]>you should always at least get one line with the grep command
]>itsself (at least that's what I once learnt). In 386bsd you get
]>that line randomly: sometimes you gte it and sometimes not.
]>
]>Bug or normal behaviour(????)

]Normal behaviour.  You will never see it on a PDP 11, but on fast machines
]like 486's and HP RISC machines, the 'ps' process can read the whole process
]table _before_ the 'grep' process gets _created_.  

]It's a race-- if you try it again on a busy machine, sometimes you will see
]the grep and sometimes you won't.  Note that since ps is earlier in the 
]pipeline, it gets created first.

]Mark S.


The reason I asked was because I never saw it happening on a sun or ultrix
machine. ('it' being the fact that ps read it info before grep starts).
This may mean that ps gets too much time before a context switch....(after
which the grep is created)

-Guido
-- 
Guido van Rooij                 |  Internet: guido@gvr.win.tue.nl
Bisschopsmolen 16               |  Phone:    ++31.40.461433
5612 DS Eindhoven               |  ((12+144+20)+3*sqrt(4))/7 
The Netherlands                 |    +(5*11)=9^2+0